Repository navigation
refactor(metadata-protocol): move the metadata item reads and the layered read through the protocol host (#25467 E2 cut 1b) - #29590
Conversation
…ered reads through the protocol host getMetaItem, getMetaItemForExecution and readMetaItem move to protocol-meta-item-reads.ts; packagelessLayeredReadRefusal and getMetaItemLayered move to protocol-meta-layered-reads.ts. Each body is the method's own, with this.x read as host.x (73 sites); each method stays on the class as a stub. protocol.ts drops the import names only the moved bodies read, and the two import comments they carried move with them. Claude-Session: https://claude.ai/code/session_01ADHkmR4MjTzeUv5x6tNkbk Co-authored-by: Claude <noreply@anthropic.com>
…he item and layered reads where their bodies now stand Claude-Session: https://claude.ai/code/session_01ADHkmR4MjTzeUv5x6tNkbk Co-authored-by: Claude <noreply@anthropic.com>
…ads move Claude-Session: https://claude.ai/code/session_01ADHkmR4MjTzeUv5x6tNkbk Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 34 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 12 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 b87e9ff024aaaf1d67e074ae726924cc154b5b2c && git checkout b87e9ff024aaaf1d67e074ae726924cc154b5b2c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d3175d59d036d3c2819d5e7913c8c406c1ea634d 3912b131ffced8c309325b9fa42caa09c59116de && git checkout -B drift-repro d3175d59d036d3c2819d5e7913c8c406c1ea634d && git merge --no-ff 3912b131ffced8c309325b9fa42caa09c59116de
node scripts/docs-audit/affected-docs.mjs --json d3175d59d036d3c2819d5e7913c8c406c1ea634d
|
|
domain:server#5 · os-steve · session_01ADHkmQKwKFCp1m6Pb6Q8c1 维护者速读
席位意见:与 E2 派发相符。被迫改动的只有调用点钉住测试改读新模块,断言内容不变。 席位核对ACCEPT ·
|
Requested by Steve · project thread
Part of #25467
Clause-②: no
Metadata-protocol: none
维护者速读
protocol.ts里“元数据读取”一节的后半(单项读取getMetaItem、getMetaItemForExecution及二者共享的私有readMetaItem,外加分层读取packagelessLayeredReadRefusal、getMetaItemLayered)的方法体,经 E1 的宿主机制原样搬进两个新模块;5 个方法仍留在类上(签名与文档不变),方法体变成一行转发。src/protocol.ts(33,065 lines, +10,169 in 30 days) along itsObjectStackProtocolImplementationseams, one move-only slice per PR #25467 裁决 E 的 E2 第 1 节后半(1b),接在已合并的 1a(refactor(metadata-protocol): move the metadata list reads, the audit read and the UI-view read through the protocol host (#25467 E2 cut 1a) #29548)之后,在声明的protocol.ts冻结日内;第 1 节到此搬完。this.读作host.”之外 AST 与文本全同;对外index.d.ts(ESM 与 CJS)与 main 构建出的逐字节相同,getMetaTypes()的推断类型块也逐字节相同。回滚即整体 revert。packages/metadata-protocol/src/protocol-meta-item-reads.ts文件头;protocol.ts里 5 个方法的转发体与类static {}块新增的宿主条目;protocol.lookup-artifact-item-call-sites.test.ts的改动。cd packages/metadata-protocol && node scripts/host-split.mjs check origin/main readMetaItem protocol-meta-item-reads.ts,预期"ok":true,"textIdentical":true。What changes
Step E2, section 1 "metadata reads", part 1b of ruling E (6537939895), on the
protocol.tsfreeze day seat 5 declared (#28677). It follows 1a (#29548) and finishes section 1. This is a pure application of the E1 host pattern: no logic changes, and no new rewrite kind. Before cutting, the director's #29465 A condition was checked: noprotocol.tscodemod card has been claimed (the one codemod card, #29520, is thesql-driver.tspilot).this.xtohost.x)getMetaItemprotocol-meta-item-reads.tsgetMetaItemForExecutionprotocol-meta-item-reads.tsreadMetaItem(private, 684 lines)protocol-meta-item-reads.tspackagelessLayeredReadRefusalprotocol-meta-layered-reads.tsgetMetaItemLayered(496 lines)protocol-meta-layered-reads.tsEach method keeps its docblock, modifiers and signature on the class; its body becomes
return fn(protocolHost(this), …).ProtocolHostand the class's static block gain 22 entries, all call-time closures (the other members these bodies read were already on the host).node scripts/host-split.mjs check origin/main MEMBER MODULEreadsok: true, textIdentical: truefor all five, and the tool refused none. Negative control, withcode === nullchanged to!==ingetMetaItemLayered's moved body, then restored:protocol.tsdrops ten import names only the moved bodies used:isTenantAuthored,storedDraftChanges,computeViewReferenceDiagnostics,decorateMetadataItem,withFormLayoutWarnings,withPublishVerdict,isObjectOfDisabledPackage,noPendingDraftError,objectPackageDisabledErrorandenvelopePackageId. Each module imports what its bodies read from whereprotocol.tsimports it. Two import comments belonged to dropped names, and each moves with its name rather than being lost:[#21059]note onisTenantAuthorednow stands on that import inprotocol-meta-layered-reads.ts;[#24395]note's half about the draft row's per-key provenance (storedDraftChanges) now stands inprotocol-meta-item-reads.ts, andprotocol.tskeeps the half about the authoring surface.Forced test edit
One by-path pin reads through the split. What it asserts is unchanged.
src/protocol.lookup-artifact-item-call-sites.test.ts:readMetaItemsite rows carryfile: 'protocol-meta-item-reads.ts', and thegetMetaItemLayeredrow carriesfile: 'protocol-meta-layered-reads.ts', where those bodies now stand.protocol.tsto importenvelopePackageIdfromprotocol-package-bindings.ts. Neither door stands inprotocol.tsany more, so it now requires the item read's module to import that one definition and to define no copy, as 1a did for the list read's module.protocol.tsmust still define no copy.Ablation, with the item read's
envelopePackageId(request.packageId, item)argument changed torequest.packageIdin the module, then restored:Tests 1 failed | 5 passed (6),a site with no recorded disposition … expected [ Array(1) ] to deeply equal [].The read-verb pin, the
hydrateOverlayIntoRegistrycaller-set pin (1a's edit already reads the modules) and the read-seam census needed no edit. Read-verb ablation, dropping the fold fromgetMetaItemLayered's moved body, then restored:Tests 1 failed | 17 passed (18),expected [ 'getMetaItemLayered' ] to deeply equal []. The census reads 100 seams, the same as main.The published
.d.tsBuilt from main 85f77e9 (1a's merge, this branch's base) and from this head.
index.d.tsis byte-identical: raw sha25697e36a54…d6c680on both sides, ESM equal to CJS, normaliser 2b73fbce4…a55114on both. The raw diff ofgetMetaTypes()'s emitted block (793 lines, its return type still inferred per the seat's E1 ruling) is empty. The declaration-emit comment leak that struck 1a did not strike this cut, so no comment length was adjusted. Before the replay onto 85f77e9, the same cut stacked on 1a's head read byte-identical to main 399df5b too (450c9334…5d744e).Serial
1a (#29548) landed as one squashed commit, 85f77e9. This branch was restarted from main at dbca3ef and the three 1b commits were replayed onto it.
host-split checkwas re-run against the new main for all five members, and the suite, the dependents, the.d.tsand the gates below were re-run on the replayed head. Re-read just before opening against main d3175d5, 9 commits later. One of those, #29437, touchesprotocol-save-door-refusals.tsonly.git merge-treewith main is clean.Open PRs whose own diff touches
protocol.tsor aprotocol-*.tsmodule:protocol.tsandprotocol-credential-carry-forward.ts). Its hunks sit in the import list,carryForwardRedactedCredentialsandsaveMetaItem. All of them are outside the moved section, which runs fromgetMetaItem, main line 4576, throughgetMetaItemLayered's end, beforeauditMetaItem's stub at line 5968.git merge-treewith this head is clean.Seat 3's #29390 work (branch
claude/project-thread-gvqm55, head d776e25, no PR yet) touches the restore limb, which is outside the moved section.git merge-treewith this head is clean.Gates
On 3912b13 (the replayed head):
node scripts/pm/dispatch-gates.mjs --commandsderived 61 commands, and each recordsexit 0.--ranreports 61 derived, 61 run, 0 NOT-MEASURED, 0 UNRUN.eslint packages/metadata-protocol --no-inline-config) exits 0.The same battery was green before the replay (62 of 62, on the stack over 1a). CI is not read.
Generated by Claude Code