fix(coord): a branch that predates docs/BACKLOG.md is not a ledger violation#10
Merged
Conversation
…olation Publishing docs/BACKLOG.md (#6) broke the ledger gate on every branch cut before that merge, including PR #7 -- whose diff touched release.yml and leak-gate docs and nothing near a ledger: OSError: git show HEAD:docs/BACKLOG.md failed (128): fatal: path 'docs/BACKLOG.md' does not exist in 'HEAD' CI's change set is `diff base HEAD`. Once origin/main gained the file, a branch that predates it lists docs/BACKLOG.md as CHANGED -- as a deletion relative to base -- despite never touching it. check_backlog then read HEAD for a copy that was never there. `base_has` (added when the file was imported) covers the opposite end: absent on BASE, being added. This is the mirror case -- present on base, absent on HEAD -- and it is the one that fires repeatedly, because it hits every open branch at once rather than the single commit that publishes the file. Both probes now share `_obj_exists`, which asks `git cat-file -e` directly rather than inferring absence from an exception: `git()` must keep raising on real failures, since an error swallowed as "empty ledger" reads as "no numbers taken" -- the false-clean this gate exists to prevent. "The path is not on that ref" is the one non-failure, so it gets its own probe instead of a broad `except`. `head_has` mirrors `head_text`'s ref exactly (HEAD in CI, the INDEX locally), so the guard cannot disagree with the read it guards. Mutation-verified: neutralise the guard and the new test fails with the same exit-128 shape seen in CI. Worth noting for whoever meets this next: the failure looked like an unrelated flake on somebody else's PR, and the first re-run "fixed" nothing -- the run before it had failed for a genuinely different, genuinely random reason (a 3-char needle colliding with base64 ciphertext, fixed separately). Two different faults on consecutive attempts of the same leg is exactly the shape that gets misread as one flaky test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Publishing
docs/BACKLOG.md(#6) broke the ledger gate on every branch cut before that merge — including PR #7, whose diff touchedrelease.ymland leak-gate docs and nothing near a ledger:Why
CI's change set is
diff base HEAD. Onceorigin/maingained the file, a branch that predates it listsdocs/BACKLOG.mdas changed — as a deletion relative to base — despite never touching it.check_backlogthen read HEAD for a copy that was never there.base_has(added when the file was imported) covers the opposite end: absent on base, being added. This is the mirror case — present on base, absent on HEAD — and it's the one that fires repeatedly, because it hits every open branch at once rather than the single commit that publishes the file.The fix
Both probes now share
_obj_exists, which asksgit cat-file -edirectly rather than inferring absence from an exception.git()must keep raising on real failures — an error swallowed as "empty ledger" reads as "no numbers taken", the false-clean this gate exists to prevent. "The path is not on that ref" is the one genuine non-failure, so it gets its own probe instead of a broadexcept.head_hasmirrorshead_text's ref exactly (HEAD in CI, the index locally), so the guard can't disagree with the read it guards.Mutation-verified: neutralise the guard and the new test fails with the same exit-128 shape seen in CI.
A note on how this was found
It surfaced as an unrelated-looking failure on someone else's PR, and the first re-run "fixed" nothing — the attempt before it had failed for a genuinely different, genuinely random reason (a 3-char needle colliding with base64 ciphertext, fixed in #8). Two different faults on consecutive attempts of the same leg is exactly the shape that gets misread as one flaky test and re-run until it goes green.
🤖 Generated with Claude Code