test(docs): gate the zh-Hant justification on the reason AGENTS.md sanctions - #1564
Merged
Merged
Conversation
…nctions (#1553) #1368 corrected the REASON zh-Hant pages name platform navigation in English — the console falls back to Simplified, so a Traditional page labels navigation in English rather than ship mixed Simplified/Traditional script — and wrote it into AGENTS.md:343-345. Reaching the reader took four PRs across two rounds (#1537, #1546, #1549, #1554) and the sentence ended up corrected in nine places. Nothing went red at any point, because nothing in CI reads prose. The new guard pins the CLAIM, not the punctuation: a passage naming the convention must state the sanctioned reason in the same passage, matched wrap-insensitively over de-commented, emphasis-stripped text. The three measured register variants — full stop inside the parens, outside it, and the short glossary form that drops the trailing clause — all pass unchanged. Replayed over the drift's real history it is red for the whole window and green only from #1554: 7 red of 7 convention passages at 05f867e^, 7 of 8 at 30f2500, 1 of 9 at 18f523f^, 0 of 9 at 18f523f and today. The last red is the navigation guard's own file header, the site that survived three days because that file exempts itself from its own scan. This file takes no exemption. It matches the assertion rather than the vocabulary, so the deliberate negation #1546 wrote is read and passed on its merits rather than skipped; and its retired-reason ledger is escaped the way docs-object-term-consistency.test.ts escapes retired spellings, so the file never literally spells the sentence it bans. The rule caught two violations in this file itself on its first run, and both were rewritten rather than exempted. The English markers are derived — the first test parses the AGENTS.md bullet and asserts they are substrings of it, so the next correction to the rulebook goes red here. The Chinese markers cannot be derived (AGENTS.md carries no Traditional rendering) and are pinned constants citing it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019hUuCQStzXGMFSX4dzww5t
|
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 #1553
The zh-Hant navigation convention's reason was corrected by #1368 and written into
AGENTS.md:343-345. Reaching the reader took four PRs across two rounds — #1537, #1546,#1549, #1554 — and the sentence ended up corrected in nine places. Nothing went red at
any point, because nothing in CI reads prose. This adds the gate.
Where the guard lives, and how it avoids the SELF blind spot
New file:
test/docs-zh-hant-justification.test.ts. Five tests, no edits to any existingfile.
docs-setup-navigation-names.test.tsscanstest/but filters outSELF, because itsrule 1 bans retired vocabulary and would otherwise fire on its own ledger. That
exemption is why the stale reason survived in it for three days. This file takes no
exemption of any kind — it scans itself — and stays green structurally rather than by
permission:
states the convention, and it passes by stating the sanctioned reason. A passage
quoting the retired form in order to forbid it is therefore either not judged at all, or
is judged and passes on its merits.
docs-object-term-consistency.test.tsalready uses (live spellings literal, retiredones as backslash-u escapes). Measured: the six Chinese retired phrasings appear
0 times literally in the new file.
The rule pins the claim, not the punctuation: markers are matched wrap-insensitively
over de-commented, emphasis-stripped text, grouped into blocks of adjacent non-empty lines.
All three measured register variants pass unchanged — full stop inside the parens (3
sites), outside it (3 sites), and the short
reference/glossary.zh-Hant.mdxform that dropsthe trailing clause entirely.
Reverse verification: replayed over the drift's real history
The rule was run over
content/docs+src+test+docsat each commit of thehistory it exists to catch. It is red for the whole window the drift was invisible, and
green only from #1554:
05f867e1^(before #1537)05f867e1(#1537)30f2500e(#1546)1efcaaa5^(before #1549)1efcaaa5(#1549)18f523fb^(before #1554)18f523fb(#1554)5bfaa8a6(this branch)The last red is the one that matters: at
18f523fb^the only violation left was thenavigation guard's own file header — the site the SELF filter hid.
Derived vs pinned
The English half is derived.
rulebookReason()parses theAGENTS.mdbullet and thefirst test asserts the English markers are substrings of it, so the rulebook and this file
cannot disagree silently — the next correction to that bullet goes red here, which is
precisely the event this card is about. The derived clause on this tree:
The Chinese half cannot be derived:
AGENTS.mdis English and carries no Traditionalrendering, so those markers are pinned constants citing it. That is the weaker form the
card anticipated, and it is weaker only in the direction of translation — the claim is
still tied to the rulebook through the English markers beside it.
Ablations
All four legs ran commit-first; every restore is proven by state (
git diff HEADempty and blob hash back to the HEAD value), never by exit code, and every mutation was
confirmed on disk before the rule was read.
injected text and the moved blob hash, never on an unchanged removed-count) — RED:
a docs page asserts the reason #1368 measured false: content/docs/administration/setup.zh-Hant.mdx carries "介面顯示英文"a passage names platform navigation in English without giving the reason AGENTS.md sanctions — the console falls back to Simplified: content/docs/administration/profiles.zh-Hant.mdx :: ...asserted. Removing only the sanctioned-reason marker from that same comment block,
leaving the negation byte-identical, turns it RED and names the block — so the rule
demonstrably reads and judges it. Untouched, with the negation present verbatim, all
five tests pass. For contrast: a naive vocabulary ban over
test/hits that line (andfive more occurrences in the new guard's own ledger and header); this rule hits none.
the scanned trees read no files — SCANNED_DIRS is wrong: expected 1 to be greater than 400while the convention rule itself went green on one file — exactly the "passing by
reading nothing" state the guard exists for. Detuning the markers instead reds three
tests, the rulebook anchor first.
Verify
pnpm verifygreen in full on5bfaa8a6— validate, typecheck, lint, lint:i18n-gate,hygiene, hygiene:tokens, build, test. 160 test files, 3368 passed, 1 skipped. Source
hygiene clean; token ratchet clean (the new file is under
test/, outside the ratchet'ssrc/surface).Notes for review
directions, so a page gaining or losing it reds by name. Four more zh-Hant sites name the Setup app in Chinese with no arrow — a shape all three rules of the navigation guard are structurally unable to see #1538 is in flight on
content/docszh-Hant admin/reference pages; if it adds or removes a note, this rosterwants the matching one-line move.
content/docsonly — the surface where a hand-written new page is the hazard and wherenothing ever quotes-to-forbid. Widening it to
test/would need a negationdiscriminator, a heuristic this file deliberately does not carry.
paths and carry no justification note at all (18 such paths on
reference/security-and-compliance.zh-Hant.mdxalone). Whether the convention obligesthem is a docs question nobody has ruled, so the roster pins what is there rather than
asserting what ought to be.
🤖 Generated with Claude Code
https://claude.ai/code/session_019hUuCQStzXGMFSX4dzww5t
Generated by Claude Code