Repository navigation
refactor(metadata-protocol): move the bodies of 22 private members out of protocol.ts into eight themed modules (#25467 cut 33) - #27540
Conversation
…tocol.ts into seven themed modules Move-only: each body moves whole into a protocol-*.ts module, re-indented one level and otherwise unedited; the class keeps each method with its docblock and signature, and its body hands a host of exactly the members it reads to the moved function. Two module-level helpers gain export in place, and the imports only the moved bodies read move with them. Claude-Session: https://claude.ai/code/session_01L6bhgVeV5GgzaH9Ny16aSx Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgVeV5GgzaH9Ny16aSx Co-authored-by: Claude <noreply@anthropic.com>
…verlaidShippedContainerViewNames, and follow the moved throw sites in the refusal-opener pin Both members were earlier stays; re-measured on today's tree, neither moves the read-seam census nor any by-path pin, so they move on the same terms as the rest of this cut. The bracketed-refusal-opener pin scans PRODUCERS by file: the four modules that now hold moved throw sites join it at their own new Error count, so the scan keeps seeing them. Claude-Session: https://claude.ai/code/session_01L6bhgVeV5GgzaH9Ny16aSx Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 38 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 13 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 2173b1df02ad189278fb4507b3f5b15513b1378c && git checkout 2173b1df02ad189278fb4507b3f5b15513b1378c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin aef631b80b3175f2f43287a6e0185c828c356ac8 044b4d97de892c2ad6277961ee43b27a56f1dd0d && git checkout -B drift-repro aef631b80b3175f2f43287a6e0185c828c356ac8 && git merge --no-ff 044b4d97de892c2ad6277961ee43b27a56f1dd0d
node scripts/docs-audit/affected-docs.mjs --json aef631b80b3175f2f43287a6e0185c828c356ac8
|
|
domain:server#1 · os-sales · session_01L6bhgXcN9HaZYSEUdJWEjw 维护者速读(席位终稿)
席位意见:接受。纯搬移,形状与第 20–32 刀相同;普查从第 32 刀的 89 到本刀的 90,是 main 自己的变化(正文已说明,读数取自 main),不是本 PR 带来的。 席位核对 — ACCEPT · domain:server#1 · head 044b4d9 · 2026-10-29T12:08Z
|
Requested by Sales · project thread
Part of #25467
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6270097840
维护者速读
protocol.ts里 22 个私有方法的方法体原样搬进 8 个按主题划分的新文件(存储行绑定、显式降级、overlay 索引、视图容器判断、包提交记录、包作用域、/meta铸造拒绝、SDUI 清单),类上的方法、签名和文档注释都保留,只剩一行调用。src/protocol.ts(33,065 lines, +10,169 in 30 days) along itsObjectStackProtocolImplementationseams, one move-only slice per PR #25467 拆分超大文件protocol.ts的第 33 刀。单个成员一刀只能减 6 到 10 行,这次按派发令一次搬完所有通过筛查的私有成员;筛完后私有成员这条线已经搬尽。.d.ts与main原始字节完全相同,包测试与main逐条比对 0 丢失 0 变化,只多了 4 条新登记行带来的用例;回滚就是还原这一个 PR。protocol.ts里带[#25467 cut 33]标记的 22 个桩方法,以及protocol.bracketed-refusal-opener-absence.test.ts里新增的 4 行PRODUCERS登记。pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.bracketed-refusal-opener-absence.test.ts src/protocol.register-item-call-sites.test.ts,预期全部通过。What changes
Cut 33 of the
protocol.tssplit (#24586 ruling A, recorded in6270097840). Cuts 1–32 landed; cut 32 is #27406. The claim is6489357157. The dispatch asked for a batch: start from cut 31's alternative (6465513012,storedRowKnownDatasources), screen every remaining private member with a live body on freshmain, and move every one that passes in one PR under 3,000 lines, grouped by theme.22
ObjectStackProtocolImplementationmembers move unedited into 8 new modules underpackages/metadata-protocol/src/(#23050 shape B):protocol-stored-row-bindings.ts(113 lines)storedRowKnownDatasources(:6555, 6, 102),overlayLockLayerAt(:10478, 13, 138),resolveOverlayPackageBinding(:19272, 11, 65)StoredRowBindingsHostprotocol-loud-degradations.ts(69)throwMetadataServiceUnavailable(:9407, 7, 29),warnClosureReadUnavailable(:23514, 9, 36)LoudDegradationsHost; the first reads no memberprotocol-overlay-index.ts(95)ensureOverlayIndex(:8017, 37, 160),ensureOverlayMembersBackfilled(:8072, 3, 28)OverlayIndexHost, with getter and setter for the two one-shot flagsprotocol-registry-view-predicates.ts(122)expandStoredViewContainers(:10277, 7, 76),runtimeViewContainerObject(:18209, 4, 53),copiesOwnShippedViewContainer(:18241, 2, 32),isAnotherPackagesObject(:18295, 6, 59),registryTakesStoredRows(:18647, 1, 13),overlaidShippedContainerViewNames(:20018, 6, 82)RegistryViewPredicatesHost;runtimeViewContainerObjectreads no memberprotocol-package-commit-record.ts(137)persistPackageCommitRow(:26369, 2, 24),recordPackageCommit(:26397, 71, 342)PackageCommitRecordHostprotocol-package-scope.ts(150)uninstalledNamedBaseRefusal(:16236, 28, 175),isWritablePackage(:16577, 1, 12),shouldDropStorage(:19325, 6, 53),resolveAppPackageIdKey(:10582, 38, 323)PackageScopeHost;shouldDropStoragereads no memberprotocol-unmintable-meta-type.ts(62)refuseUnmintableMetaType(:19495, 17, 82)UnmintableMetaTypeHostprotocol-sdui-manifest.ts(77)resolveSduiManifest(:6750, 12, 66),reportPageRequiresAbsentAtLoad(:28937, 13, 111)SduiManifestHost; the second reads no memberBase lines are
protocol.tsatmainf7188b562b, which is byte-identical to the claim's basec5d4634174for this file. 300 body lines and 2,061 AST tokens in total.// [#25467 cut 33] The body moved to ....thisbuilds oneconst host: ThisParameterType<typeof fn> = {...}and returnsfn.call(host, ...). Methods are passed as closures overthis, fields as getters, and the two written flags (overlayIndexEnsured,overlayMembersBackfilled) as getter plus setter. The host type is the module's one named context; there is no second copy. The 4 bodies with nothiscall the plain function directly, as cut 26 did. The genericresolveAppPackageIdKeyis called as(resolveAppPackageIdKey<R>).call(host, ...).protocol.tsgoes from 29,508 to 29,346 lines. The PR is +982 / −312 over 10 files, 1,294 changed lines. The card stays open for later cuts.Screened and rejected
Every private, non-static class member with a live body on fresh
mainwas screened. A member had to pass four checks: no private-static read, nothis.constructorread, no by-path reader of its body, and an unchanged read-seam census (--listincluded). Each candidate was also run through the package suite and the hand gates on a trial tree. These 40 stay:isSealedManagedItem(registryAllowsOverlay),refusePackagedBaseRemoval(mergesOverlayAtRead),recordOptimisticConflictAudit(optimisticConflictAuditEntry),applyObjectRegistryMutation(overlayPackageMismatchError; also the register-item and write-through pins, and the ADR-0029 seam),reconcileViewExpansions(registeredViewExpansions; also its pins),promoteDraftForPublish(4 statics; also the view-expansion pin),readRevertableCommit(organizationScopedWriteRefusal)protocol.lookup-artifact-item-call-sitespin keyslookupArtifactItem(sites by member inprotocol.ts(11)packagedArtifactBase,readCodeLayerForCarryForward,readFlattenedMetaItems(also view-expansion),readMetaItem,isArtifactBacked,isNestedArtifactField,shippedViewContainerOf,runtimeViewContainerPackage,isShippedByAnotherPackage,expandRuntimeViewContainer,viewContainerNameCollisionRefusalprotocol.ts(11)emitMetadataMutation(recovery-doors countsthis.emitMetadataMutation(and its private declaration),applyRemoteMetadataMutation(recovery-doors body scan, view-expansion),getOverlayRepo(view-expansion:new SysMetadataRepository(must sit in it),hydrateOverlayIntoRegistry(lookup, register-item, view-expansion, hydrate-canonical-type),hydrateExpandedViewItems(view-expansion),applyRegistryWriteThrough(view-expansion, write-through, hydrate),restoreArtifactRegistryView(register-item, view-expansion),runPublishSideEffects(view-expansion, recovery-doors),ensureObjectStorageanddropObjectStorage(the write-through-spelling pin countsif (type !== 'object') return;inprotocol.ts),anotherPackageShips(the register-item pin regex-matches its body; measured red on the trial tree)findEnvironmentRows(89 → 73),findEnvironmentRow(→ 82),findServedOverlayRow(→ 86),storedFlowBindingAgrees(→ 88),foldStoredCollection(→ 88),rethrowUnlessMetadataStoreUnprovisioned(exit 1, a 70-line--listdiff: it is the benign-error discriminator),unmanagedImportCollisions(→ 88),rollBackUnmanagedImport(→ 88)probeRecord(the query-options-erasure ratchet reds: a new erasure site in a new file; it is also an engine-double seam),packagelessAddress(census 90 → 86),metaTypeNamespaceExists(census 90 → 89)The census readings in the first rows were taken against base
c5d4634174(89); the last two againstmain(90).The private series is spent. After this cut no private member with a live body passes the screen. The 57 public members were not screened; inferred-return publics stay, per the seat's shape call.
Tests
One test file changes, and it is the path-reader migration the ruling requires:
protocol.bracketed-refusal-opener-absence.test.tskeeps a per-file floor ofnew Error(producers (PRODUCERS). Fivenew Error(sites move, so four new modules get their row, under a[#25467 cut 33]comment, after'protocol-packaged-base-refusal.ts': 1,:Each row adds one generated case, so the suite grows by 4 (see Verification). No other test changes. The moved members are driven end to end by the existing suites (package install and uninstall, the
/metasave and publish doors, view-container expansion, overlay hydration, SDUI page loads); all pass at both ends.Acceptance notes
exportin place.rowMatchesOverlayWhere(read byoverlayLockLayerAt) andmetadataStoreUnavailableError(read bythrowMetadataServiceUnavailable) areprotocol.ts's own non-exported functions. Each gains theexportkeyword with nothing else in its statement changed, asCommitPlanItemdid in cut 32. Both keep readers inprotocol.tsand stay there.index.tsnames its re-exports one by one and names neither, so the published surface does not move (the.d.tsis raw-identical, below).protocol.ts:isUsableSduiManifest,findPageRequiresAbsentFromManifest,isWritablePackageShared(with its[#7560]comment),ensureMetadataOverlayIndexes,driverCanRunSqlandresolveDriverExec(the wholedriver-execimport), andisAppPackageIdKey(with its[#23183]comment). The two comments travel with the import intoprotocol-package-scope.ts.SDUI_MANIFEST_SERVICEandbackfillOverlayBundleMembersstay: docblocks still@linkthem.--listline changes file, with the same verdict and count.recordPackageCommit'scatchthat "guards persistPackageCommitRow() → loud (error)" now sits inprotocol-package-commit-record.ts. The census stays at 90.check-adr-anchorscounts move, and the gate passes at both ends. Citations 60,579 → 60,582 and files 8,558 → 8,561, because the moved bodies' ADR citations now also appear in the new modules. Decision-letter citations on the anchored surface go 1,910 → 1,909: one moved letter citation leftprotocol.tsfor a module outside the anchored set.check-adr-symbol-anchorsoutput is identical..d.tsis raw-identical tomain.a04a2c73cconc5d4634174, one merge ofmainf7188b562b(19 commits, none inpackages/metadata-protocol/), and044b4d97de. That commit addsrefuseUnmintableMetaTypeandoverlaidShippedContainerViewNames, which had been held back and passed every check on a re-measure againstmain, and it adds thePRODUCERSrows. The whole move was regenerated by script on that commit, so the two late members follow the same recipe. The first commit's subject says 21 members and seven modules; it moved 20.claude/project-thread-06v1iois the harness-pinned branch for this thread. It names no issue, so the claim comment is the identity record.pr_create, of the 25 open PRs one editsprotocol.ts: harden(metadata): a permission set's name is unique across packages #27535 (permission-set name uniqueness, +57/−3 inprotocol.ts).git merge-tree --write-treeof this head with its head4cd524bf0bis clean, and its added lines call none of the moved members. chore: version packages #26517 (Version Packages) touches onlyCHANGELOG.mdandpackage.jsonin this package.mainmoved after the merge (toaef631b80b); the one new commit in this package only addsprotocol.draft-publish-verdict.test.ts, andgit merge-treewith it is clean, somainwas not merged again.packages/spec/**, outside this card):manifest.json'sdependenciesrow →protocol.ts#resolveWritePackageScope(cut 19) andseed.json→protocol.ts#applySeedBodies(cut 14). No row points at this cut's members.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 parameters, return type and body,
protocol.tsatmainagainst the head module:"text equal" is the whitespace-collapsed source text, comments included. Negative controls, one token changed in an in-memory copy of the head module, each
differ 1:registryTakesStoredRows===→!==;isWritablePackagepackageId→pkg;overlaidShippedContainerViewNamesownPackageId→pkg;refuseUnmintableMetaType400→409.[#25467 cut 33]comment), the two helpers withexportadded, and the removed imports listed above.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
pnpm --filter @objectstack/metadata-protocol buildagainst one dependency tree (a fullturbo run build). The base andmainlegs swapped the packagesrc/tree-only and restored it fromHEADunder a trap; afterwardsgit status --porcelainwas empty.c5d4634174a04a2c73ccmainf7188b562b044b4d97dedist/index.d.ts=dist/index.d.cts4cb92b2e20135dd78d07fd2800b1d2a050a432b923cd511d5b50f3ed6de29a58(784,960 bytes)08235c712877a28a3cdf7c36d96d18fc72b246c8533eae22feb64aaae7af12ea(785,044 bytes)maina4dcc2306638c29983bceaf7258df71a29a3020a3ec26904c9830a0cecd0c70e6faa3395b5c4ccdc2e24a47a359fa8a2f35bd1aaa2f3df821ea164c316a11192mainmainThe merged tree
2c6ff0aegives themainhashes too; the.d.tsmoved between base andmainonly through the mergedmaincommits. Bundles change as expected:index.jse5abe0490663649f→d80799c603dc52be,index.cjs1c36338d33aa16a5→c8cbc5fc5a540a2d(sha256, 16). The ESM and CJS export tables are the same 78 names (e47ac7c753bcb8be) at both ends; none of the moved functions or the two exported helpers appears.Normaliser, verbatim:
Positive control. On the final head
.d.ts,private storedRowKnownDatasources;was made public (a 2-line raw diff). Raw goes to66b4b1c26cdbfa9b…, normalised tob248e476c8ff57fb…, both different from the bar. So the bar can see a change on a moved member.Gates and suites
Package suite
packages/metadata-protocol, vitest--maxWorkers=2, JSON reporter, under the shared verify lock.c5d4634174and move commita04a2c73cc: both 21,800 tests (21,774 passed, 0 failed, 26 skipped), 283 files; per test 0 lost, 0 added, 0 changed.mainf7188b562b(src swapped tree-only, restored under a trap): 21,800 tests (21,774 passed, 0 failed, 26 skipped), 283 files.044b4d97de: 21,804 tests (21,778 passed, 0 failed, 26 skipped), 283 files. Per test name and status over 21,787 distinct names againstmain: 0 lost, 0 changed, 4 added, all four the newPRODUCERSrows.Hand gates, main and head
All 13 exit 0 at both
mainf7188b562band the final head.check-adr-symbol-anchors,check-system-context-census,check-tenant-audit-census,check-query-options-erasure-ratchet(50 unswept non-test sites in 15 files, none new),check-filter-alias-parity,check-durability-degradation-log-level(90 read seam(s)), the spec liveness gate,check-platform-checklist.check-durability-degradation-log-level --list: identical once[@:][0-9]+is stripped, except the onerecordPackageCommitline that changes file (above).check-adr-anchors: counts as noted in Acceptance notes.check-startup-registry: scanned files 3,693 → 3,702.check-nul-bytes: 21,998 → 22,006 files.check-engine-double-contract: theupdateData/deleteDataseams keep their entries at new line numbers;productionFiles3,887 → 3,896. Each count is the new modules plus build output in the head tree, as in cuts 20–32.check-platform-checklist --changed-from origin/main: OK, 32 anchors judged, 0 lost.check-governed-merges --branch claude/project-thread-06v1io: 0 of 10 paths in the register (13 surfaces), NOT governed; 1,294 changed lines, under the 3,000-line bar.Derived gates
dispatch-gates --commands --repo objectstack-ai/objectstackon044b4d97dederives 52 gates on 10 changed paths; re-derived againstmainaef631b80b, the list is unchanged. All 52 exit 0 after a fullturbo run build.dispatch-gates --ranreports 52 derived, 52 run, 0 NOT-MEASURED, 0 UNRUN, and exits 0.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgVeV5GgzaH9Ny16aSx
Generated by Claude Code