Skip to content

fix(miner): narrow generateReplayScoringKey's rejection type - #3294

Merged
loopover-orb[bot] merged 1 commit into
mainfrom
fix-replay-scoring-key-nits
Jul 5, 2026
Merged

fix(miner): narrow generateReplayScoringKey's rejection type#3294
loopover-orb[bot] merged 1 commit into
mainfrom
fix-replay-scoring-key-nits

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Follow-up to #3235's review nits. generateReplayScoringKey never lints or scrubs frozen context text, so it can only ever reject with rejected: "selection". Its return type previously reused ReplayTaskRejected, which also advertises an unscrubbable_forward_reference branch that this function can never actually produce -- misleading callers into thinking they need to handle a case that doesn't exist. This narrows the type to a new ReplayScoringKeyRejected and adds a regression test pinning the documented eligibility asymmetry: a candidate whose frozen context generateReplayTask rejects as unscrubbable still yields a valid scoring key from generateReplayScoringKey.

Addresses the remaining 2 code-level nits from #3235's review; the other 2 were prose/comment-placement suggestions judged as non-actionable.

Scope

  • packages/gittensory-miner/lib/replay-task-generation.d.ts -- new ReplayScoringKeyRejected type, narrowed generateReplayScoringKey signature
  • test/unit/miner-replay-task-generation.test.ts -- regression test for the eligibility asymmetry
  • No runtime (.js) change needed -- the implementation already only ever produces the narrower shape

Validation

  • npm run typecheck
  • npx vitest run test/unit/miner-replay-task-generation.test.ts (20 passed)
  • npm run test:ci (full local gate, green)
  • Rebased onto latest main

Safety

  • Type-only change plus a test; no behavior change, no secrets/private terms touched

generateReplayScoringKey never lints or scrubs frozen context, so it can
only ever reject on selection -- reusing ReplayTaskRejected advertised an
unscrubbable_forward_reference branch this function can never produce.
Adds a regression test pinning the documented eligibility asymmetry
against generateReplayTask for the same candidate.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui f4dd645 Commit Preview URL

Branch Preview URL
Jul 05 2026, 01:08 AM

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 5, 2026
@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-05 01:11:19 UTC

2 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a narrow declaration-file cleanup that matches the documented runtime behavior: `generateReplayScoringKey` only rejects on freeze-point selection, while the task generator can additionally reject on context linting. The added regression test drives the real production helpers with the same candidate and correctly pins that asymmetry without fabricating an impossible payload. I do not see a reachable correctness defect in the diff.

Nits — 3 non-blocking
  • nit: test/unit/miner-replay-task-generation.test.ts:222 documents the runtime asymmetry, but this PR's actual contract change is type-level; a compile-time assertion would pin the narrowed `ReplayScoringKeyRejected` union more directly if this package has declaration tests.
  • packages/gittensory-miner/lib/replay-task-generation.d.ts:68 could use a short TSDoc comment on `ReplayScoringKeyRejected` so generated API docs surface the narrowed rejection contract, not just an inline implementation note.
  • test/unit/miner-replay-task-generation.test.ts:222 consider adding a type-level regression alongside the runtime regression, for example asserting that `generateReplayScoringKey(...).rejected` narrows only to `"selection"` when `eligible === false`.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 56 registered-repo PR(s), 46 merged, 423 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 56 PR(s), 423 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 56 PR(s), 423 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.14%. Comparing base (c6813b5) to head (f4dd645).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3294   +/-   ##
=======================================
  Coverage   94.14%   94.14%           
=======================================
  Files         276      276           
  Lines       30246    30246           
  Branches    11021    11021           
=======================================
  Hits        28474    28474           
  Misses       1127     1127           
  Partials      645      645           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 023d2f2 into main Jul 5, 2026
12 checks passed
@loopover-orb
loopover-orb Bot deleted the fix-replay-scoring-key-nits branch July 5, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant