Skip to content

Commit 6131d90

Browse files
os-zhuangclaude
andauthored
docs(adr-0122): D6 点明同构 pin 的编译期证明落在哪一步 (#6263)
ADR-0122 D6 原文写「tsc proves the exemption on the same run that type-checks the package」。字面不准确:`packages/spec` 的 `typecheck` 是两步 (`tsc --noEmit && pnpm check:test-typecheck`),第一步走 BUILD 配置,而 `tsconfig.json` 排除了 `**/*.test.ts` —— pin 文件 `type-alias-convention.pin.test.ts` 正是 `*.test.ts`,根本不在裸 tsc 的 program 里。 实测(给被钉同构的 `MCPApprovalPolicySchema` 加 `.default('never')`,Iso22): 裸 tsc --noEmit ................ EXIT=0 pnpm check:test-typecheck ...... EXIT=1 src/type-alias-convention.pin.test.ts: 1 type error(s) in a file the ledger does not cover. 基线两步皆 EXIT=0;test-project 的原始报错为 `src/type-alias-convention.pin.test.ts(282,28): error TS2344: Type 'false' does not satisfy the constraint 'true'.`(282 行即 Iso22,点名该 schema)。 结论未变:门咬得住,且咬在 debt ledger 不覆盖的文件上(该 pin 文件无 `test-typecheck-debt.json` 条目,基线即零错误,新增一个即红)。本次只订正 「哪一步证明」这一处措辞,并把零错误基线这半个保证一并写明。 仅改 ADR 文本。不动 `packages/spec` 的脚本、pin 文件、debt ledger 或任何门禁行为。 Fixes #6183 Claude-Session: https://claude.ai/code/session_014wsZeReNTqiceBfLb5Pyf5 Co-authored-by: Claude <noreply@anthropic.com>
1 parent dbe92a7 commit 6131d90

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

docs/adr/0122-schema-type-alias-naming-convention.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,23 @@ Two alternatives were measured and rejected:
133133
about types, and isomorphism rots: add a `.default()` three levels down and an alias
134134
silently joins the covered set with no signal. So every exempt schema carries a
135135
compile-time assertion that `z.input` and `z.infer` really are the same type, in
136-
`packages/spec/src/type-alias-convention.pin.test.ts`. tsc proves the exemption on the
137-
same run that type-checks the package, and the file goes red — naming the alias — the
138-
day one stops being true. An exemption nobody can state falsely is the only kind worth
139-
having; this is the same instinct as `check:durability-log-level`'s empty baseline.
136+
`packages/spec/src/type-alias-convention.pin.test.ts`. tsc proves the exemption on every
137+
`pnpm typecheck` run, and the file goes red — naming the alias — the day one stops being
138+
true.
139+
140+
Which of that command's two **steps** proves it is worth stating precisely, because it is
141+
not the obvious one. `packages/spec`'s `typecheck` script is
142+
`tsc --noEmit && pnpm check:test-typecheck`, and the bare `tsc` runs the BUILD config,
143+
whose `**/*.test.ts` exclusion keeps this `*.test.ts` pin file out of its program
144+
entirely. The proof therefore lands in the **second** step, which puts the test layer back
145+
in front of tsc over `tsconfig.test.json` (#5286). Measured, by giving a pinned schema a
146+
`.default()`: the bare `tsc --noEmit` stays at exit 0, and `check:test-typecheck` is what
147+
turns red, naming the file — `1 type error(s) in a file the ledger does not cover`. That
148+
last phrase is the other half of the guarantee: the pin file carries no
149+
`test-typecheck-debt.json` entry, so its baseline on that surface is **zero** errors and a
150+
single new one fails the gate. An
151+
exemption nobody can state falsely is the only kind worth having; this is the same instinct
152+
as `check:durability-log-level`'s empty baseline.
140153

141154
**D7 — The backflow gate.** `pnpm check:spec-parsed-alias`
142155
(`scripts/check-spec-parsed-alias.mjs`, in lint.yml's `lint` job) requires every bare

0 commit comments

Comments
 (0)