Skip to content

fix(miner): scope checkSubmissionFreshness's claim match to the candidate's own forge host - #10104

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-10004
Jul 31, 2026
Merged

fix(miner): scope checkSubmissionFreshness's claim match to the candidate's own forge host#10104
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-10004

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

fix(miner): scope checkSubmissionFreshness's claim match to the candidate's own forge host

listClaims(repoFullName) is forge-blind, so .find() picked whichever host's row had the
lowest id instead of the row this attempt's own claim was recorded under -- a stale row on
an unrelated forge host could discard a completed attempt (or false-pass on a claim this
attempt never held). Thread apiBaseUrl through the candidate and attempt-runner's call site,
defaulting to DEFAULT_FORGE_CONFIG.apiBaseUrl exactly like the ledger's own normalization,
and ignore rows on a different host entirely instead of matching the first one found.

Closes #10004

…date's own forge host

listClaims(repoFullName) is forge-blind, so .find() picked whichever host's row had the
lowest id instead of the row this attempt's own claim was recorded under -- a stale row on
an unrelated forge host could discard a completed attempt (or false-pass on a claim this
attempt never held). Thread apiBaseUrl through the candidate and attempt-runner's call site,
defaulting to DEFAULT_FORGE_CONFIG.apiBaseUrl exactly like the ledger's own normalization,
and ignore rows on a different host entirely instead of matching the first one found.
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 31, 2026 07:06
@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-31 07:12:47 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This threads an apiBaseUrl through SubmissionFreshnessCandidate/AttemptInput and switches the claim lookup from `.find(issueNumber)` (whichever row `listClaims` returns first) to `.find(issueNumber && host-match)`, closing the described bug where a stale/released row on an unrelated forge host could either falsely abort or falsely pass a submission. The host-normalization mirrors claim-ledger.js's own default-to-github.com convention, and the new tests in miner-submission-freshness-check.test.ts and miner-attempt-runner.test.ts exercise the actual regression scenario (a lower-id released row on one host vs. an active row on another) rather than a fabricated one. The fix closes #10004 as required and is well-scoped to the freshness-check call site plus its one real caller.

Nits — 5 non-blocking
  • The production `SubmissionFreshnessClaimLedger.listClaims` implementation (claim-ledger.js, not shown in this diff) must actually populate `apiBaseUrl` on each row for this fix to work end-to-end -- worth confirming that wiring exists outside this diff.
  • submission-freshness-check.ts's `resolveFreshnessApiBaseUrl` and claim-conflict-resolver.ts's similar host-normalization logic (referenced in the doc comment) look like near-duplicates; consider extracting a shared helper if a third caller ever needs the same normalization.
  • The verbose block-comment style (e.g. the `/** ... Scope local ledger keys by forge host, not bare repoFullName #5563 composite key ... */` on `apiBaseUrl?`) is heavier than typical JSDoc but consistent with this file's existing convention, so not asking for a change here.
  • Confirm claim-ledger.js's listClaims already returns apiBaseUrl per row in production (not just in the test stub) before considering this fix complete end-to-end.
  • Consider whether attempt-cli.js (the real production call site building AttemptInput) needs updating to pass its own apiBaseUrl through, since this diff only shows attempt-runner.ts and its test.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #10004
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 (1 linked issue).
Validation posture ⚠️ 20/25 Preflight is ready, but the PR body does not name the validation run.
Contributor workload ✅ 10/10 Author activity: 98 registered-repo PR(s), 67 merged, 3 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 98 PR(s), 3 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff threads apiBaseUrl through SubmissionFreshnessCandidate (defaulting to DEFAULT_FORGE_CONFIG.apiBaseUrl), widens SubmissionFreshnessClaimLedger's row type to include apiBaseUrl, and changes the .find() match to require equal resolved hosts so a differing-host row is ignored rather than matched, with attempt-runner.ts passing its own apiBaseUrl through; tests cover the released-other-host/a

Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 98 PR(s), 3 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add validation command/output.
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.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@superagent-security

Copy link
Copy Markdown
Contributor

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

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

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.79%. Comparing base (83d8b40) to head (ab0f942).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10104      +/-   ##
==========================================
+ Coverage   79.75%   79.79%   +0.03%     
==========================================
  Files         282      284       +2     
  Lines       58685    58798     +113     
  Branches     6878     6933      +55     
==========================================
+ Hits        46804    46917     +113     
  Misses      11593    11593              
  Partials      288      288              
Flag Coverage Δ
backend 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-miner/lib/attempt-runner.ts 100.00% <100.00%> (ø)
...s/loopover-miner/lib/submission-freshness-check.ts 100.00% <100.00%> (ø)

@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.

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

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.

miner(freshness): checkSubmissionFreshness matches a claim row from the wrong forge host

1 participant