Repository navigation
Commit b6c2ed9
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DXvkFFVPCoX5PE3m7xJeyn8)_
Part of #25467
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6520565826
## 维护者速读
- 改了什么:把 `protocol.ts` 里 8 个方法的方法体原样搬进 4
个按主题划分的新文件(环境自有行读取、存储集合折叠、包卸载、非托管导入),类上的方法、签名和文档注释都保留,只剩一个调用。`protocol.ts`
从 29,585 行降到 29,114 行。
- 为什么改:#25467 裁决 B 的第二个 PR。#28058 让读缝普查能跟着拆分走,cut 33/34 里只因普查被拒的成员(含 300
行的 `deletePackage`)现在可以搬了。
- 风险与回滚:低。8 个方法体逐 token 相同(3,278 个 token,差异 0);发布的 `.d.ts` 与 `main`
原始字节完全相同;包测试与 `main` 逐条比对 0 丢失 0 变化,只多 2 条新登记行带来的用例;普查仍是 95,只有 7
行换了文件。回滚即还原本 PR。
- 先看:`protocol.ts` 里带 `[#25467 cut 35]` 标记的 8 个桩方法,以及
`protocol.bracketed-refusal-opener-absence.test.ts` 里新增的 2 行 `PRODUCERS`
登记。
- 两分钟验证:`pnpm check:durability-log-level`,预期末行 `95 read seam(s), none
invents an unreported answer`;再跑 `pnpm --filter
@objectstack/metadata-protocol exec vitest run --maxWorkers=2
src/protocol.bracketed-refusal-opener-absence.test.ts
src/protocol.package-delete-refusal.test.ts`,预期全部通过。
- 需要你做的:无,席位落地。
## What changes
PR 2 of 2 under ruling B on #25467. PR 1 (#28058) taught the read-seam
census to follow a moved body across the host split; this cut moves the
members the census alone rejected at cuts 33 and 34.
8 `ObjectStackProtocolImplementation` members move unedited into 4 new
modules under `packages/metadata-protocol/src/` (#23050 shape B):
| Module | Members (base line, body lines, AST tokens) | Host |
|---|---|---|
| `protocol-environment-rows.ts` (161 lines) | `findEnvironmentRows`
(`:10240`, 12, 259), `findEnvironmentRow` (`:10261`, 6, 161),
`findServedOverlayRow` (`:10470`, 29, 221), `packagelessAddress`
(`:17212`, 20, 243) | `EnvironmentRowsHost` |
| `protocol-stored-collection-fold.ts` (153) | `foldStoredCollection`
(`:7404`, 95, 487) | `StoredCollectionFoldHost` |
| `protocol-package-uninstall.ts` (358) | `deletePackage` (`:24914`,
300, 1,107; public) | `PackageUninstallHost` |
| `protocol-unmanaged-import.ts` (148) | `unmanagedImportCollisions`
(`:26121`, 39, 464), `rollBackUnmanagedImport` (`:26177`, 38, 336) |
`UnmanagedImportHost` |
Base lines are `protocol.ts` at `main` `2e955dde`. 539 body lines and
3,278 AST tokens in total. `deletePackage` is the one public member; its
declared return type is `Promise<DeletePackageResponse>`, so the
published signature is unchanged.
- **The class keeps every member**: name, modifiers, signature, docblock
and position. Each body is now one call into its module, marked `//
[#25467 cut 35] The body moved to ...`.
- **Shape B, as cuts 20–34.** Each stub builds one `const host:
ThisParameterType<typeof fn> = {...}` and returns `fn.call(host, ...)`.
Methods are passed as closures over `this`, `engine` and
`getServicesRegistry` as getters. Each module has one named host type
whose members are typed as the class members.
- **Every caller still calls the class method.** No call site changes
and no member changes visibility.
- `protocol.ts` goes from 29,585 to 29,114 lines. The PR is +895 / −542
over 6 files.
### Screened and kept out
- `storedFlowBindingAgrees` and `metaTypeNamespaceExists`: each body's
`catch` delegates to `this.rethrowUnlessMetadataStoreUnprovisioned`, and
the census's catch-side guard resolution (`establishesBenign`) is
same-file only. Moving either turns the census red. #28058 extended the
read side only, as the ruling asked.
- `rethrowUnlessMetadataStoreUnprovisioned` stays: it is the
benign-error discriminator the census reads.
The 8 that move pass the other screens on fresh `main`: no
private-static read, no `this.constructor` read, no by-path reader of
their bodies (the suite and the hand gates below agree), and no open PR
edits them.
## Tests
One test file changes, the path-reader migration the series requires.
`protocol.bracketed-refusal-opener-absence.test.ts` keeps a per-file
floor of `new Error(` producers (`PRODUCERS`). Three `new Error(` sites
move (two in `deletePackage`, one in `rollBackUnmanagedImport`), so two
modules get a row, under a `[#25467 cut 35]` comment, after cut 33's
rows:
```
'protocol-package-uninstall.ts': 2,
'protocol-unmanaged-import.ts': 1,
```
Each row adds one generated case, so the suite grows by 2. The moved
members are driven end to end by the existing suites (package uninstall
and its refusals, the unmanaged import, the runtime authoring gate, the
served overlay reads); all pass at both ends.
## Acceptance notes
- **The read-seam census stays at 95.** Seven `--list` lines change file
with the same verdict: the three guards in `deletePackage`, the guard in
`packagelessAddress`, the two in the unmanaged import, and
`foldStoredCollection`'s reported pass-through. Every other line is
identical once line numbers are stripped. This is the reading cut 34
lost (93 → 89) and #28058 recovers.
- **Four top-level helpers gain `export` in place**:
`remainingRowsPhrase`, `servedOverlayRowCandidates`,
`mergePackageAwareOverlay` and `metadataReadFailureError`, each
`protocol.ts`'s own non-exported function, read by a moved body. Each
gains the `export` keyword with nothing else in its statement changed,
as cut 33 did. All four keep readers in `protocol.ts`. `index.ts` names
its re-exports one by one and names none of them, so the published
surface does not move (the `.d.ts` is raw-identical, below).
- **No import of `protocol.ts` lost its last reader**, so none is
removed.
- **`check-adr-anchors` counts move, and the gate passes at both ends.**
Citations 61,216 → 61,218 and files 8,748 → 8,752. Decision-letter
citations on the anchored surface 1,998 → 1,993: five moved letter
citations left `protocol.ts` for modules outside the anchored set.
`check-adr-symbol-anchors` output is identical.
- **Serial with in-flight PRs.** PR #27964, named by the dispatch,
merged before this branch was cut, so its diff is in the base. At
`pr_create`, none of the 19 open PRs edits
`packages/metadata-protocol/src/` or the census script (each head
fetched and diffed against its merge base), so no `git merge-tree` proof
is owed.
- No changeset: `skip-changeset`, per ruling `6348891160`.
## Verification
### Proof of move-only
The compare reads the TypeScript compiler's AST leaf tokens, with JSDoc
skipped, over each member's type parameters, parameters (the module's
`this` parameter dropped), return type and body, `protocol.ts` at `main`
against the head module:
```
findEnvironmentRows 259 tokens differ 0 text equal
findEnvironmentRow 161 tokens differ 0 text equal
findServedOverlayRow 221 tokens differ 0 text equal
packagelessAddress 243 tokens differ 0 text equal
foldStoredCollection 487 tokens differ 0 text equal
deletePackage 1107 tokens differ 0 text equal
unmanagedImportCollisions 464 tokens differ 0 text equal
rollBackUnmanagedImport 336 tokens differ 0 text equal
TOTAL 3278 differ 0
```
"text equal" is the whitespace-collapsed body text, comments included.
Negative controls, one token changed in an in-memory copy of the head
module, each `differ 1`: `deletePackage` `===` → `!==`;
`findEnvironmentRow` `null` → `undefined`; `foldStoredCollection`
`registered` → `registeredX`; `rollBackUnmanagedImport` `await` →
`void`.
- **Class side.** 307 members at both ends, same order. The 299 that did
not move are byte-identical, leading comments included; the 8 stubs keep
their leading trivia and signature byte-identical.
- **Top level.** 274 → 278 statements; 269 byte-identical. The rest: the
4 module imports (each with a one-line `[#25467 cut 35]` comment), the
four helpers with `export` added, and the class.
- `tsc --noEmit` in `packages/metadata-protocol`: exit 0. `pnpm exec
eslint --no-inline-config packages/metadata-protocol`: exit 0, no
output.
### The published `.d.ts` (ruling `6348891160`)
Built with `turbo run build
--filter='@objectstack/metadata-protocol...'` at each end, under the
shared verify lock.
| Reading | `main` `2e955dde` | Head `6b074fce` |
|---|---|---|
| raw sha256 `dist/index.d.ts` = `dist/index.d.cts` |
`00e090f9865173d73ac2d0bf451663790d89a9aabf6ad74fc6470ff2fbf2ae61`
(791,803 bytes) | same |
| normalised sha256 |
`66d4be5eb145c97d09699a67e8d5014ec009fa2838f05c980d492edf00c491cd` |
same |
| raw-diff lines | | 0 (`cmp` equal) |
Bundles change as expected: `index.js` `a11431fcf0a4301d` →
`3975040696890377`, `index.cjs` `3826cf554a460505` → `2bd2adad44302e8c`
(sha256, 16). The ESM and CJS export tables are the same 78 names
(`9f18a0177ac736ed`) at both ends; none of the moved functions or the
four exported helpers appears. The normaliser is PR #27540's, verbatim.
### Gates and suites
<details><summary>Package suite</summary>
`packages/metadata-protocol`, vitest `--maxWorkers=2`, JSON reporter,
under the shared verify lock.
- `main` `2e955dde`: 21,883 tests (21,857 passed, 0 failed, 26 skipped),
288 files.
- Head: 21,885 tests (21,859 passed, 0 failed, 26 skipped), 288 files.
Per file, test name and status over 21,870 distinct names against
`main`: 0 lost, 0 changed, 2 added, both the new `PRODUCERS` rows.
</details>
<details><summary>Hand gates, main and head</summary>
All 12 exit 0 at both `main` `2e955dde` and the head.
- Identical output: `check-adr-symbol-anchors`,
`check-system-context-census`, `check-tenant-audit-census`,
`check-query-options-erasure-ratchet`, `check-filter-alias-parity`,
`check-platform-checklist`.
- `check-durability-degradation-log-level --list`: `95 read seam(s)` at
both ends; identical once `[@:][0-9]+` is stripped, except the seven
lines that change file (above).
- `check-adr-anchors`: counts as noted in Acceptance notes.
- `check-startup-registry-verdict`: files 3,756 → 3,760.
`check-nul-bytes`: 22,620 → 22,624 files.
`check-engine-double-contract`: the `updateData`/`deleteData` seams keep
their entries at new line numbers; `productionFiles` 3,950 → 3,954.
`measure-return-propagating-durability-seams`: 3,779 → 3,783 files. Each
count is the four new modules.
- `check-governed-merges --branch claude/project-thread-06gygo`: 0 of 6
paths in the register (13 surfaces), NOT governed; 1,437 changed lines,
under the 3,000-line bar.
</details>
<details><summary>Derived gates</summary>
`dispatch-gates --commands` on head `6b074fce` derives 52 gate families
on the 6 changed paths; all 52 exit 0. Three exited 3 (PREREQUISITE NOT
MEASURED) on the first pass and 0 on the rerun:
`check-plugin-teardown-shape --self-test` after fetching its pinned
fixture commit into the shallow clone, `check:dual-build-cjs-loads` and
`check:lean-entry-closure` after `turbo run build
--filter='@objectstack/dogfood^...' --filter='@objectstack/runtime^...'
--filter=@objectstack/objectql`. `dispatch-gates --ran` reports 52
derived, 52 run, 0 NOT-MEASURED, and exits 0.
`pnpm lint`: exit 0.
</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 9cbe507 commit b6c2ed9
6 files changed
Lines changed: 895 additions & 542 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
0 commit comments