docs(ratchet): the run-when-main footer names its third importer - #1597
Merged
Conversation
The footer comment said two suites import from this module and that the stripping rule is exercised by running the file, not by importing it. Both halves are false at 81a79ee: `test/docs-object-term-consistency.test.ts` — the Chinese-term guard — imports `stripComments` and runs every `.ts` file through it, so editing that function edits what the guard scans. The comment now names all three importers and what each takes, states that consequence in the sentence a maintainer reading the guard will meet, keeps what is still true (`verdict` is imported by nothing; the sandbox run covers the verdict and the gate's own stripping; importing must not run the gate), and dates itself with the ref and the grep that re-derives the list. Comment text only: every changed line in the diff begins with `//`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018xtjdpZFjgWh4Ad9Wcx68J
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This was referenced Sep 5, 2026
os-steve
marked this pull request as ready for review
September 5, 2026 22:54
This was referenced Sep 5, 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 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 #1533
What changed
Comment text only, in the run-when-main footer of
scripts/check-source-token-ratchet.mjs, plus an empty-frontmatter changeset.stripCommentsand every other executable line are untouched, and that is checked mechanically rather than asserted — this filter over the diff returns nothing:Editing the function would have caused the exact hazard the comment exists to prevent, so the diff is confined to lines that cannot run.
The importer set, re-derived rather than copied
Measured on this branch's base,
origin/mainat81a79ee, on 2026-09-05 around 22:35Z, by resolving actualimport ... from '...check-source-token-ratchet.mjs'statements — not by name occurrence:test/source-token-ratchet.test.ts:8anchor,fmt,BUFFER,CEILINGStest/docs-readme-token-figures.test.ts:7BUFFER,CEILINGStest/docs-object-term-consistency.test.ts:8stripCommentsTwo files that a name-only grep adds and that are not importers:
test/deal-threshold-parity.test.tsdeclares its own localconst stripCommentsat:71, andtest/script-main-guard.test.tsspawns the gate by path. Both are named in the new comment so the next reader does not have to re-discover them.Small correction to the card, in the card's own spirit: its table lists the first importer at
:7; it is at:8, and it was at:8atd9fad90, the ref the card measured. Nothing turns on the number — it is only one more instance of a hand-transcribed fact drifting from its source, which is what this card is about. That is also why the new comment names files and symbols and no line numbers.Why the third importer is the load-bearing one
test/docs-object-term-consistency.test.tsis the #802 Chinese-term guard. It runs every.tsfile throughstripCommentsand scans only what comes back, so a retired spelling may live in a comment but not in code. EditingstripCommentstherefore edits what that guard scans, and widening it makes the guard pass by reading nothing — indistinguishable from clean. That suite's own defence is a single assertion, that stripping a known file leaves its ledger standing; it catches a stripper that returns nothing, not one that returns too little. The old footer said the opposite: that nothing imports the stripping rule, so changing it is free. Naming the consequence, not just the count, is what should stop the sentence rotting back.The written record, corrected — with a chronology the card could not see
.changeset/ratchet-runmain-comment-names-what-imports.mdis onmainand states:Half of that is false in the tree today:
verdictis still imported by nothing, butstripCommentshas an importer. That landed changeset is a shipped release note and is left untouched; this PR's changeset is the correction of record, so the record stops contradicting the tree.But the sharper version of the story is not that a fix re-affirmed an already-false claim. Verified on a deepened clone (the checkout is shallow at 50 commits, and the shallow reading of these dates is wrong — it attributes the changeset to the boundary commit
7a67bc0; aftergit fetch --deepen 300the boundary moves to 2026-08-05 and both readings sit well inside it):03847ef, PR docs(ratchet): the run-when-main comment names what the tests import #1380, 2026-08-30T15:22:48Z. Nothing has touchedscripts/check-source-token-ratchet.mjssince.stripCommentsimport landed in9f59f6a, PR fix(i18n): unify the Chinese product term for crm_case to 工单 #1525 for [观察] 文档里的状态名/字段标签与语言包是否一致,无人检查——一周内同一缺陷类出现三次,全靠人眼撞见 #802, 2026-09-03T08:00:07Z.So the sentence was true when it was written and was falsified three days later by an edit in a different directory, with nothing in this file able to notice. That is a more uncomfortable finding than a careless claim: no amount of care at authoring time would have prevented it. It is why the replacement paragraph dates itself, names the ref it was derived at, and carries the one-line grep that re-derives it.
Not built: the pin (card item 2)
The card floats a test asserting the footer's importer list equals the real importers and honestly calls it a maintainer call. Not built, on
AGENTS.mdsection 3. Do not build platform-level tooling here: a comment-to-importer consistency check is a drift-class gate over this repo's tooling, not a pin on a HotCRM business fact, and that section's own precedent is #1423, where the comment-volume gate was deliberately not built. It would also land intest/, which is inside epic #1579's active territory. The mitigation shipped instead is the derivation recipe in the comment itself.The ratchet cannot see this change, twice over
pnpm hygiene:tokensis green, and that fact is not offered as evidence the comment is correct. It cannot be, for two independent reasons: the gate counts comment-stripped characters, and its scan root issrcDirs(), which readssrc/only —scripts/is never measured at all. Business semantics reads ~84,579 against the ~85,000 ceiling, headroom ~421, identical to the pre-change reading. No wording was trimmed to protect that headroom.Gates — full
pnpm verifychain, each step's exit code captured before any pipeRun on
b02debfin a dedicated worktree.pnpm validatesrc/.pnpm typecheckpnpm lintpnpm lint:i18n-gatei18n/missing-*issues; untouched by a comment.pnpm hygienepnpm hygiene:tokenspnpm buildpnpm testtest/source-token-ratchet.test.tsreads this gate's source as text and parses the header's worked table out of it, so this run proves the edit did not disturb that parser — and confirms no suite pins the footer paragraph's text.No gate can judge whether this comment is true; the argument for that is the re-derivation above, not a green check.