Skip to content

fix: the stale-branch gate reddened against a clean repo (C-320 addendum) - #417

Merged
Polichinel merged 1 commit into
developmentfrom
fix/stale-branch-gate-false-positive
Aug 4, 2026
Merged

fix: the stale-branch gate reddened against a clean repo (C-320 addendum)#417
Polichinel merged 1 commit into
developmentfrom
fix/stale-branch-gate-false-positive

Conversation

@Polichinel

Copy link
Copy Markdown
Contributor

Recovers work orphaned from #416, and fixes the defect that produced it.

The defect

TestF8StaleBranches read git branch -a, which folds in remote-tracking refs — a local cache that goes stale the moment anyone deletes a branch, and that only git fetch --prune refreshes.

So the gate failed against a repository that was genuinely clean.

Demonstrated rather than argued: fabricating only a refs/remotes/origin/release/v1.11.0 ref — no branch on the remote, none locally — was enough to fail it.

It had already cost something. delete_branch_on_merge had removed every merged branch from the remote; the gate went red anyway; nine local branches were deleted chasing a problem that did not exist.

This is C-320's own failure mode, inside C-320's own test file: a gate that reddens for reasons unrelated to what it asserts stops being read.

The fix

Split into two checks with two sources of truth:

Check Source Offline
local release/* leftovers git branch always works
remote release/* leftovers git ls-remote — authoritative skips, per this file's C-320 idiom

Drilled on this branch, not carried over from the earlier run

Clean repo passes
Stale remote-tracking ref only passes — the old false positive
Real local leftover fails correctly

Also recovered here

Both were orphaned when I pushed to docs/postmortem-v190-v1110 after #416 had already auto-merged. No error was raised; the work simply was not on development.

  • C-320 addendum recording the defect — registered there rather than as a new concern, since it is the same root cause with an existing home.
  • The post-mortem's fourth guard-drill finding, since this was found while writing the document about exactly this failure mode.

Verification

Full suite exit 0 · ruff clean · validate_docs.sh exit 0 · register invariants unchanged (index 1764 < 8000, header ≤ 3500)

…dum)

Found by using it, at the end of the v1.11.0 release, and initially
written off as an anecdote. The operator asked whether it was something
we should address. It was.

TestF8StaleBranches read `git branch -a`, which folds in remote-tracking
refs — a local cache that goes stale the moment anyone deletes a branch
and that only `git fetch --prune` refreshes. So the gate failed against a
repository that was genuinely clean.

Demonstrated rather than argued: fabricating ONLY a
refs/remotes/origin/release/v1.11.0 ref — no branch on the remote, none
locally — was enough to fail it.

It had already cost something. delete_branch_on_merge had removed every
merged branch from the remote, the gate went red anyway, and I deleted
nine local branches chasing a problem that did not exist. The actual
cause was a stale view of the world.

This is C-320's own failure mode occurring inside C-320's own test file:
a gate that reddens for reasons unrelated to what it asserts stops being
read. Registered as an addendum there rather than a new concern — same
root cause, existing home.

Split into two checks:
  local  — `git branch`, authoritative for your own leftovers
  remote — `git ls-remote`, authoritative for the remote, and skipped
           when offline per this file's existing idiom (C-320: skip
           where the environment cannot answer, do not guess)

Drilled three ways: clean repo passes; the old false positive now passes;
a real local leftover still fails.

The post-mortem gains this as its fourth guard-drill finding, since it
was found while writing the document about exactly this failure mode. The
irony is kept rather than smoothed: my view of the repository was a
record describing a world that had moved on.

Verified: full suite exit 0, ruff clean, validate_docs.sh exit 0,
register invariants unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Polichinel
Polichinel enabled auto-merge (squash) August 4, 2026 01:08
@Polichinel
Polichinel merged commit 7b103c5 into development Aug 4, 2026
5 checks passed
@Polichinel
Polichinel deleted the fix/stale-branch-gate-false-positive branch August 4, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant