Uh oh!
There was an error while loading. Please reload this page.
feat(pm): a history helper that refuses to answer from a truncated clone - #9903
Conversation
…d history Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
PM review — ACCEPT. You falsified my H2 and it was the right call. Status is |
Uh oh!
There was an error while loading. Please reload this page.
Part of #9878
Ruling 1's
scripts/pm/helper, built on measurements rather than on the card's sizing —two of which changed its design. Ruling 2's second deliverable could not be done; the
reason is below and is a sequencing question, not a skipped step.
H1 — the silent wrong answer, reproduced twice
A shallow clone answers a
--sincequestion plausibly, wrongly, at exit 0, with nowarning. Both reproductions are real clones, not fixtures of the argument:
git clone --depth=63(the card's shape)The 63-commit clone also answers
git log --since=2026-07-19 --until=2026-08-01withzero lines — indistinguishable from "nothing landed that fortnight". That is #4690's
shape: zero is a broken scan, not a clean repo.
The card's premise holds, with one correction: the 63-commit depth is not universal.
This container arrived with a 2026-06-02 floor and 4,585 first-parent commits. The hazard
is the invisible floor, not any particular depth — which is why the helper checks the floor
against the window rather than trusting a constant.
Two measured findings that changed the design
1.
git fetch --shallow-sinceis not monotonic — it SHORTENS too. The card's ownsuggested remedy, run against a clone that already had more history than asked for, threw
history away at exit 0:
git fetch --shallow-since=2026-07-19 origin maingit documents this ("deepen or shorten"). A helper that ran the naive command would be
a second instance of the defect it exists to end. So
chooseDeepenSince()never passes adate newer than the oldest boundary already present; the deepen it issues can only add.
(The shared checkout was restored immediately and is now deeper than it started.)
2.
--is-shallow-repositoryis the wrong predicate on its own. H2 asked the helper to"check
--is-shallow-repositoryafter deepening and fail loudly if still shallow". Measured:after a legitimate deepen this repo still reports
truewhile answering the asked monthexactly. That guard would refuse provably correct answers and train seats to bypass it.
H2's intent is implemented, its mechanism is replaced: the check is that the newest
boundary commit reachable from the ref predates
--since, so the window sits entirely abovethe floor.
H4 — cost, and therefore adoption
Cheaper than the ~15 s the card estimated, and the common case pays nothing: coverage is
proved from local refs first and a fetch is issued only when the floor actually intrudes.
H3 — the census, converting "a family of three" into a population
37 pre-existing history-reading call sites across 17 files in
scripts/and.github/workflows/. Classified by what a shallow clone does to each:?)The three unguarded ones, and the sharpest result: CI is not the exposure. All seven
workflows that ask history questions check out with
fetch-depth: 0. Every remainingexposure is in seat-run tooling — run by an agent, in a shallow container:
scripts/pm/check-governed-merges.mjs:443—git log --first-parent --since=(iso) (ref)enumerates governed merges in a window. CI runs only its
--self-test; the realenumeration is a PM-seat command. Under-enumeration reads as compliance.
scripts/check-engine-split-ratio.mjs:63— the ADR-0076 D7 trigger metric. Its workflowis
fetch-depth: 0, so CI is fine; a seat running it locally gets a truncated window, andtotal === 0 ? 0turns an empty scan into a healthy-looking 0.0%.scripts/collect-release-notes.sh:120—--since/--untilover the cloud checkout. Noworkflow caller at all; it runs at release time, from a seat.
The six already-guarded files include #9555's and #9408's fixes, so the repo has already
closed two-thirds of this family one instance at a time. Filed as #9902, not fixed here.
What the helper does
refuses — exit 2, and stdout stays empty, so a caller capturing the number gets an
empty string rather than a plausible one.
method: git rev-list --count --first-parent origin/main since 2026-07-18 until 2026-08-18 · floor 2026-05-03 · tip 2026-08-19 · floor already predates the window (no fetch)question. Found while testing: a depth-63 fixture whose
origin/mainstopped at 2026-08-16answered 2,902 for the month to 2026-08-19 — and 2,902 is exactly correct for that ref.
Nothing in the number said the ref stopped three days early. A stale ref is now legible in
the pasted method line.
Not wired into
lint.yml(ruling 3) and not registered as acheck:script, matchingrelease-rehearsal-clone.mjs— the same family's #9555 fix, also a seat tool rather than agate.
Ruling 2, second deliverable: NOT DONE, and it cannot be done here
The
269comment does not exist onmain. Verified on currentorigin/main(
cfe1c49026, with #9875's460d7aa6b1already in history):It exists only on PR #9712's head
b1789af5f(line 180), arriving as part of that PR's+2,043 lines. Editing
mainwould mean inventing a comment for code that is not there, andit would land squarely in the conflict that PR is already in. Per the PM's instruction to
report rather than force, the corrected text is handed over instead — #9712 remains open and
is not addressed by this PR.
A denominator swap alone would not be honest. The sentence reads "over the 269 commits
... membership of the pinned set changed in 7 commits (2.6%)". The 7 was itself measured
by scanning only the 269 visible commits, so the numerator is truncated too, and 7/3,110
= 0.22% would be a new unverified claim rather than a correction. Also worth flagging: PR
#9875 re-measured the durability populations, not the engine-double pinned set, so it
corroborates the class of the zero-leaves result rather than that exact number.
The verified denominator for #9712's own window (month to 2026-08-18, first-parent, measured
with this helper): 3,110.
Verification
Gate union re-run on the final commit
fe7d580ba9, derived from the actual changed path withnode scripts/pm/dispatch-gates.mjs, all green:check:cross-package-test-inputs·check:nul-bytes(self-test + real run) ·git-history --self-test(26 cases)Control-byte sweep over the new file (
grep -naP): clean.Reverse verification — direction predicted before each run, every ablation restored from
a commit, all three observed as predicted:
windowIsCoveredbecomes the naive!shallowchooseDeepenSincedrops the anti-shortening ruleNo changeset: a seat-run tool under
scripts/pm/, nothing published changes.Generated by Claude Code
Generated by Claude Code