Skip to content

Commit 2e955dd

Browse files
fix(scripts): the read-seam census follows a moved protocol.ts body across its host split (#25467 census extension) (#28058)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DXvkFFVPCoX5PE3m7xJeyn8)_ Refs #25467 Clause-②: no (PR 1 is a gate's internal recognition; PR 2 is move-only, `.d.ts` byte-identical) Metadata-protocol: none Ruling-ref: 6520565826 ## 维护者速读 - 改了什么:读缝普查(`check-durability-degradation-log-level` 的读缝规则)现在能跟着 `protocol.ts` 拆分走:搬进 `protocol-*.ts` 模块的方法体经宿主接口调回 `protocol.ts` 的存储包装方法,仍算同一条读缝;`protocol.ts` 里调用一个"桩方法"时,也会读到它搬走的方法体。只改这一个脚本。 - 为什么改:维护者对 #25467 的裁决 B。cut 34 试搬 `deletePackage` 时普查从 93 掉到 89,掉的 4 条读缝其实还在,只是检测器看不见了,于是"搬走方法体"变成了逃出普查的路。这是检测器扩展,不是放松。 - 风险与回滚:低。只在 `packages/metadata-protocol/src` 生效,读词表、扫描根、深度上限都没变;不改任何判决、不加基线行。`main` 上读数 93 → 95,多出的 2 条是 cut 1 早就藏掉的真实读缝,判定都是"no invented answer"。回滚即还原本 PR。 - 先看:`scripts/check-durability-degradation-log-level.mjs` 的 `HOST_SPLIT` 文档块与 `createHostSplit()`,以及 `isReadCall()` 里新增的两处解析。 - 两分钟验证:`pnpm check:durability-log-level`,预期自检 65 条全过、末行 `95 read seam(s), none invents an unreported answer`。 - 需要你做的:无,席位落地。 ## What changes PR 1 of 2 under ruling B on #25467: extend the read-seam census so a moved `protocol.ts` body keeps its read seams, then (PR 2, from fresh `main` after this merges) cut 35 moves `deletePackage` and the cut-33 members the census alone rejected. `scripts/check-durability-degradation-log-level.mjs` only. The read-seam rule's wrapper hop (`isReadCall`) learns the two shapes the split produces, in `packages/metadata-protocol/src` and nowhere else (`HOST_SPLIT`, `createHostSplit()`): - **Host call.** `this.x(…)` in a `protocol-*.ts` module, inside a function whose `this` parameter is the module's own host interface (bare, or `Pick` naming `x`), whose member `x` is typed as the class member `ObjectStackProtocolImplementation['x']`, resolves to that class's own method `x` in `protocol.ts`. It is one hop, the same hop the call made before its body moved. - **Stub.** A method of that class whose last statement returns `fn.call(ident, …)`, `fn` a named import from a `./protocol-*.js` module of the package that exports it, is read as `fn`'s body. That is the same method's body relocated, so it costs no depth. Own-file resolution still wins, the read vocabulary (`find` / `findOne` / `count`), the three scan roots and `MAX_READ_WRAPPER_DEPTH` are unchanged, and the log-level rule is not touched. Every refusal leaves the hop unresolved, which is the under-counting direction the rest of the file takes. Each split file is parsed once and its index shared, so the scan and the resolver walk the same tree. ## Tests Eight new rows in `selfTestReadSeams` (roster and floors raised 59 → 67 and 129 → 137), each a two-file fixture parsed through `createHostSplit` as the scan parses the package: - positive: a moved body's host call into a `protocol.ts` storage wrapper is a seam; a `protocol.ts` try around a stub follows the moved body and the stub costs no hop (with the stub charged a hop the read would sit at depth 3 and drop); - negative control from the order: a moved body whose host call reaches no storage wrapper is no seam; - narrowness: the same files outside `packages/metadata-protocol/src`, a host member not typed as the class member, a member the `Pick` does not name: each resolves nowhere; - bound: the host hop is a hop (a third hop through the host is refused), and the same ladder one hop deeper is a seam, so that pin is not vacuous. `node scripts/check-durability-degradation-log-level.mjs --self-test`: exit 0, read-seam partition 65 cases (57 before), log-level partition unchanged. ## Acceptance notes - **The census reading on `main` moves 93 → 95**, which the dispatch had expected to stay level; the seat accepted it in the card thread. The two new `--list` lines: - `packages/metadata-protocol/src/protocol-batch-data.ts:465 guards assertRecordExists()@319 in runBatchDataLoop() → no invented answer` - `packages/metadata-protocol/src/protocol-batch-data.ts:756 guards assertRecordExists()@748 in runUpdateManyLoop() → no invented answer` Both bodies moved out of `protocol.ts` in cut 1 (`BatchDataHost`), before cuts were screened against this census, and they reach `assertRecordExists` through the host. No verdict, no finding and no row of either baseline changes; every other `--list` line is byte-identical. - **Positive control, the cut-34 trial tree** (the trial patch applied to `main` `bc496bf7`): the census without this change reads 89, with it 95, the same count as `main`. The four lines cut 34 lost are back: three in the moved `deletePackage` (`findEnvironmentRows`, `packagelessAddress`, `deleteMetaItem`), and `rollBackUnmanagedImport`'s guard of `deletePackage()`, through the stub. The rest of the diff is line numbers. - **`--depth-cost`** at the shipped depth 2 reads 95 (+15 over depth 1). At depth 3 the ladder now prices 109 instead of 100, because more host hops become visible one hop out. That is the diagnostic's price list, not a shipped reading; the constant is not raised. - `rethrowUnlessMetadataStoreUnprovisioned`'s catch-side guard resolution (`establishesBenign`) is not extended; the ruling covers the read side. A moved body whose catch delegates to that guard is still screened out in cut 35, and that is said there. - `skip-changeset`: a script under `scripts/`, which no package publishes. ## Verification Head `8ed1803b` on base `bc496bf7`. <details><summary>Census readings</summary> | Tree | Census before | Census after | |---|---:|---:| | `main` `bc496bf7` | 93 | 95 | | cut-34 trial on `bc496bf7` | 89 | 95 | `node scripts/check-durability-degradation-log-level.mjs`: exit 0 at both ends; the log-level rule's line (48 seams, 7 propagating) is unchanged. </details> <details><summary>Gates</summary> `node scripts/pm/dispatch-gates.mjs --commands` on head `8ed1803b` derives 32 families on the one changed path; all 32 exit 0, and `--ran` reports 32 derived, 32 run, 0 NOT-MEASURED, 0 UNRUN. `pnpm lint`: 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-corpus.mjs :: exit 0 node scripts/check-declaration-mirrors.mjs :: exit 0 node scripts/check-declaration-mirrors.mjs --self-test :: exit 0 node scripts/check-self-test-wired.mjs :: exit 0 node scripts/check-self-test-wired.mjs --self-test :: exit 0 node scripts/check-self-test-workflow-commands.mjs :: exit 0 node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0 node scripts/check-whole-set-label-write.mjs :: exit 0 node scripts/check-whole-set-label-write.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/pm/bare-root-worklist.mjs --self-test :: exit 0 pnpm check:agent-test-spelling :: exit 0 pnpm check:bash32-floor :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:cli-command-ids :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:durability-log-level :: exit 0 pnpm check:entry-guard :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:parse-guard :: exit 0 pnpm check:pm-dispatch-gates :: exit 0 pnpm check:pnpm-filter-targets :: exit 0 pnpm check:pnpm-flag-spellings :: exit 0 pnpm check:ratchet-remedy-authority :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:scripts-symbol-anchors :: exit 0 pnpm check:swallow-census-controls :: exit 0 pnpm check:watch-hint-literal :: exit 0 pnpm lint :: exit 0 ``` The two package tests that read this script by path (`sys-metadata-repository.draft-drain.test.ts`, `protocol.metadata-store-outage.test.ts`): 2 files, 43 tests passed. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4czJUan4AwAS6HLpzZN --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4czJUan4AwAS6HLpzZN)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c1b52de commit 2e955dd

1 file changed

Lines changed: 422 additions & 16 deletions

File tree

0 commit comments

Comments
 (0)