Uh oh!
There was an error while loading. Please reload this page.
test(devx): sweep the shrink-only ratchet self-tests for baseline-presence pins — 33 derived, 1 repaired - #12050
Merged
yinlianghui merged 2 commits intoAug 25, 2026
Conversation
… on its ledger's size The self-test asserted `ruledConsumers.length === 2`. That holds only while both ruled arms are still ledgered, so the gate's own LIVE invariant — "a migrated consumer must lose its entry in the same PR" — could not be obeyed without turning the self-test red, and red with a message reading "the ledger lost an entry it must have" when the entry was correctly deleted. #5499/#5704 exist to shrink that set; an equality on its size made it un-burnable by construction. Re-spelled as the claim the pin was actually protecting, which survives the set shrinking to empty: every ruled consumer is admitted by one of the two rulings this programme issued (#5704 Q2 / #6664 A), carried on a witness pair so the positive half stays exercised at zero rows; plus a shrink-only CEILING for the anti-growth half that the equality was also doing. Measured: shrinking the ledger by one entry was EXIT 1 before, EXIT 0 after; growth past the ceiling and a marker neither ruling issued both still red. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UjM2ia8Av1v5NqfqQEQmC6
`#9999` reads as a real issue reference to the next author, and quoting it in a PR body cross-references an unrelated card. `#0` is what this repo's other gate fixtures already use for a marker that names nothing on purpose. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UjM2ia8Av1v5NqfqQEQmC6
This was referenced Aug 25, 2026
yinlianghui
marked this pull request as ready for review
August 25, 2026 07:09
Uh oh!
There was an error while loading. Please reload this page.
yinlianghui
deleted the
claude/issue-11694-selftest-present-ratchet-class
branch
August 25, 2026 07:29
This was referenced Aug 25, 2026
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 freeto 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.
Fixes#11694
A shrink-only ratchet exists to be driven to zero. If its self-test pins the current
baseline entries as present — rather than a property of the gate that survives their
removal — the last commit of the burn-down turns the gate's own self-test red, and the
ledger becomes un-burnable by construction. #11692 repaired one instance; this is the
class sweep.
Result: population of 33 derived, 1 defect found and repaired, 32 unchanged.
Files changed:
scripts/check-driver-memory-census.mjs— and nothing else.1. The population, derived (not taken from the card's candidate list)
Both the card and its first comment say the candidate list is a lead. It was: none of
the six named candidates carries the shape, and the one gate that does is not on the
list.
Definition used — a
scripts/**gate that (a) enforces a baseline the project may onlyshrink (a roster of entries, or per-file numeric ceilings), and (b) ships a
selfTest().Reproducible, in three passes:
Derivation of the gate families at the final commit, as required:
2. Per-item verdict — all 33
SURVIVES= the self-test's assertions still hold with the baseline emptied. Before ==after for every row except row 6.
check-adr-0087-registration.mjsLEDGER_SOURCESare fixture pathscheck-adr-anchors.mjsKNOWN_NUMBER_COLLISIONSred.length === numbers.length; reduces to0 === 0check-adr-links.mjsKNOWN_DEAD_TARGETSstaleEntries.length === 0;[].filter()is 0check-auth-mount-ledger.mjsPENDING_DISPOSITIONcheck-cli-test-child-env.mjscli-test-child-env.baseline.jsoncheck-driver-memory-census.mjsdriver-memory-census.ledger.jsoncheck-driver-conformance.mjsLEDGERcheck-durability-degradation-log-level.mjscheck-engine-double-contract.mjsengine-double-contract.baseline.jsoncheck-entry-guard.mjsKNOWN_IMPORT_UNSAFEcheck-error-code-casing.mjscheck-error-status-conformance.mjserror-status-unpinned-baseline.jsonPRE_8963_*are frozen historical snapshots, not the ledgercheck-i18n-coverage.mjsi18n-coverage-baseline.jsonemptyPopulationVerdictcheck-optional-error-sink-contract.mjsoptional-error-sink-contract.baseline.jsoncheck-plugin-teardown-shape.mjsKNOWN_TEARDOWN_UNREACHEDfresh/stale === 0; positive control is a git-pinned revisioncheck-published-readme-exports.mjspublished-readme-exports.baseline.jsoncheck-query-options-erasure-ratchet.mjsquery-options-erasure-baseline.jsoncheck-ratchet-remedy-authority.mjsCONTROLregistrycheck-release-section-coverage.mjsPRE_10232_*check-role-word.mjsrole-word-baseline.jsoncheck-settings-bind-window.mjsKNOWN_PRE_BIND_READS([])auditSource(code, ledger = []). Spot-checked, §5check-skill-compatibility-version.mjsEXEMPTcheck-skills-token-ratchet.mjsCEILINGScheck-startup-registry-verdict.mjsstartup-registry-verdict.baseline.jsoncheck-test-source-alias.mjsKNOWN_UNALIASED_TEST_IMPORTScheck-test-typecheck.mtstest-typecheck-debt.jsonloadLedger()call is inmain(), not inselfTest()check-type-check-coverage.mjscheck-type-source-resolution.mjsKNOWN_DIST_RESOLVED_TYPE_IMPORTScheck-where-matcher-conformance.mjswhere-matcher-conformance.baseline.jsonpm/dispatch-gates.mjsESCAPABLE_LITERAL_LEDGER(empty)pm/check-skill-line-ratchet.mjsCEILINGScheck-slot-lookup-ratchet.mjsslot-lookup-baseline.jsonregen-artifacts.mjsZone-1 constraint honoured: rows 18, 13 and 32 are the gates whose rules#11935 / #11671 /
#11681 claim. None of them carries this shape, so not one byte of any of those three
gates changed.
3. The one repair —
scripts/check-driver-memory-census.mjsBefore:
The gate's own
LIVEinvariant says "a migrated consumer must lose its entry in the samePR, or the ledger becomes the next stale census". That deletion is exactly what #5499's
frozen-driver retirement programme exists to produce — and this equality makes it
impossible: obey
LIVE, and the self-test reds with a message reading "the ledger lostan entry it must have" when the entry was correctly deleted.
After: the claim the pin was actually protecting — no third consumer may be waved into
ruled-permanentunder a marker of this programme's invention — which survives the setshrinking to empty.
validateLedgerShapealready requires somerulingMarker; it didnot require the ruling to be one this programme issued.
The anti-growth half the equality was also doing is kept as
RULED_CEILING, ashrink-only ceiling: lowered by any PR that migrates an arm away, raised only by a new
maintainer ruling. The witness-pair idiom is taken from
ESCAPABLE_LITERAL_LEDGERinscripts/pm/dispatch-gates.mjs, which already solved this at zero rows.No rule changed. No assertion deleted. No exclusion added. The gate's production verdict is
byte-identical.
4. Reverse verification — three legs, each mutation confirmed on disk, restore on a trap
ruledConsumers2 → 1 — the shrink the programme exists to performx self-test: the ledger rules exactly the consumers #5704/#6664 namedruledConsumers2 → 3 (third arm pointing at a file the scan really binds, so only the ceiling can fire)x self-test: the ruled set never grows past what those rulings named (2 arm(s); it may shrink to empty)rulingMarkers→['#0']x self-test: every ruled consumer is admitted by one of this programme's two rulingsLeg A is the defect, measured on the unrepaired file. Legs B and C are the pin still
discriminating: it is not a pin that only ever answers "pass". Every leg printed
MUTATION CONFIRMED ON DISKfrom aruledConsumerslength / marker read before itsreading was taken, and the ledger was restored and re-read after each (
git statusclean).5. Premise checks against
origin/mainsaid, and it has not drifted since.
check-settings-bind-window.mjsline 162 isconst KNOWN_PRE_BIND_READS = [];,auditSource = (code, ledger = []), and both runs aregreen:
✓ settings bind-window guard self-test: all cases pass./✓ settings bind-window: 4 declared / 0 self / 1 structurally upstream / 0 ledgered (68 plugin unit(s) scanned…).scripts/, only 3 read thereal baseline from inside
selfTest(). Everything else defaults its fixture ledger, sothe empty path was never cold and the shape cannot be acquired.
instance found. Every ratchet whose ledger is already empty still reports its scanned
population —
check-settings-bind-window68 plugin unit(s),check-where-matcher-conformance298 matcher(s) discovered … 0 grandfathered file(s),check-entry-guard157 scripts/ file(s) … 2 known-unsafe.6. Out of scope — recorded, deliberately not touched
scripts/— reported, deliberately not swept.packages/spec/scripts/andpackages/lint/scripts/carry shrink-only ratchets of theirown (
check-dual-source-exports.ts,check-exported-any.ts,check-liveness.mts,check-doc-formula-expressions.mjs), and two carry test twins underpackages/**rather than a
--self-test(check-generated-ledger.test.ts,check-react-blocks-declaration-parity.test.ts). One of those twins pins bucket counts asexactly 1 (
expect(output).toContain('1 explicit manual-only generators')) — the samespecies. Widening the sweep is the PM's call, so it is measured here and not touched.
scripts/check-slot-lookup-ratchet.mjsis a shrink-only ratchet with no self-test atall, and its
check:slot-lookupwiring invokes none.check-self-test-wired.mjsenforces only the superset ("a script that ships one must run it"), so this is invisible
to it.
Verification
All at
650639399. Exit codes captured before any pipe; each line below is the gate's ownverdict.
check:driver-memory-censuscheck-driver-memory-census: OK — every declaration is ledgered, every ledger entry is live, and every ruled file states "#6664 census: 2 ruled consumers".check:agent-test-spellingcheck:cross-package-test-inputsAll 109 self-test cases passed. OK: 16 package(s) read outside themselves, all declared…check:entry-guard✓ check:entry-guard: 157 scripts/ file(s) … 2 known-unsafe, ⛔ SHRINK-ONLYcheck:parse-guardcheck:pnpm-filter-targets✓ check:pnpm-filter-targets: 135/168 --filter occurrence(s) across 26 file(s)…scripts/check-ci-filter-parity.mjsOK: all 96 declared cross-package glob(s) (81 unique) are covered…scripts/check-cross-package-test-inputs.mjsOK: 16 package(s) read outside themselves, all declared…check:nul-bytescheck-nul-bytes: OK (scanned 6672 text file(s) … no raw ASCII control bytes)check:pm-dispatch-gates✓ dispatch-gates self-test: 579 cases pass.check:where-matcher✓ where-matcher conformance holds: 298 matcher(s) discovered…The last two are not in the derived list:
dispatch-gates --residueflags them as the twoartifact-roster gates whose roster sits under
scripts/, where asilentverdict "is notevidence in EITHER direction". Run rather than assumed.
Repo-wide lint, not narrowed:
eslint . --no-inline-config --format json— EXIT 0,5066 files linted, 0 errors, 0 warnings — run under the shared verify lock, not narrowed
and not skipped.
No changeset: this is root
scripts/gate tooling and publishes nothing.skip-changesetapplied.
Generated by Claude Code