Repository navigation
refactor(metadata-protocol): move the bodies of eight members out of protocol.ts into four themed modules (#25467 cut 35) - #28090
Conversation
…protocol.ts into four themed modules (#25467 cut 35) Cut 35 of the protocol.ts split, under ruling B: the read-seam census now follows a moved body across the host split, so the members it alone rejected at cuts 33 and 34 move. - protocol-environment-rows.ts: findEnvironmentRows, findEnvironmentRow, findServedOverlayRow, packagelessAddress - protocol-stored-collection-fold.ts: foldStoredCollection - protocol-package-uninstall.ts: deletePackage - protocol-unmanaged-import.ts: unmanagedImportCollisions, rollBackUnmanagedImport Shape B as cuts 20-34: the class keeps each method, its docblock and signature, and its body becomes one host literal plus a .call. Four top-level helpers the bodies read gain `export` in place; index.ts names none of them. The bracketed-refusal pin gets PRODUCERS rows for the two new modules with new Error( sites. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czJUan4AwAS6HLpzZN
📓 Docs Drift CheckThis PR changes 1 package(s): 58 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 16 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7fc194dc3481c5b1324b55380fbfc10f276c2383 && git checkout 7fc194dc3481c5b1324b55380fbfc10f276c2383
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 549203d040a122591ba07bb21b90124e31eaf5de 6b074fce6ccfa60e69d5b285ab74860e9b346834 && git checkout -B drift-repro 549203d040a122591ba07bb21b90124e31eaf5de && git merge --no-ff 6b074fce6ccfa60e69d5b285ab74860e9b346834
node scripts/docs-audit/affected-docs.mjs --json 549203d040a122591ba07bb21b90124e31eaf5de
|
|
domain:server#1 · os-elon-musk · session_016WV4czVnUdQQCVKSW5J2uk Seat ACCEPT · PR #28090 · head
|
Requested by Elon · project thread
Part of #25467
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6520565826
维护者速读
protocol.ts里 8 个方法的方法体原样搬进 4 个按主题划分的新文件(环境自有行读取、存储集合折叠、包卸载、非托管导入),类上的方法、签名和文档注释都保留,只剩一个调用。protocol.ts从 29,585 行降到 29,114 行。src/protocol.ts(33,065 lines, +10,169 in 30 days) along itsObjectStackProtocolImplementationseams, one move-only slice per PR #25467 裁决 B 的第二个 PR。fix(scripts): the read-seam census follows a moved protocol.ts body across its host split (#25467 census extension) #28058 让读缝普查能跟着拆分走,cut 33/34 里只因普查被拒的成员(含 300 行的deletePackage)现在可以搬了。.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
ObjectStackProtocolImplementationmembers move unedited into 4 new modules underpackages/metadata-protocol/src/(#23050 shape B):protocol-environment-rows.ts(161 lines)findEnvironmentRows(:10240, 12, 259),findEnvironmentRow(:10261, 6, 161),findServedOverlayRow(:10470, 29, 221),packagelessAddress(:17212, 20, 243)EnvironmentRowsHostprotocol-stored-collection-fold.ts(153)foldStoredCollection(:7404, 95, 487)StoredCollectionFoldHostprotocol-package-uninstall.ts(358)deletePackage(:24914, 300, 1,107; public)PackageUninstallHostprotocol-unmanaged-import.ts(148)unmanagedImportCollisions(:26121, 39, 464),rollBackUnmanagedImport(:26177, 38, 336)UnmanagedImportHostBase lines are
protocol.tsatmain2e955dde. 539 body lines and 3,278 AST tokens in total.deletePackageis the one public member; its declared return type isPromise<DeletePackageResponse>, so the published signature is unchanged.// [#25467 cut 35] The body moved to ....const host: ThisParameterType<typeof fn> = {...}and returnsfn.call(host, ...). Methods are passed as closures overthis,engineandgetServicesRegistryas getters. Each module has one named host type whose members are typed as the class members.protocol.tsgoes from 29,585 to 29,114 lines. The PR is +895 / −542 over 6 files.Screened and kept out
storedFlowBindingAgreesandmetaTypeNamespaceExists: each body'scatchdelegates tothis.rethrowUnlessMetadataStoreUnprovisioned, and the census's catch-side guard resolution (establishesBenign) is same-file only. Moving either turns the census red. fix(scripts): the read-seam census follows a moved protocol.ts body across its host split (#25467 census extension) #28058 extended the read side only, as the ruling asked.rethrowUnlessMetadataStoreUnprovisionedstays: it is the benign-error discriminator the census reads.The 8 that move pass the other screens on fresh
main: no private-static read, nothis.constructorread, 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.tskeeps a per-file floor ofnew Error(producers (PRODUCERS). Threenew Error(sites move (two indeletePackage, one inrollBackUnmanagedImport), so two modules get a row, under a[#25467 cut 35]comment, after cut 33's rows: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
--listlines change file with the same verdict: the three guards indeletePackage, the guard inpackagelessAddress, the two in the unmanaged import, andfoldStoredCollection's reported pass-through. Every other line is identical once line numbers are stripped. This is the reading cut 34 lost (93 → 89) and fix(scripts): the read-seam census follows a moved protocol.ts body across its host split (#25467 census extension) #28058 recovers.exportin place:remainingRowsPhrase,servedOverlayRowCandidates,mergePackageAwareOverlayandmetadataReadFailureError, eachprotocol.ts's own non-exported function, read by a moved body. Each gains theexportkeyword with nothing else in its statement changed, as cut 33 did. All four keep readers inprotocol.ts.index.tsnames its re-exports one by one and names none of them, so the published surface does not move (the.d.tsis raw-identical, below).protocol.tslost its last reader, so none is removed.check-adr-anchorscounts 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 leftprotocol.tsfor modules outside the anchored set.check-adr-symbol-anchorsoutput is identical.pr_create, none of the 19 open PRs editspackages/metadata-protocol/src/or the census script (each head fetched and diffed against its merge base), so nogit merge-treeproof is owed.skip-changeset, per ruling6348891160.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
thisparameter dropped), return type and body,protocol.tsatmainagainst the head module:"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===→!==;findEnvironmentRownull→undefined;foldStoredCollectionregistered→registeredX;rollBackUnmanagedImportawait→void.[#25467 cut 35]comment), the four helpers withexportadded, and the class.tsc --noEmitinpackages/metadata-protocol: exit 0.pnpm exec eslint --no-inline-config packages/metadata-protocol: exit 0, no output.The published
.d.ts(ruling6348891160)Built with
turbo run build --filter='@objectstack/metadata-protocol...'at each end, under the shared verify lock.main2e955dde6b074fcedist/index.d.ts=dist/index.d.cts00e090f9865173d73ac2d0bf451663790d89a9aabf6ad74fc6470ff2fbf2ae61(791,803 bytes)66d4be5eb145c97d09699a67e8d5014ec009fa2838f05c980d492edf00c491cdcmpequal)Bundles change as expected:
index.jsa11431fcf0a4301d→3975040696890377,index.cjs3826cf554a460505→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
Package suite
packages/metadata-protocol, vitest--maxWorkers=2, JSON reporter, under the shared verify lock.main2e955dde: 21,883 tests (21,857 passed, 0 failed, 26 skipped), 288 files.main: 0 lost, 0 changed, 2 added, both the newPRODUCERSrows.Hand gates, main and head
All 12 exit 0 at both
main2e955ddeand the head.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: theupdateData/deleteDataseams keep their entries at new line numbers;productionFiles3,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.Derived gates
dispatch-gates --commandson head6b074fcederives 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-testafter fetching its pinned fixture commit into the shallow clone,check:dual-build-cjs-loadsandcheck:lean-entry-closureafterturbo run build --filter='@objectstack/dogfood^...' --filter='@objectstack/runtime^...' --filter=@objectstack/objectql.dispatch-gates --ranreports 52 derived, 52 run, 0 NOT-MEASURED, and exits 0.pnpm lint: exit 0.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4czJUan4AwAS6HLpzZN
Generated by Claude Code