docs(ratchet): describe the equivalence proof that actually happened - #1371
Merged
os-steve merged 1 commit intoAug 27, 2026
Merged
Conversation
The stripping-rule paragraph in scripts/check-source-token-ratchet.mjs said the suite cross-checks the scanner "against the TypeScript compiler's own comment-trivia ranges over every real file in src/". No such cross-check exists anywhere in the repo: zero executable `typescript` imports under test/ or scripts/, zero createScanner / getLeadingCommentRanges calls. The claim was self-confirming to a shallow check, because `typescript` really is a declared devDependency -- it is `tsc --noEmit`'s, not any cross-check's. A reader asking whether the stripper is validated against a real compiler found the claim already made and stopped looking. Rewrite the paragraph to describe the proof that did happen -- a one-off hand run against esbuild, every first-party .ts file minified as authored and comment-stripped and the outputs compared byte for byte -- and point at the record in test/source-token-ratchet.test.ts's docstring, quoting its heading on one line so the pointer is greppable. Also states why it is not automated (esbuild is undeclared; it arrives under the ObjectStack CLI). Comment text only. No executable line, no ceiling, no BUFFER, no stripping rule and no suite changed; the `typescript` devDependency stays. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WMzCeNC4SZcPNBpE2zCVCg
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
Fixes #1345
Comment text only. No executable line changed anywhere; the whole diff is prose inside one gate's header docstring, plus an empty-frontmatter changeset.
The claim, re-measured
scripts/check-source-token-ratchet.mjs's stripping-rule paragraph said the rule isNo such cross-check exists. Re-measured on
origin/main@c772cbe(the card was filed against08613ad; all three readings reproduce):test/andscripts/forfrom 'typescript'returns 1 hit, not 0:The
*prefix is the tell — it is docstring prose discussing an import, not an import. That file's real imports are lines 3-9 and contain no typescript. The hit does not falsify the card; it is the same shape this defect family is about, a pattern that reaches the code and answers a different question.Why the false claim was unusually durable
typescriptreally is a declared devDependency — it istsc --noEmit's. So a reader checking the sentence the cheap way ("is typescript a dep? yes") had it confirmed while the wiring was absent, and anyone wanting to know whether the stripper is validated against a real compiler found the claim already made and stopped looking.What is true, and where the record lives
Per the ruling on the card: describe the equivalence proof that actually happened and point at the record — do not build the cross-check, do not add
esbuild. Neither was done;pnpm-lock.yamlis untouched andpnpm installreports "Lockfile is up to date".The record is
test/source-token-ratchet.test.ts:52-71, under the heading "The stripper's equivalence proof is a hand run, recorded here". Verbatim:⇒ The card's falsifiable premise holds. No fork.
Acceptance, end to end
The new prose names the file and quotes the heading on a single unbroken line, so the pointer is greppable rather than merely readable — an earlier draft wrapped the heading across a comment line break, which would have made it un-greppable. Following it resolves:
The paragraph also re-attributes the devDependency to
tsc --noEmit, and keeps the two true facts the old sentence carried: the gate imports nothing outsidenode:builtins andscripts/lib/main-module.mjs, so it runs with nothing installed and its number cannot move because a compiler upgraded.One precision note: the replacement says the suite asserts the rule "against fixtures for the hazard classes it covers", borrowing the suite docstring's own wording. A first draft said "one fixture per hazard class", which implies a 1:1 mapping the suite does not have — three fixture tests cover the five clauses. On a card about an overclaiming sentence that distinction is the point.
Scope held
⛔ Unchanged, as ruled: the stripping rule, every ceiling,
BUFFER, the suite, and thetypescriptdevDependency.Verification
pnpm verifygreen on9cf5666— the final commit of this branch, and the exact tree verify ran against (working tree clean throughout). Each stage's own verdict line:The ratchet's own numbers are unmoved and cannot move: the measured surface is
src/**only, and it is comment-stripped besides —scripts/is not measured at all.Targeted first, before the full run: the three suites that read this gate's source —
source-token-ratchet,docs-readme-token-figures,script-main-guard— 39 tests, all passing.Changeset
.changeset/ratchet-header-equivalence-proof.md, empty frontmatter, whichchangeset-check.ymldocuments as the sanctioned "this PR releases nothing" declaration. Verified true of this diff rather than assumed: every added and removed line inscripts/check-source-token-ratchet.mjsis a comment line (non-comment count = 0), and nothing undersrc/changed. Noskip-changesetlabel is needed or applied.Found on the way, not fixed here
Filed as #1370: the run-when-main comment at
scripts/check-source-token-ratchet.mjs:527-530carries a second copy of this same claim ("cross-check the stripping rule against the TypeScript scanner"), and separately namesstripCommentsandverdictas exported for a suite that imports neither. It sits outside this card's declared paragraph, and its correction is a choice rather than a mechanical edit — so it is reported, not ridden along, on the precedent this card set. #1344 remains open and is disjoint (the header table figures).Generated by Claude Code