Skip to content

dispatch-gates: baseDrift can resolve the base ref and STILL fail to read the distance — that second unmeasured state is printed as nothing #12815

Description

@os-zhuang

Filed unassigned while implementing #12411 (out-of-scope finding). Not claimed, not graded. #12411's adopted scope is the base === null branch ONLY and that scope is correct; this is the sibling state one layer down, deliberately left alone there.

What was measured

baseDrift() has two ways to reach "no reading was taken", and #12411's fix addresses one:

constbase=read(['rev-parse','--short',DEFAULT_BASE_REF]);if(base===null)return{base: null,behind: null, ... };// <- state A, now spokenconstcounted=read(['rev-list','--count',`HEAD..${DEFAULT_BASE_REF}`]);constbehind=/^\d+$/.test(counted??'') ? Number(counted) : null;// <- state B, still silent

In state B the base ref resolves fine and the distance is what could not be read. driftLines reaches if (!drift.behind) return [] with behind === null and prints nothing — byte-identical to a tree measured level, which is exactly the collapse #12411 is about.

Repro, measured on this branch (with #12411's fix applied)

A checkout whose base ref is fetched but whose own HEAD is unborn:

git init -q -b main unborn && cd unborn
git remote add origin ../up
git fetch -q origin main:refs/remotes/origin/main
git rev-parse --short origin/main -> a03c361 (status 0)
git rev-list --count HEAD..origin/main -> fatal: ambiguous argument (status 128)
baseDrift -> {"base":"a03c361","behind":null,"changed":[],"headDate":null,"baseDate":"2026-08-27T22:39:32+00:00"}
driftLines -> 0 lines, []

So after #12411 lands, STALENESS NOT MEASURED covers the unresolvable-ref case and this one still reads as a clean bill of health.

Why it is worth a card rather than a shrug

Rarity is the argument for saying so, not against: an unborn HEAD, a git that fails mid-run, a future read() that returns something non-numeric all land here, and the reader gets the tool's most reassuring output — silence — in the state where the derived family list is least trustworthy. The same reasoning #12411's triage adopted applies unchanged.

Shape of the fix

Route both states through one predicate rather than adding a second branch beside the first: the rendered sentence differs only in which step failed, and a second hand-written branch is a second thing to keep in sync. Pin the new direction in --self-test from a real repo (the unborn-HEAD fixture above builds in four commands), not from an object literal alone — the literal cannot show that the state is reachable.

Sibling cards held on this same file at filing time: #12410, #12749, #12500, #12797.

Generated by Claude Code

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions