docs(layering): kill criteria on every rule module - #2244
Conversation
Size Report
npm unpacked components
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. Top changed packed filesNo changed packed files. |
|
BLOCKED — several new kill criteria claim replacement enforcement that does not exist:
The same overclaim appears in R11/R13/R16: project references, publishing, or typed ports do not by themselves make relative tunnels, eager imports, or Node/global mechanics unresolvable. Audit every kill criterion to require either an actually enforced replacement or an explicit decision that the invariant no longer matters. Exact-head CI is green; comments only, but the guidance is not safe to merge as written. |
|
Updated exact-head status: still blocked at 92bd3dc on the previously reported unsafe kill-criterion guidance, and now also blocked by a current-main conflict in scripts/layering/check.ts after #2240. Rebase, preserve main's R4/R5 commentary, correct the challenged guidance, and rerun affected exact-head checks. Existing green checks predate the rebase. |
Adds a four-line Catches/Evidence/Cost/Kill-criterion header to every layering rule module for R2, R4-R7, R9-R14, R16, R18, R19, R65-R73, and the rule-id uniqueness gate, so each structural check states what it catches, why no other gate sees it, its LOC cost, and the concrete condition under which it gets deleted. No behavior change.
92bd3dc to
447e7cf
Compare
|
Rebased onto main at d04e213: main's R4/R5/R6 commentary in check.ts kept verbatim (including #2241's "sole owner of the ratchet" note), R14/R71 headers carried into retired-paths-policy.ts, headers for the two deleted modules dropped. Every kill criterion re-audited against the A4 spike (project references are a build cache, not a boundary). None names an enforced full replacement, so all 25 now read "none enforced today; retire only by maintainer decision that no longer matters": R2, R4, R5, R6, R7, R9, R10, R11, R12, R13 (x3), R14/R71, R16 (x2), R18, R19, R65-R70, R72, R73, rule-ids. Partial mechanisms are named as partial only: R11 cites tsc TS2307 (NodeNext exports) and TS6059 (composite rootDir) for two of four branches; R18/R70 state manifests do not govern built-ins or globals; R72/R73 state exports maps do not restrict relative calls or residue handling. Reran check:layering (198/198, guard OK), format:check, check:quick. Head: 447e7cf. |
|
BLOCKED at No remaining code/documentation finding. The unsafe replacement kill criteria are corrected, the The only blocker is required iOS Smoke CI: |
Summary
Every layering rule/policy module under
scripts/layering/now carries a four-line header —Catches:,Evidence:,Cost:,Kill criterion:— stating what defect class the rule catchesand why no other gate sees it, a real PR/commit that motivated or exercised the rule, its LOC
cost (rule + test), and the concrete condition under which the rule gets deleted. This covers R2,
R4-R7, R9-R14, R16, R18, R19, R65-R73, and the rule-id uniqueness gate (rule-ids.ts). Modules that
share one file (daemon-modularity.ts for R9/R10; check.ts for R4/R5/R6) get one header per rule.
No behavior change, no code lines touched — comment-only.
R3 platforms-seam has no active declaration to annotate (zone-policy.test.ts asserts its
absence); R17 devices and R98/R99 are not declared anywhere under
scripts/layering/(R17 livesoutside this directory, R98/R99 are collision-test fixtures only) — see Tradeoffs.
Validation
pnpm check:layering— green, 198/198 node:test assertions pass.pnpm check:quick(oxlint + tsc -b) — clean.npx vitest run --project unit-core scripts/layering— reports "No test files found": thelayering suite runs under
node --testviacheck:layering, not vitest'sunit-coreproject,which doesn't include
scripts/layering/**in itsincludeglobs (confirmed pre-existing).'R2 imposter-rule'string inside zone-policy.ts's new headercomment (the exact mistake the task's CAUTION warns against), then ran
pnpm check:layering.Observed failure:
✖ the layering rules currently in tree carry no unallowed collision—AssertionError: Expected values to be strictly deep-equal: + ['two rules answer to one id: R2 names commands-floor and imposter-rule. Allocate the next free number.'] - []. Reverted; gateis green again.
Tradeoffs / follow-ups
scripts/layering/to annotate today (R3 is retired with onlya negative test; R17 "devices" lives outside this directory per rule-ids.ts's own history
comment). R98/R99 only appear as example ids inside rule-ids.test.ts's collision fixtures, not
as declared production rules — rule-ids.ts itself got a header instead, describing the
uniqueness gate it implements.