Skip to content

refactor(lint): split rule-explanations.ts into one file per rule family - #38808

Merged
os-zhuang merged 4 commits into
mainfrom
claude/project-thread-bgdog9
Dec 1, 2026
Merged

os-zhuang merged 4 commits into
mainfrom
claude/project-thread-bgdog9

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Irene · project thread
Fixes #38666

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户无感:命令行解释规则时打印的文字一字不变,只是存放这些解释的源文件从一个七千多行的大文件拆成按规则族分开的小文件。
  • 为什么做:这是全仓最多人同时修改的文件,属于您批准的大文件拆分计划的第三张卡,拆开后各张加规则的卡不再互相冲突。
  • 出错会怎样:最坏是某条规则的解释文字变了或丢了;已逐条比对全部规则的输出完全相同,出问题可直接整体撤回本合并。
  • 要你做什么:变更超过三千行,并改了两份设计决策文档里的文件路径指针,需要您批准合并。

What changes

  • packages/lint/src/rule-explanations.ts was one 7,680-line table. It is now the index: the module docblock and the RuleExplanation interface (both verbatim), the family imports, RULE_EXPLANATIONS (the same object literal, so the same keys in the same insertion order) and explainRule (verbatim). A comment above the imports says a new entry goes into its family's file and a new family gets its own file.
  • packages/lint/src/rule-explanations/ holds one file per family: one per // ── section header of the old file (65), plus field-consumers.ts for field-no-consumers, which sat above the first header. Each entry moved verbatim; the only edit on a moved line is export in front of its const.
  • rule-explanations/shared.ts holds the three paragraphs more than one family references (UNPROVISIONED_ANCHOR_CAUSE and UNPROVISIONED_ANCHOR_REMEDY, used by 7 families, and AGGREGATE_PAIR_ROWS, used by 2), moved with their docblocks.
  • Two entries moved to where their header says they belong: security-owd-unset (above the first header) into security-posture.ts, the family of the rule file that produces it, and seed-value-outside-state-machine (inside the assignment-rules section) under its own header, which was empty, in seed-state-machine.ts.
  • rule-explanations.test.ts: only the case "the module imports nothing" changes, to the split's equivalent invariant (claim amendment 7295823844): the index imports only ./rule-explanations/*.js as values; every family file reached from it imports only siblings, plus RuleExplanation from the index as import type; no file re-exports with export-from. Every other lint test is byte-unchanged.
  • docs/adr/0055-…md and docs/adr/0141-…md: one symbol anchor each re-pointed from rule-explanations.ts#NAME to the family file that now declares NAME, path only, sentence unchanged (claim amendment 7296411486). check:adr-symbol-anchors reds without it.
  • A patch changeset for @objectstack/lint: the bundled rule-explanations and index entries change bytes (module order, source-path comments), with no behaviour or declaration change.
  • No file in the new set is over 2,000 lines: the largest is record-writes.ts at 623, and the index is 745. There is no facade-delegation-registry.json row: this is a table, not a facade.

Tests

os explain for every rule id: 292 of 292 byte-identical

The CLI was built once at the base (3000662c), then os explain ID ran for every key of RULE_EXPLANATIONS (292 ids, stdout, stderr and the exit code captured per id) against the lint dist built from the base and again against the lint dist built from this branch. The CLI reads the table only through @objectstack/lint/rule-explanations, so the lint build is the only variable.

# from packages/cli, ids.txt = Object.keys(RULE_EXPLANATIONS), one per line
cat ids.txt | xargs -P 6 -I{} sh -c 'f=$(printf %s "$1" | sed "s#/#__#g"); node bin/run.js explain "$1" > "$2/$f.out" 2>&1; echo "exit=$?" >> "$2/$f.out"' _ {} OUTDIR
diff -r before/explain after/explain && echo "ALL 292 IDENTICAL"

Result: ALL 292 IDENTICAL; every output exits 0 and opens with its Rule: header; the per-file sha256 manifest hashes to c0705a6eac1357072ee4593b166a969264aeab25c0450ef5e2cdea8eb97a0350 on both sides. JSON.stringify(RULE_EXPLANATIONS) from the ESM and the CJS entry hashes to d031c3c5771bb2e806719a5fe5c1fd291cd643d24c979248999d9baefefa0d29 before and after (key order included).

Public declaration: all 8 .d.ts / .d.cts files byte-identical

cmp of packages/lint/dist/{index,runtime,runtime-HASH,rule-explanations}.d.{ts,cts} before and after: IDENTICAL for all eight. (A first cut put the imports above the interface, which dropped the module docblock from rule-explanations.d.ts; the imports now follow the interface, so the docblock stays its leading comment.)

The published entry still imports nothing

A count of import statements and require( calls in dist/rule-explanations.js and dist/rule-explanations.cjs reads 0 and 0: with splitting: false the bundle inlines the family files. The bundles grow by about 3 KB (source-path comments).

Lint suite, typecheck, build

At 939ffdd2 (the last source change; later commits are the changeset and the two ADR anchors):

  • pnpm --filter @objectstack/lint build: exit 0, check-dts-emitted: 6/6.
  • pnpm --filter @objectstack/lint typecheck (tsc plus check:test-typecheck): exit 0.
  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2: Test Files 255 passed (255), Tests 10185 passed (10185).
The rewritten test can fail (three mutations, each restored to HEAD)

Through scripts/ablation-replace.mjs, running vitest run src/rule-explanations.test.ts -t imports:

  1. a family file (view-refs.ts) gains a value import of ../validate-field-consumers.js: red, "view-refs.js imports outside its family directory".
  2. that file imports the index as a value (import { type RuleExplanation }): red, "view-refs.js imports the index as a value".
  3. the index gains a bare side-effect import of ./validate-field-consumers.js: red, "expected 66 to be 67" (an import the reader cannot parse fails the count).

Each run ended "restored: blob == HEAD, git diff HEAD is empty".

Acceptance notes

  • The claim's surface was amended twice by the dispatching seat: the one test case (amendment 7295823844) and the two ADR anchor lines (amendment 7296411486).
  • packages/lint/tsup.config.ts and packages/cli/src/utils/format.ts still say in a comment that the entry "imports nothing". That stays true of the published bundle, so they are untouched.
  • Volatile counts above (292 ids, 65 headers, file sizes) are readings of this head for review, not text in the tree.

Verification

Read first, by risk: packages/lint/src/rule-explanations.ts (the index: the imports and the unchanged RULE_EXPLANATIONS literal), packages/lint/src/rule-explanations.test.ts (the one rewritten case), packages/lint/src/rule-explanations/shared.ts.

Two-minute check: pnpm --filter @objectstack/lint build && node packages/cli/bin/run.js explain field-no-consumers prints the same text as on main.

Derived gates: 77 derived, 75 run green, 2 NOT MEASURED (local reconciliation)

node scripts/pm/dispatch-gates.mjs --commands on this branch derived 77 commands (71 at be77abe2, plus 6 the ADR edit added at 22efc3478; be77abe2 and 22efc3478 differ only by the two ADR anchor lines). --ran reconciliation: "77 derived, 75 run, 2 NOT-MEASURED, 0 UNRUN". Two reds were seen and cleared: check:adr-symbol-anchors (the two ADR anchors, fixed in 22efc3478, re-run green on that head) and check-plugin-teardown-shape.mjs --self-test (its pinned fixture commit was missing from the shallow clone; green after fetching it). The two NOT MEASURED gates need every package's dist, which a whole-repo build would give; CI runs them.

node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-adr-links.mjs :: exit 0
node scripts/check-adr-links.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-adoption.mjs :: exit 0
node scripts/check-comment-mask-adoption.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-dts-emitted.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-issue-citations.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs --self-test :: exit 0
node scripts/check-temporal-live-filter.mjs :: exit 0
node scripts/check-temporal-live-filter.mjs --self-test :: exit 0
node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/docs-audit/check-affected-docs.mjs :: exit 0
node scripts/docs-audit/check-drift-comment.mjs :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:adr-index :: exit 0
pnpm check:adr-symbol-anchors :: exit 0
pnpm check:authz-resolver :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:cli-command-ids :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:docs-transcript-drift :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:dts-closure :: exit 0
NOT-MEASURED pnpm check:dual-build-cjs-loads :: PREREQUISITE NOT MET (exit 3) — reads every package dist; a whole-repo build is outside the foreground budget; CI Lint & Repo Gates runs it after Build
pnpm check:engine-double-contract :: exit 0
pnpm check:error-status-conformance :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:issue-citations :: exit 0
pnpm check:keyed-text-bounds :: exit 0
pnpm check:lean-entry-closure :: exit 0
pnpm check:logger-receiver-detach :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:object-def-param-keys :: exit 0
pnpm check:objectql-double-limit :: exit 0
pnpm check:optional-error-sink :: exit 0
pnpm check:org-identifier :: exit 0
pnpm check:page-declaration-shape :: exit 0
pnpm check:platform-object-tenancy-census :: exit 0
pnpm check:pm-governed-merges :: exit 0
pnpm check:pm-prior-rulings :: exit 0
pnpm check:published-files :: exit 0
NOT-MEASURED pnpm check:published-readme-exports :: PREREQUISITE NOT MET (exit 3) — reads every package dist; a whole-repo build is outside the foreground budget; CI Lint & Repo Gates runs it after Build
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:settings-bind-window :: exit 0
pnpm check:slot-lookup :: exit 0
pnpm check:sourcemap-no-sources-content :: exit 0
pnpm check:system-context-census :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:vouch-for-reference-callers :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0

Every family CI runs is read from this PR's check runs, not re-run here.


Generated by Claude Code

Move-only: every entry moves verbatim from the 7,680-line table into
packages/lint/src/rule-explanations/<family>.ts (one file per section
header), the paragraphs several families reference move to shared.ts, and
rule-explanations.ts becomes the index that assembles RULE_EXPLANATIONS in
the same key order. The imports-nothing test now holds the split's shape:
the index imports only its family files, and a family file imports only its
siblings plus the RuleExplanation type.

Claude-Session: https://claude.ai/code/session_01J8VVAoVoLCk7JiHvytWEqY
Co-authored-by: Claude <noreply@anthropic.com>
…erface

The family imports now follow the RuleExplanation interface, so the
module docblock stays the interface's leading comment and the published
rule-explanations declaration files stay byte-identical; the
one-file-per-family note is its own comment above the imports.

Claude-Session: https://claude.ai/code/session_01J8VVAoVoLCk7JiHvytWEqY
Co-authored-by: Claude <noreply@anthropic.com>
The bundled rule-explanations and index entries change bytes (module
order, source-path comments) with no behaviour or declaration change, so
the package ships a patch note.

Claude-Session: https://claude.ai/code/session_01J8VVAoVoLCk7JiHvytWEqY
Co-authored-by: Claude <noreply@anthropic.com>
…y files

The explanation entries ADR-0055 and ADR-0141 anchor now live in
rule-explanations/security-posture.ts and rule-explanations/list-view-field-refs.ts;
path only, the sentences are unchanged.

Claude-Session: https://claude.ai/code/session_01J8VVAoVoLCk7JiHvytWEqY
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/lint, touching 372 documentable anchor(s).

31 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 0fc9eab9006ec5756a29e0c66b79ab4c717b1993.

⛔ 13 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see

Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 0fc9eab9006ec5756a29e0c66b79ab4c717b1993 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 1ed9c3d8199f1709b958fb3599ce5ccfea0cb167 — the merge of head 22efc34785b40c1b4da2883988c71452d2fbd4b5 into base 0fc9eab9006ec5756a29e0c66b79ab4c717b1993, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 1ed9c3d8199f1709b958fb3599ce5ccfea0cb167 && git checkout 1ed9c3d8199f1709b958fb3599ce5ccfea0cb167
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0fc9eab9006ec5756a29e0c66b79ab4c717b1993 22efc34785b40c1b4da2883988c71452d2fbd4b5 && git checkout -B drift-repro 0fc9eab9006ec5756a29e0c66b79ab4c717b1993 && git merge --no-ff 22efc34785b40c1b4da2883988c71452d2fbd4b5

node scripts/docs-audit/affected-docs.mjs --json 0fc9eab9006ec5756a29e0c66b79ab4c717b1993

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 0fc9eab9006ec5756a29e0c66b79ab4c717b1993 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

objectstack-fleet Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAmaT5PwLmXgonaxjYG

维护者速读

  • 改了什么:把 7,680 行的 lint 规则解释表 rule-explanations.ts 按规则族拆成 rule-explanations/ 下的多个文件(最大 623 行),原路径留作索引汇总,只搬不改。
  • 为什么改:这是全仓最挤的文件(测量时 6 个 PR 同时改它),按 Warren 批准的大文件拆分方案执行(卡 拆分 lint rule-explanations.ts(7,567 行)为按规则族的文件加索引 #38666)。
  • 风险与回滚:行为不变:292 条规则的 os explain 输出逐字节相同,8 个发布的类型声明文件逐字节相同,打包产物的入口仍不引入任何外部模块。撤回本 PR 即恢复。
  • 先看:packages/lint/src/rule-explanations.ts(索引)和 packages/lint/src/rule-explanations/shared.ts(跨规则族共用的常量)。
  • 两分钟验证:本 head 上 CI 全绿;PR 正文给出比对命令和结果。
  • 需要你做的:批准本 PR。变更 15,299 行超过 3,000 行,且改了两处 ADR 的锚点路径(只改路径),按规则由审批人批准后落地。

席位意见:同意落地。

席位核对

ACCEPT · repo:objectstack@huangyiirene · PR #38808 @ 22efc34785b40c1b4da2883988c71452d2fbd4b5 (card #38666, claim 7295777114 + amendments 7295823844, 7296411486). Checked against GitHub, not the reports.

  • 形态 Shape: draft, base main, Fixes #38666 (merging delivers the whole card: one file per family beside an index that builds RULE_EXPLANATIONS, move-only, no facade row, no new file over 2,000 lines). No closing keyword binds another card. 72 files, +7,971/-7,328. l1-face.mjs --pr 38808: CLEAN, 13 items read, none flagged.
  • 前提实测 Premise: the seat's reading at origin/main (all five blockers merged, 7,680 lines, no open PR on the file). The seat's own probe compared base and head RULE_EXPLANATIONS through tsx: 292 keys on both sides in the same insertion order, 0 value differences, and the same two module exports. The two docs/adr hunks change only the anchor path. The dev reports os explain byte-identical for 292 of 292 ids, 8 of 8 published .d.ts/.d.cts byte-identical, and the dist entry with 0 imports (report 7296788095).
  • 门禁 check-runs: on this head 60 success, 13 expected skip, 0 failed (Lint & Repo Gates, TypeScript Type Check, Build Core, all Test Core shards, Governed Surface Queue Guard, Check Changeset).
  • 接受的偏差 Accepted deviations:
    • One lint test case is rewritten to the split's equivalent invariant (amendment 7295823844). The card's "every lint test unchanged" cannot hold for the case that asserted the module imports nothing. The new case holds the index to ./rule-explanations/*.js imports and the family files to siblings, with no export-from anywhere; it fails on 3 ablations. Every other lint test is byte-unchanged.
    • Two ADR anchors are re-pointed to the declaring family file (amendment 7296411486), which is the gate's own remedy.
    • One @objectstack/lint patch changeset, because the bundled JS bytes change (module order, path comments).
  • 范围外去向 Out of scope: none. authoring-rules.ts stays a later card, as the card says.
  • 落地条款 Landing: contract review PASS on this head (comment 7297469587, CONTRACT_REVIEW_TIER, no must-fix or should-fix; one nit on the index docblock title, kept so the published declaration stays byte-identical). It is move-only with no accept-set or public-surface change (Clause-②: no, Metadata-protocol: none, declarations byte-identical), and the ADR hunks are path-only. [Edit: this line first said no contract review was owed; the docs/adr/** hunks make the PR governed, so one was owed and is now on record.] check-governed-merges.mjs --pr 38808: GOVERNED (2 of 72 paths, docs/adr/**) and 15,299 lines > 3,000. So Tier H: hand-off to the approver. The seat flips nothing until an authorized approval is on record, then lands it (maintainer's authorization in this seat's thread, 2026-11-30T16:09Z).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAmaT5PwLmXgonaxjYG

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 22efc34785b40c1b4da2883988c71452d2fbd4b5
Local-runs: probe — one scratch tsx import of packages/lint/src/rule-explanations.ts from the merge base 3000662c and from this head (both extracted with git archive into a scratch directory, nothing checked out, built or tested), comparing the module exports and RULE_EXPLANATIONS; the move-only claim over 15,299 changed lines cannot be judged from the diff alone
Scope: docs/adr/0055-master-detail-controlled-by-parent.md, docs/adr/0141-inter-app-dependency-declared-checked-before-install.md + packages/lint/src/rule-explanations.ts, packages/lint/src/rule-explanations/shared.ts, packages/lint/src/rule-explanations.test.ts, .changeset/38666-lint-rule-explanations-by-family.md (② only); the other 66 family files under packages/lint/src/rule-explanations/ for the move-only claim only, not their prose
Security-touching: no
Rule-change-verified: none

Read: card #38666 (body and all five comments: triage 7266717711 and 7277925353, claim 7295777114, amendments 7295823844 and 7296411486, os-dev-report 7296788095), PR #38808 (body, 72 files, net diff against main), and the 73 check-runs on this head. main has moved past the merge base 3000662c to d97aaaea, and no commit in between touches rule-explanations.ts, its test, the two ADRs or packages/lint/tsup.config.ts, so the diff against the merge base is the net diff against main.

Check-runs on the head: 73 runs, all completed; 61 success, 12 skipped (opt-in, matrix-placeholder and schedule rows), none failed, cancelled or pending. Green among them: Governed Surface Queue Guard, Check Changeset, Check PR Size, Lint & Repo Gates, Lint · docs & code guards, Lint · repo & tooling gates, TypeScript Type Check, Type Check · workspace, Build Core, Test Core and its 12 shards, Dogfood Regression Gate.

Why the security line reads no: the ADR 0055 anchor sentence is about owner-keyed update policy on a controlled_by_parent detail, but the hunk changes one path inside one code span and no other byte of the line; a path-only change teaches no permission, sharing or ownership behaviour. The ADR 0141 hunk is the same shape. No hits path is under skills/**. Why the rule-change line reads none: no path of the diff is under .claude/** and no hunk changes what an agent may do, in what order, or what goes to the maintainer.

① Derived judgments

Accept-set changes: none. Public-surface changes: none.

  • Module exports, base and head (probe): RULE_EXPLANATIONS, explainRule on both sides. The index declares the same three exports as the base file (RuleExplanation, RULE_EXPLANATIONS, explainRule), and no family constant is re-exported: the index has no export-from, and packages/lint/src/index.ts (not in the diff) still names the same three from ./rule-explanations.js.
  • RULE_EXPLANATIONS (probe): 292 keys on both sides, key order equal, JSON.stringify sha256 6f62912a…f10a55 on both sides, the table frozen on both sides, entry and paragraphs frozenness equal per key, every key equal to its entry's rule, and explainRule(k) equal for all 292 ids (undefined for an unknown id and for toString on the head, as before). The PR body quotes a different digest (d031c3c5…) for the same comparison taken from the built ESM and CJS entries; I did not build, so I do not reproduce that number, only the equality.
  • The object literal itself: lines export const RULE_EXPLANATIONS … }); are byte-identical between base and head (294 lines, diff empty), with no spread in it. 292 literal rows against 292 runtime keys, so no key is declared twice and no later row overwrites an earlier one.
  • Published declarations: lines 1-57 of the index (licence line, module docblock, RuleExplanation) are byte-identical to the base, and so is everything after the literal (explainRule and its docblock); the three exported declarations carry the same type text. The family constants are module-private to the entry, so the .d.ts rollup has nothing new to emit. The dev reports cmp IDENTICAL on all eight dist declaration files; I read that as consistent with the source and did not re-measure it. Type Check · consumer gates and Lint & Repo Gates (which runs check:dts-closure, check:dual-build-cjs-loads and check:published-readme-exports after the build) are green on the head.
  • Move-only, line level: the base file's body (everything between the interface and the literal, 6,892 non-blank lines) against the 67 family files, with a leading export on const stripped: no base line is missing from the head, and the head's only extra lines are 67 licence lines, 66 import type { RuleExplanation } from '../rule-explanations.js';, 8 imports from ./shared.js, and 4 new comment lines (the shared.ts header, 3 lines, and the field-consumers.ts section header).

② Semver level

@objectstack/lint: patch is right. The published bundle's bytes change (module order, source-path comments, about 3 KB) and nothing a consumer can observe does: same exports, same table, same declarations. A change that ships different bytes needs a release-carrying changeset, and patch is the lowest; minor would claim an addition that does not exist. Check Changeset is green on the head.

The Clause-②: no line stands on the claim, the PR body and the changeset alike, and it is correct: no accept-set narrows, no authorable key is added or removed, and the rule ids and their texts are unchanged. Metadata-protocol: none likewise.

③ Boundary flags

  • open_questions: empty. security_findings: none. classifier_refusals: none.
  • Deviation "implemented in the thread, not by a subagent": a dispatch-mode fact the seat confirmed; it changes nothing in the diff.
  • Deviation "gate batch finished as a background job": the gate verdicts I use are the head's check-runs, not the local batch, so nothing rests on it.
  • The two gates the dev marked NOT MEASURED (check:dual-build-cjs-loads, check:published-readme-exports) run inside Lint & Repo Gates, which is success on the head.
  • Out-of-scope note (the tsup.config.ts and packages/cli/src/utils/format.ts comments still say the entry "imports nothing"): true of the published bundle, both files are outside the diff. See N1 for the in-diff twin.
  • Acceptance "every lint test passes unchanged" against amendment 7295823844 (one case rewritten). The card's own ask 1 (an index over family files) makes the old assertion unsatisfiable, so one of the two had to give, and the amendment states which. The rewritten case holds the same invariant, the published entry reaches nothing outside its own files, at least as strongly:
    • the old case scanned one file for any import line and any single-line export-from;
    • the new case requires every index import to be a value import of ./rule-explanations/NAME.js, then walks every file reached from the index transitively, requiring each import to be a sibling ./NAME.js or import type of the index, and refuses an export-from in every file it visits;
    • it fails closed: an import line its pattern cannot read (default, namespace, side-effect, import =) breaks the count check, and inline import { type X } of the index reads as a value import and is refused. The PR's three ablation legs match this reading.
    • Its blind spots (a dynamic import(), a require(, an export-from broken across lines) are the base case's blind spots too, so nothing was given up. A file in the directory that the index does not reach is not scanned, and is not in the bundle either.
    • The diff of the test file is this one case and nothing else (39 changed lines, one hunk).
  • Acceptance "no file over 2,000 lines": largest family file record-writes.ts 623 lines, index 745, 67 files in the directory.
  • Ask 3 "no facade-delegation-registry row": scripts/facade-delegation-registry.json is not in the diff. The sentence on new families is in the index, in the comment above the imports.
  • Ask 1 "one file per section header": the dev names two entries re-homed to the family their header names (security-owd-unset, seed-value-outside-state-machine). Their position in the literal is unchanged, so insertion order holds; which file a constant sits in is not observable.
  • Dist claim "the entry is import-free": credible from packages/lint/tsup.config.ts (not in the diff): rule-explanations is its own entry, splitting: false, bundling on by default, so relative imports are inlined; the only specifiers in the 67 family files are ./shared.js (value) and ../rule-explanations.js (import type, erased), and no bare specifier exists for the bundler to leave external.
  • SQL push-down: no data access in the diff.

④ Design judgment

No must-fix, no should-fix.

N1 (nit) — the index's module docblock keeps its section title "Why this module imports nothing" verbatim while the source file now carries 66 import statements. It is kept on purpose (the docblock is the leading comment of the published rule-explanations.d.ts, and changing it would break the byte-identical declaration the card asks for), and the comment directly above the imports says in which sense it still holds (the bundle inlines the families). A reader of the source alone meets the title first. A later card that may touch the declaration can reword it; it has no effect on correctness or the contract.

The index against the original object. RULE_EXPLANATIONS is not rebuilt from per-family spreads; it is the original literal, row for row, whose identifiers now arrive by named import. That is the strongest construction for this card: insertion order is fixed by the one literal and cannot depend on import order or on which file a constant lives in.

Tried to break it:

  • A family file importing outside the directory: none. Across all 67 files the only import lines are import type { RuleExplanation } from '../rule-explanations.js'; (66) and imports from ./shared.js (8). shared.ts imports nothing. No require(, no dynamic import(, no export-from.
  • A duplicated key whose later spread silently wins: there is no spread; 292 rows give 292 keys; two family files exporting the same constant name would be a duplicate-identifier error at the index's imports, and the type-check runs are green.
  • A key-order change: literal byte-identical; probe key order equal.
  • An import cycle that changes evaluation: the only edge from a family file back to the index is import type, erased at compile, so no cycle exists at runtime and shared.ts constants are initialised before any family reads them.

Cross-family shared constants (shared.ts). UNPROVISIONED_ANCHOR_CAUSE, UNPROVISIONED_ANCHOR_REMEDY and AGGREGATE_PAIR_ROWS are the base file's three module-level consts, moved with their docblocks and string bodies unchanged (covered by the line comparison and by the equal table digest); the only edit is export. Used by 7 files (anchor pair) and 2 files (aggregate rows), as the PR says. They stay private to the entry: nothing re-exports them.

ADR anchors. SECURITY_CBP_OWNER_POLICY_WITHOUT_OPT_IN_EXPLANATION is declared at packages/lint/src/rule-explanations/security-posture.ts:112 and LIST_VIEW_OBJECT_OUTSIDE_CLOSURE_EXPLANATION at packages/lint/src/rule-explanations/list-view-field-refs.ts:246, so both re-pointed anchors resolve at a declaration site; each hunk changes the path inside one code span and nothing else on the line, and the two cited strings are unchanged by ①. Re-anchoring at the declaration is the honest fix; re-declaring the names in the index to satisfy the resolver would have widened the entry for a gate. No other rule-explanations.ts# symbol anchor is left stale: the one remaining reference, docs/qa/platform-checklist/areas/cli.json, names #RULE_EXPLANATIONS, which the index still declares. Lint · docs & code guards and Lint & Repo Gates are green on the head.

Implemented-by: claude/project-thread-bgdog9
Reviewed-by: session_01J8VVAmaT5PwLmXgonaxjYG (an isolated sub-agent of this session rendered the verdict)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@huangyiirene · huangyiirene · session_01J8VVAmaT5PwLmXgonaxjYG

Hand-off for approval (Tier H: governed by docs/adr/**, and 15,299 changed lines over the human-merge threshold). Seat record: ## 席位核对 ACCEPT in comment 7297360604 (its 维护者速读 is the summary). Contract review PASS on this head: comment 7297469587. Head-sha: 22efc34785b40c1b4da2883988c71452d2fbd4b5: every check on this head is green. The seat lands it after an authorized approval on this head.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 1, 2026
@objectstack-fleet
objectstack-fleet Bot requested a review from os-zhuang December 1, 2026 01:26
@os-zhuang
os-zhuang marked this pull request as ready for review December 1, 2026 01:27
@os-zhuang
os-zhuang added this pull request to the merge queue Dec 1, 2026
@os-zhuang
os-zhuang removed this pull request from the merge queue due to a manual request Dec 1, 2026
@os-zhuang
os-zhuang added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 1aa9c57 Dec 1, 2026
81 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-bgdog9 branch December 1, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

拆分 lint rule-explanations.ts(7,567 行)为按规则族的文件加索引

3 participants