test(scripts): 给文档散文里的版本宣称落一道棘轮门禁(带历史叙述结构性豁免) - #3711
Merged
Conversation
objectui#3697: no gate in this repository reads a version number, so the `@objectstack/spec ^3.3.0` / `Node >= 18` family that #3645 and #3689 cleaned up was found by a human census and nothing stops it coming back. Adds a static ratchet over the two surfaces the issue names (`content/docs` and the package READMEs). Every version literal must be either structurally exempt — inside a `## vX.Y.Z` release section, which is history and must stay frozen — or listed in an in-file inventory with a classification and a reason. The inventory ratchets both ways: a claim with no entry fails, and an entry whose claim is gone fails too, so cleaning a doc shrinks the list. The census that set the design contradicted the dispatch's premise: the bare claim count is not zero. 221 files, 38 literals, 11 exempt, 27 inventoried, of which nine are measurably wrong today (`@objectstack/spec ^4.0.4` in the architecture overview is thirteen majors stale). None is fixed here — this is a test-only change and each repair is a docs edit; they are filed separately and recorded as `kind: 'stale'`. Two design points measured rather than assumed: - Fences are SCANNED, inverting `check-doc-links.mjs`'s `stripCode()`. That gate has no inventory so a false positive is permanent red; this one absorbs a sample in a single line, while stripping fences would drop 12 of 38 hits including two of the worst live defects. - `VERSION_HEADING` anchors at the start and demands a `v` prefix or a full three-part version. The naive spelling matches `### 1.1` / `### 6.4` in `rfcs/0001-clipboard-paste.md` and would silently exempt the whole RFC — a vacuous green, pinned by its own test. No changeset: test-only, no user-visible change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This was referenced Aug 7, 2026
yinlianghui
marked this pull request as ready for review
August 7, 2026 23:58
This was referenced Aug 8, 2026
This was referenced Aug 8, 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 #3697
给「文档散文里的版本宣称」落一道静态门禁。测试-only,一个新文件
scripts/__tests__/doc-version-claims.test.ts,不碰任何文档本体、不碰check-doc-links.mjs、不碰在途 #3674/#3696 的文件。前提复核:成立,但派发预设的「裸宣称为零」被测量证伪
issue 的核心断言 ——
scripts/下没有任何门禁读版本字面量 —— 我逐条核过,成立。但派发裁决预设「裸宣称应为零(#3688/#3698 刚清)」。不是零。 那两次 PR 清掉的是
^3.3.0/≥ 18这两个拼写在它们各自触碰的面上,而这一族的一般形状从未被测量过。据实报账,不清账(文档修复不在本单文件面内,已另立单)。全量测量(切点
d46b40324,即 PR #3698 的合并点)扫
content/docs+ 38 个包 README,共 221 个文件,命中 38 处版本字面量:release-notes.md的## v3.3.0 — 2026-04-17节下ci-cd-pipeline.md:82的Node 22.x↔ 14 处 workflownode-version: '22.x'**Peer Dependencies:**行theming.md:355的 Tailwind 能力下限、troubleshooting.md:71的 React 18+分类扩充:派发给的三分类装不下,实测需要五类
裁决第 5 条要求「若测量发现三分类装不下的第四类形状,停手报告分类扩充方案」。测量确实溢出,但溢出的两类都是沿裁决自身的逻辑自然外推,不涉及契约取舍,故按裁决第 2 条的精神落地并在此报告,未停手:
package.json。不是新类,是同一类的第二种锚源。plugin-markdown.mdx:259是喂给渲染器演示表格的假 changelog),它既不是历史、不是事实、也不是裸宣称。另加 无锚宣称,把「今天为真但无处可核」与「今天可测为错」分开 —— 前者是门禁要收缩的面,后者是要清偿的债,处置不同。
9 处失真(记账,本单不清账)
architecture-overview.md:16(ASCII 图内)@objectstack/spec ^4.0.4^17.0.0-rc.5architecture-overview.md:35(散文)@objectstack/spec ^4.0.0architecture.md:317TypeScript 5.0+^6.0.3create-plugin.mdx:152@object-ui/core是^0.3.0的 peerworkspace:*的 dependencycreate-plugin.mdx:153@object-ui/components同上create-plugin.mdx:154^18.0.0^18.0.0 || ^19.0.0,且漏了 react-dom peerplugin-chatbot/README.md:58@ai-sdk/reactv3^4.0.47layout/README.md:20>= 18.0.0^18.0.0 || ^19.0.0(README 过度承诺)plugin-report/README.md:24^18.0.0 || ^19.0.0^18.0.0一处也没在本单修:文件面限定在
scripts/__tests__/。9 处全部以kind: 'stale'进清单 —— 记账不清账,债务留在下一个读者会绊到的地方,棘轮同时阻止第十处悄悄加入。门禁形态:棘轮,不是正确性检查
它判不了「Tailwind v3.3+」是否为真(多数宣称没有锚)。它判的是事件:某个面上出现了一个版本字面量而没人写下理由。每个字面量要么
KNOWN_CLAIMS,带kind与理由。两个方向都棘轮:无条目的宣称变红,条目所指的宣称已消失也变红 —— 所以清干净一处文档就必须让清单缩短,清单不会烂成永久豁免。形状取自
ci-cd-pipeline-doc.test.ts的DOCUMENTATION_EXEMPT(同目录先例,#3663 一族),清单进测试文件而非独立 JSON,以贴合本单的文件面。两处取舍以实测定,不照搬
一、围栏扫描,与
check-doc-links.mjs的stripCode()相反check-doc-links.mjs抹掉围栏,其头注论证「不该拓宽」:围栏里合法地存在不是链接的[..](..)。那条论证在那里成立,在这里反转,因为两个门禁为误报付的价钱不同 —— 它没有清单,误报即永久红;本门禁有清单,误报只值一行「这是演示数据」,而漏报要再赔一次 #3645 全族。实测使这个取舍可量化:抹掉围栏会丢掉 38 处里的 12 处,其中两处正是最严重的活缺陷 ——
architecture-overview.md:16的三层架构 ASCII 图(差 13 个大版本)与create-plugin.mdx:152的脚手架产物(版本错且字段错)。残留的洞据实写明而非暗示为全覆盖:两个扫描根之外的文件不在本门禁视野内。
二、版本标题豁免必须写窄 —— 宽写法会让整份 RFC 静默逃逸
先想到的写法是「标题里含有像版本的东西」。实测:
content/docs/rfcs/0001-clipboard-paste.md用### 1.1/### 5.1/### 7.3编号,18 个标题命中宽写法,整份 RFC 会掉出扫描面而门禁照报绿 —— 一个教科书式的空绿。VERSION_HEADING因此锚在标题开头,且两段式必须带v前缀:## v3.3.0 — 2026-04-17与## [3.3.0] - 2026-04-17是发布节,### 6.4 Quick-paste optimisation是编号段落,继续被扫。这条区分由它自己的测试钉住,因为它是全文件唯一一处「regex 写懒一点就整体失效」的地方。正则形状:覆盖与不覆盖
两个形状:
@(objectstack|object-ui)/+ 包名 + 版本,以及 工具链名 + 版本(大小写不敏感 —— 包 README 的 peer 行把包名写成小写反引号,区分大小写只能量到 8 处,不区分能量到 27 处)。版本 token 故意不接受「名字后面跟任意数字」:语料里有
| parseClipboard | Vitest | 100% branch |,裸整数规则会把它读成「Vitest 100」。字面量必须带点、带区间符(含排版符≥)、带v前缀,或是18+这样的显式下限。代价写明:不带符号也不带点的裸大版本不被匹配 ——
plugin-chatbot/README.md:9的 "our Tailwind 4" 就漏了。放宽到能抓它,语料从 38 命中变成 37 处待审,多出来的绝大多数根本不是版本。而且只写大版本本就是最不易漂移的拼写,这份召回是值得丢的。逆向验证:六个探针,方向都是先预测后跑
Tests 6 passed (6)✅quick-start.md追加一行 spec^9.9.9+ Node >= 16)content/docs/guide/quick-start.md:177的 spec^9.9.9与Node >= 16,1 failed✅release-notes.md:41/:58):16 :17 :43 :43…,2 failed✅VERSION_HEADING换成宽写法"1.1 Real-world scenarios" must stay SCANNED, not exempt✅packages/plugin-report/README.md:24✅auth/README.md,清单条目留着)KNOWN_CLAIMS names version claims that are no longer in the tree: packages/auth/README.md✅探针 2 特别说明,免得读成空绿:
release-notes.md:58的| Node.js | ≥ 18 |确实被正则匹配到了,是被结构性豁免放过的 —— 绿是「豁免生效」不是「没匹配上」,exemptClaims.length >= 8那条断言就是钉这个的。:41的^3.3.0则根本不匹配(版本字面量离包名 15 个字符,超出 6 字符的 SEP 窗口),它的绿是「未检出」而非「被豁免」—— 两者性质不同,据实分开写,不合并成一句「对照组全绿」。反空绿下限
files > 150、allClaims > 25、exemptClaims >= 8、豁免必须触及release-notes.md、RFC 必须不在豁免集合里、清单不得有重复键、每条理由长度 > 25 字符。全是下限不是等值 —— 文档天天增删,这个文件不该变成文件数快照。门禁与测试
node scripts/check-lint-coverage.mjs→45/45 packages linted;node scripts/check-type-check-coverage.mjs→ 无新增债务。施工中付掉的一个陷阱,已写进文件头注
在块注释的散文里写包路径通配符(段通配符后跟一个斜杠)会提前闭合该块注释,解析器随后在十几行之外的另一行注释上报一个毫无关系的错误。与本仓「写关于控制字节的规则时把控制字节写了进去」是同一形状 —— 写关于分隔符的文字,正是分隔符被具现化的时刻。注释里的包路径因此一律不带通配符,理由写在
TICK常量的头注里。changeset:不加
测试-only,无 API/行为变更,不产生用户可见的包变更。与 #3663 一族(
scripts/__tests__/新增门禁)先例一致。越界发现(只记录、不顺手修)
@objectstack/spec ^4.0.x(差 13 个大版本)与 architecture.md 的 TypeScript 5.0+ #3708 ——content/docs三处版本宣称失真(spec^4.0.x差 13 个大版本、TypeScript 5.0+)packages/create-plugin/src/index.ts实际生成的不符(版本错、字段也错) #3709 ——create-plugin.mdx记录的脚手架产物与实际生成的不符(版本错且字段错,读者照做会坏)@ai-sdk/reactv3(实为 ^4.0.47)、layout 的 react peer 比清单更宽 #3710 ——plugin-chatbot/layout两个包 README 与自己 package.json 不符@object-ui/plugin-report的 peerDependencies 只允许 React/ReactDOM^18.0.0,其余 28 个 UI 包都是^18.0.0 || ^19.0.0(仓库自身 dev 用 19.2.8) #3690 已追评 ——plugin-report/README.md:24的不符落在该单完成范围内(是清单落后于 README),不另开单以上四条修好后都需同步更新本文件的
KNOWN_CLAIMS,否则 ratchet 变红 —— 这正是它的设计。🤖 Generated with Claude Code
https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
Generated by Claude Code