Skip to content

Ref qualification and test sweep - #3

Merged
skunkworker merged 2 commits into
masterfrom
ref-qualification-and-test-sweep
Aug 19, 2026
Merged

Ref qualification and test sweep#3
skunkworker merged 2 commits into
masterfrom
ref-qualification-and-test-sweep

Conversation

@skunkworker

Copy link
Copy Markdown
Owner

No description provided.

skunkworker and others added 2 commits August 17, 2026 22:30
A tag sharing a branch's name silently shadowed the branch: git's ref
search order puts refs/tags/<name> ahead of refs/heads/<name>, and
%(refname:short) returns the shortest *unambiguous* name, which grows a
"heads/" prefix the moment the tag exists. Tagging a release branch with
its own name is ordinary practice, so this reached everyday repos.

The worst symptom was silent: riskCommitCount measured the tag instead of
the branch and reported nothing at risk, so a force delete of a branch
holding real work drew no warning at all.

Resolve refs at the point where the namespace is actually known and carry
them forward, rather than re-deriving later:

  - loadBranches reads %(refname)/%(upstream); shortRef strips the
    namespace for display and name-keyed lookups.
  - remoteDefault, localDefaultBranch and baseBranch return fully
    qualified refs. localDefaultBranch previously probed a bare "main",
    which a tag satisfies, leaving the bug live on the no-remote path.
  - remoteDefault drops symbolic-ref --short, which has the same
    shortest-unambiguous hazard.
  - branchRef qualifies local branch names for git; the model keeps
    riskBase for display alongside riskBaseRef for git.
  - push --delete takes a qualified refspec. A bare one is rejected as
    matching more than one ref when the remote also carries the tag,
    deleting nothing. This also makes deleting an already-absent remote
    branch idempotent rather than an error, which is the better trade:
    the race ends in the state the user armed.

Also preserve pending selections across a fetch. `p` reloaded every
branch struct and silently discarded the user's selections and armed
remotes; a fetch mutates nothing local, so carryMarks copies them onto
the new set. An armed remote is dropped when the fetch reveals the
upstream is gone, since that push could only fail.

Startup stays at 7 git subprocesses, verified with a logging shim.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Records the three-tier review of everyday git edge cases the suite did
not construct, what each tier found, and the corrections real repos
forced on three predictions made before testing them.

The "Ref handling" section states the rule the bug fixes established, so
the shortest-unambiguous-name trap is not walked into again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@skunkworker
skunkworker merged commit 9ac99e0 into master Aug 19, 2026
2 checks passed
@skunkworker
skunkworker deleted the ref-qualification-and-test-sweep branch August 19, 2026 05:24
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