Skip to content

fix(ledger): require git anchoring only when a git submitter is configured - #9842

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
shin-core:fix/ledger-anchor-required-backends-9646
Jul 29, 2026
Merged

fix(ledger): require git anchoring only when a git submitter is configured#9842
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
shin-core:fix/ledger-anchor-required-backends-9646

Conversation

@shin-core

Copy link
Copy Markdown
Contributor

What & why

runScheduledLedgerAnchor asks anchorBackendsMissingForRowHash which backends still lack a status='ok' anchor for the current tip, and re-anchors if any are missing. But it passed a fixed ["rekor", "git"] required-success set — while git is only ever attempted when deps.submitGit is non-null (the real caller supplies it only on an instance with a git anchor backend configured).

So on an instance with no git backend, a tip fully anchored to Rekor was permanently reported as "missing git", and every hourly tick re-anchored a quiet, unchanged tip to Rekor — forever.

The fix

Compute the required-success list from the backends this tick will actually attempt: rekor always, plus git only when deps.submitGit is configured — the same predicate the submission path already gates git on (if (deps.submitGit)), so the missing-check and the attempts can never disagree.

  • git unconfigured + tip anchored to Rekor ⇒ nothing missing ⇒ quiet.
  • git unconfigured + Rekor row failed ⇒ still retries.
  • git configured + Rekor ok but git has no ok row ⇒ still retries and both submitters run.

Tests (test/unit/ledger-anchor-scheduler.test.ts)

  • Regression: submitGit omitted, a tip with a status='ok' rekor row for its exact row_hash, isHourly: true{ shouldAnchor: false, reason: "unchanged" } and submitRekor called zero times (fails on main, which re-anchors).
  • Companion: same setup but the rekor row is status='failed'retry_unanchored, submitRekor called once.
  • Companion: submitGit supplied, rekor ok but git missing ⇒ retry_unanchored, both submitters invoked.

Validation

  • npm run typecheck green; the scheduler suite (30 tests) green.
  • Diff coverage on the changed file is 100% (both arms of the git-configured predicate).
  • git diff --check <base> HEAD clean; no schema/migration change.

Closes #9646

…gured

`runScheduledLedgerAnchor` asked `anchorBackendsMissingForRowHash` about a FIXED
`["rekor", "git"]` required-success set, but git is only ever attempted when
`deps.submitGit` is non-null. So on an instance with no git backend, a tip fully
anchored to Rekor was permanently reported as "missing git" — every hourly tick
re-anchored a quiet tip to Rekor, forever.

Compute the required-success list from the backends this tick will actually
attempt: `rekor` always, plus `git` only when `deps.submitGit` is configured — the
same predicate the submission below already gates git on, so the check and the
attempts can never disagree. A configured git backend still makes a git-less tip
retry; a failed rekor row still retries.

Closes JSONbored#9646
@shin-core
shin-core requested a review from JSONbored as a code owner July 29, 2026 13:28
@loopover-orb

loopover-orb Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-29 13:38:52 UTC

2 files · 1 AI reviewer · no blockers · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This correctly moves the required-success backend list from a fixed ["rekor","git"] constant to a function computed from deps.submitGit, matching the same predicate already used at the actual git submission call site (`if (deps.submitGit)`). This directly fixes the described bug where a git-unconfigured instance would permanently report a rekor-anchored tip as missing git and re-anchor forever, and the three added tests exercise exactly the reachable scenarios (git omitted+rekor ok, git omitted+rekor failed, git configured+rekor ok/git missing).

Nits — 4 non-blocking
  • The `requiredSuccessBackends` helper duplicates the `deps.submitGit` truthiness check already used later at the actual submission call site (ledger-anchor-scheduler.ts) — consider deriving both from one shared boolean to keep them structurally unable to diverge, though as written they can't disagree in practice.
  • The large comment block above `requiredSuccessBackends` repeats context already stated in the PR description; could be trimmed to the non-obvious part (why git is conditional) per repo conventions.
  • Consider extracting `const gitConfigured = Boolean(deps.submitGit)` once in `runScheduledLedgerAnchor` and passing it to both `requiredSuccessBackends` and the `if (deps.submitGit)` submission gate, so the two can never drift even under future edits.
  • The regression test names are good (`ledger: an unconfigured git backend makes every hourly tick re-anchor a quiet tip to Rekor #9646` tagged); keep that convention for future scheduler fixes.

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 #9646
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 ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 71 registered-repo PR(s), 52 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor shin-core; Gittensor profile; 71 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff replaces the fixed ANCHOR_BACKENDS_REQUIRING_SUCCESS constant with a requiredSuccessBackends(deps) function that mirrors the deps.submitGit truthiness gate used at the submission site, and feeds this same list into anchorBackendsMissingForRowHash as required. It also adds the three named regression/companion tests specified in the Deliverables (quiet on unanchored git + ok rekor, retry on

Review context
  • Author: shin-core
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is registered but has no active allocation in the current snapshot.
  • Public profile languages: TypeScript, JavaScript, Solidity, Dart, Python, CSS, PHP, Rust
  • Official Gittensor activity: 71 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Await review-lane availability.
  • Then work through the remaining 1 step in the Signals table above.
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 &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; 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 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.06%. Comparing base (d574e9f) to head (7821b8d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9842      +/-   ##
==========================================
+ Coverage   79.04%   79.06%   +0.01%     
==========================================
  Files         281      282       +1     
  Lines       58409    58447      +38     
  Branches     6698     6712      +14     
==========================================
+ Hits        46171    46209      +38     
  Misses      11955    11955              
  Partials      283      283              
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 Δ
src/review/ledger-anchor-scheduler.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.

@loopover-orb
loopover-orb Bot merged commit 60d900a into JSONbored:main Jul 29, 2026
8 checks passed
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.

ledger: an unconfigured git backend makes every hourly tick re-anchor a quiet tip to Rekor

1 participant