Repository navigation
feat(ci): a deferred ledger annotation, enforced so it cannot retire work - #812
Merged
Merged
Conversation
…e work Found by USING the ledger rather than reading it: #809's was the first one ever closed, and the #756 sweep it recorded fitted neither annotation. `n/a` was false (the work was real) and `blocked` was false (nothing blocked it — another ticket owned it). It got `n/a` with the reason spelled out, which blurred the distinction the whole mechanism rests on: an empty box means exactly one thing, and that is only true while every other outcome has somewhere else to go. So there are three annotations now, and the asymmetry is the design: n/a — <why> ticks the item does not apply deferred — #<ticket> ticks real work, owned by a filed ticket blocked — <why> EMPTY could not be established; goes in the report `deferred` is the only one with a syntactic requirement, and it needs one: it TICKS the box, so a deferral naming no ticket would be the way to retire an item into nothing — strictly worse than the unticked box it replaces. `pr_ledger_scan` therefore counts them, and `pr-ledger-audit.sh` reports `LOOSE-DEFER (k)` separately from `OPEN (k)` because the remedy differs: file the ticket, do not do the work. Making that checkable needed the scan to group each box with its CONTINUATION LINES, since the annotation usually lands on a wrapped line — a per-line test would see the tick and the ticket separately and could not relate them. The regrouped scan reproduces #809's real ledger exactly (12 boxes, 0 unticked, 0 loose, and its one ticked box containing the word "deferred" passes because it names #810). The self-test earned its place twice here. It caught that adding a fifth field to the scan broke an assertion through a short `read` folding the trailing fields into one variable — so every caller now reads all five, and the function doc says why. Also corrects what is now false everywhere it was stated: `pull request contract` IS a required context as of today. The order that made it safe — report on real PRs, observe it failing, confirm no open PR would be blocked, then append — is recorded in ci-and-supply-chain as the reusable part, with the two mechanics that cost care: the endpoint REPLACES the context list, and `mergeStateStatus` cannot tell you what blocks a PR (both open ones read BLOCKED straight after the PATCH, neither by the new context).
deferred annotation, so an empty ledger box keeps one meaningdeferred ledger annotation, enforced so it cannot retire work
athvin
marked this pull request as ready for review
November 7, 2026 21:29
…-line cap `agent skills (lint + drift)` went red on this PR with `ci-and-supply-chain: SKILL.md body is 508 lines (max 500)` — my section had pushed it past the authoring cap. The cap is the economy rule: a SKILL.md is the routing layer, and detail belongs in `references/`. So the detail moves to `references/pr-contract.md` — what the check asserts and what it deliberately does not, the exemption table, the promotion order, and the rollup finding — and SKILL.md keeps a 23-line summary pointing at it. Body is 460 lines now. Every `references/*.md` must be linked from SKILL.md in the exact `](references/x.md)` form or the same gate errors on an unreachable reference, so the pointer is load-bearing rather than courtesy. Worth recording why this reached CI at all: I ran `scripts/skills-check.sh regen`, saw "generated references are current", and took it as the gate. Regen is one stage — it does not lint. The gate is `make skills-check`, which runs the regression test and then `all`.
athvin
pushed a commit
that referenced
this pull request
Nov 7, 2026
`skills-check.sh` ended with one unconditional `echo "skills-check: ok"` that
every subcommand fell through to — including `regen`, which rewrites the
generated blocks and asserts **nothing**. So the output of a run that checked
nothing was indistinguishable from the gate passing:
$ bash scripts/skills-check.sh regen
skills-check: regen
regenerated 18 generated files
skills-check: ok <- checked nothing
Measured cost: a red `agent skills (lint + drift)` on #812. I ran `regen`, read
that line, and pushed a SKILL.md eight lines past the 500-line body cap — a
`lint` error `regen` never looks for. There is a second reader too:
`generated-artifact-healer`'s allow-list includes `skills-check.sh regen`, so
the false verdict was being served to an autonomous agent as well as to me.
The fix is a verdict that cannot over-claim, because it enumerates what it
covered:
skills-check: ok (drift, lint, overrides, generators) # all
skills-check: ok (overrides) # overrides
skills-check: regen done — NOTHING WAS CHECKED. The gate is 'make skills-check'.
Each dispatch arm declares the stages that actually assert something; `regen`
declares none, and the empty list is what selects the second message. Nothing
in the tree parses the old line — checked across workflows, the Makefile and
the scripts — so this is output-only.
The self-test covers both directions, and the slow half is **stubbed rather
than skipped**: `regen` was measured at 113s on this repo, so the suite copies
the real script with only `run_regen` replaced, leaving the dispatcher and the
verdict — the logic under test — intact. The insertion is asserted to have
happened exactly once, because an anchor that stopped matching would silently
run the real 113s regen and pass having proved nothing. Runs in 0.59s.
Mutation-tested against the real pre-fix file from `origin/main` rather than a
hand-built mutant: that file fails three of the new assertions, including the
load-bearing one. My first hand-built mutant passed it, which was the test
being inconclusive rather than the code being right — it died on `set -u`
before reaching the verdict.
My first draft of that assertion was itself wrong in this file's own documented
way: `… | grep -cFx '…' | grep -qx 0` reported a failure against correct
output, because `grep -c` exits 1 when it counts zero and `pipefail` promotes
that to the pipeline's status — with `grep -q` behind a pipe on top of it. It
now counts into a variable with `|| true` and compares numerically, which is
the idiom the rest of the file already uses.
8 of 9 tasks
athvin
added a commit
that referenced
this pull request
Nov 7, 2026
* wip: claim #818 — regen must not print a verdict it did not earn * fix(skills): regen must not print a verdict it did not earn `skills-check.sh` ended with one unconditional `echo "skills-check: ok"` that every subcommand fell through to — including `regen`, which rewrites the generated blocks and asserts **nothing**. So the output of a run that checked nothing was indistinguishable from the gate passing: $ bash scripts/skills-check.sh regen skills-check: regen regenerated 18 generated files skills-check: ok <- checked nothing Measured cost: a red `agent skills (lint + drift)` on #812. I ran `regen`, read that line, and pushed a SKILL.md eight lines past the 500-line body cap — a `lint` error `regen` never looks for. There is a second reader too: `generated-artifact-healer`'s allow-list includes `skills-check.sh regen`, so the false verdict was being served to an autonomous agent as well as to me. The fix is a verdict that cannot over-claim, because it enumerates what it covered: skills-check: ok (drift, lint, overrides, generators) # all skills-check: ok (overrides) # overrides skills-check: regen done — NOTHING WAS CHECKED. The gate is 'make skills-check'. Each dispatch arm declares the stages that actually assert something; `regen` declares none, and the empty list is what selects the second message. Nothing in the tree parses the old line — checked across workflows, the Makefile and the scripts — so this is output-only. The self-test covers both directions, and the slow half is **stubbed rather than skipped**: `regen` was measured at 113s on this repo, so the suite copies the real script with only `run_regen` replaced, leaving the dispatcher and the verdict — the logic under test — intact. The insertion is asserted to have happened exactly once, because an anchor that stopped matching would silently run the real 113s regen and pass having proved nothing. Runs in 0.59s. Mutation-tested against the real pre-fix file from `origin/main` rather than a hand-built mutant: that file fails three of the new assertions, including the load-bearing one. My first hand-built mutant passed it, which was the test being inconclusive rather than the code being right — it died on `set -u` before reaching the verdict. My first draft of that assertion was itself wrong in this file's own documented way: `… | grep -cFx '…' | grep -qx 0` reported a failure against correct output, because `grep -c` exits 1 when it counts zero and `pipefail` promotes that to the pipeline's status — with `grep -q` behind a pipe on top of it. It now counts into a variable with `|| true` and compares numerically, which is the idiom the rest of the file already uses. --------- Co-authored-by: bmoore813 <[email protected]>
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.
Closes #810
What
The second half of #810: a third ledger annotation,
deferred — #<ticket>, witha check so it cannot become a way to make work disappear. The first half — the
promotion — is already done:
pull request contractis now the 15th requiredcontext.
Why
#809's ledger was the first one ever closed, and the #756 sweep it recorded fit
neither annotation:
n/awas false (the work was real) andblockedwas false(nothing blocked it — another ticket owned it). It got
n/a, which blurs theone invariant the mechanism rests on: an empty box means exactly one thing.
Proof
make pr-contract-check→ 29 assertions, 0 failed, 7 of them new. The regroupedscan reproduces #809's real closed ledger exactly: 12 boxes, 0 unticked, 0
loose.
workflow-shell-check,scripts-home-check,actionlintandskills-checkgreen; regen produced no diff.Risk & rollback
Risk is confined to the classifier's box-counting, which the audit and the gate
both read. The real-ledger regression above is the mitigation: a grouping bug
would have changed #809's numbers. Rollback: revert — the annotation is additive,
and nothing in the tree requires it.
Post-merge ledger
Closed by: agent · session
4bc5a8d3-968f-421f-97af-274d64ddb944onbrians-MacBook-Pro· 2026-11-07T21:57:10Zmainis green with this change on it — merge2ea5021e,rustrun42417119845: success, 23 jobs, no failed jobs.infra,devcontainerandfrontendon the same SHA also success, andorigin/mainis2ea5021ewith no failures on its head.images—n/a, 0 runs on2ea5021e: nothing that goes into animage changed (
.claude/,.github/,scripts/ci/,CLAUDE.md).deploy—n/a, and worth stating precisely because it differs fromfeat(ci): a pull request contract — a ticket, and a post-merge ledger #809: a deploy run does exist for this SHA and concluded
skipped(feat(ci): a pull request contract — a ticket, and a post-merge ledger #809 had none at all). A skipped run is not a deploy — no image was
built, so no
workflow_runcarried a new digest, and nothing underinfra/k8s/**changed for its own push door. Nothing was applied, andnothing should have been.
deployskippedas above;
driftgreen 2026-11-07T06:01;kind's scheduled leg green2026-11-07T06:44. Neither reads anything this diff touches.
Done, by the automation, confirmed from the issue'sown timeline rather than the card: Promote 'pull request contract' to a required status check (sweep #756 first) #810 is
CLOSED / COMPLETEDwithcloser.__typename = PullRequest,#812. Never touched by hand.n/afor Promote 'pull request contract' to a required status check (sweep #756 first) #810 itself, which is fully closed: thepromotion landed before this PR and the annotation landed in it. One new
ticket came out of the work rather than out of the change: skills-check: 'regen' prints a reassuring line and does not lint — say so where it is read #818, below.
deferred — #818. The lesson isthat
skills-check.sh regenprintsgenerated references are currentand does not lint, so a SKILL.md over the 500-line body cap passes it
and fails CI; the gate is
make skills-check. It belongs where thatmisleading line is emitted, which is a change to
regenitself ratherthan to this PR, so skills-check: 'regen' prints a reassuring line and does not lint — say so where it is read #818 owns it. (This box is the first real use of the
annotation this PR shipped — and it names a ticket, which is what keeps
pr-ledger-audit.shfrom reporting it asLOOSE-DEFER.)Specific to this change
pull request contractmerge as a REQUIRED context — itgated rather than merely reported:
pull request contractis index 14of the 15 required contexts, and its latest check-run on
64a47342concluded
success. The PR loop's own exit condition confirms the otherside —
missing=[]was computed by diffing the satisfied set against thelive 15-context required set, so the new context had to be satisfied for
the loop to exit at all.
pr-ledger-audit.shagainst the SHIPPED classifier — not thelocal copy. Extracted
scripts/ci/pr-contract.shfromorigin/mainat2ea5021eand scanned feat(ci): a pull request contract — a ticket, and a post-merge ledger #809's real closed ledger with it:boxes=12 unticked=0 loose=0 status=ok— identical to the pre-changereading. That is the regression that mattered, since this PR rewrote the
box-counting both the gate and the audit depend on.
Context — plan, discoveries, measurements, files
Plan
pull request contractto required (done before this PR — not acode change, so it could not be part of one).
deferred — #<ticket>toland-prPhase 4, the template comment andCLAUDE.md, with the tick/empty asymmetry stated rather than implied.
deferrals that name no ticket, surface them in the audit as
LOOSE-DEFER.Discoveries
after being notified rather than needing its body rewritten, and ci(bluegreen): run the two-colour cutover acceptance criterion in ci (#656) #811 was
opened straight from the template — so both open PRs passed before the
promotion, and I confirmed it per-PR with the classifier rather than assuming.
mergeStateStatuscannot tell you what blocks a PR. Both open PRs readBLOCKEDimmediately after the PATCH; neither was blocked by the new context— each was waiting on its own Rust jobs. Only diffing the satisfied set
against the required set answers it.
required_status_checksendpoint replaces the list. The 14 existingcontexts had to be read, kept with their
app_id, and re-sent; the scriptasserted the old set was preserved verbatim before PATCHing.
readhides a new field. Addinglooseas the scan's fifthoutput silently folded it into the fourth variable, breaking a self-test
assertion rather than any code. Every caller now reads five, and the function
doc says why.
Measurements
pr-contract-test.sh: 22 → 29 assertions, still ~0.3s, no network.boxes=12 unticked=0 loose=0 status=ok— identical to the old scan's reading.
strictstillfalse.Files
scripts/ci/pr-contract.shpr_ledger_loose_deferralsscripts/ci/pr-contract-test.shscripts/ci/pr-ledger-audit.shLOOSE-DEFER (k)besideOPEN (k).claude/skills/land-pr/SKILL.md.claude/skills/ci-and-supply-chain/SKILL.md.github/pull_request_template.md.github/workflows/pr-contract.ymlCLAUDE.md