Repository navigation
feat(scripts): codemod-split-protocol --members moves a member of the landed protocol.ts facade, and moves six #30054 door bodies - #30687
objectstack-fleet[bot] wants to merge 3 commits into
Conversation
…he landed protocol.ts facade The first pass refuses its own output, and --verify no longer re-proves against the split's base since the facet modules were edited by hand. The new pass moves named instance methods on the split file into the facet of their section, as the first pass would have taken them (its stay rules, planMove, host entries, lift and docblock rule), accepts hand-edited facet modules (later header paragraphs, imports, top-level declarations, facet members), and proves each move by its undo against the pre-move tree: protocol.ts, protocol-host.ts and the receiving modules byte for byte, every other module unchanged, plus host-split.mjs's checkMove on the unlifted pair. Self-test: three new batteries (members pass, proof, refusals), 85 cases. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cweKLi1i8z12wPbsnw
…arations in protocol.ts's import order Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cweKLi1i8z12wPbsnw
…eir facets with codemod-split-protocol --members getData, cloneData, saveMetaItem, publishMetaItem, rollbackMetaItem and deleteMetaItem keep their signature and docblock on the class and delegate to their section's facet; the bodies moved unchanged, written by `node scripts/codemod-split-protocol.mjs --members getData,cloneData,saveMetaItem,publishMetaItem,rollbackMetaItem,deleteMetaItem --write` and re-proved by `--members --verify --base`. Their six facade-registry rows are dropped; getDiscovery and findData keep theirs, re-pointed at the second PR of the same card. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cweKLi1i8z12wPbsnw
📓 Docs Drift CheckThis PR changes 1 package(s): 52 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 83128af5ece0b1540de16e237679ea213877a2b7 && git checkout 83128af5ece0b1540de16e237679ea213877a2b7
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a2437b560bd8872feece6ec8b57c6fdf21cff1f4 c2e3fa7fa647cb5784170104cb77a05d1975b945 && git checkout -B drift-repro a2437b560bd8872feece6ec8b57c6fdf21cff1f4 && git merge --no-ff c2e3fa7fa647cb5784170104cb77a05d1975b945
node scripts/docs-audit/affected-docs.mjs --json a2437b560bd8872feece6ec8b57c6fdf21cff1f4
|
|
domain:devx#3 · os-elon-musk · session_016WV4cz3RTQjLh7hZBLzgtZ 席位核对 · ACCEPT ·
|
Requested by Elon · project thread
Refs #30518
Refs #30054
Clause-②: no
Metadata-protocol: none
维护者速读
scripts/codemod-split-protocol.mjs加了--members通道,能在已落地的 protocol.ts 门面上把单个方法体搬进它所在的 facet;并用它搬走了 refactor: give the inferred-return-type public methods on the engine.ts and protocol.ts facades explicit return types (.d.ts unchanged), so the codemod can move their bodies #30054 的六个门(getData、cloneData 与四个 *MetaItem)。--verify也因 facet 模块被手改过而无法再证明,八个门的方法体只能留在类上当例外。index.d.ts/index.d.cts前后字节相等;回滚即 revert 本 PR。scripts/codemod-split-protocol.mjs的 members 一节(生成与逆向证明);protocol-data-crud.ts新增的 import 块;scripts/facade-delegation-registry.json。node scripts/codemod-split-protocol.mjs --members --verify --base f4d568ba(本 PR 的基点),预期输出undoing the moves does rebuild … byte-for-byte、退出码 0。What changes
The tool.
scripts/codemod-split-protocol.mjs --members A,B [--write]moves named instance methods of the splitObjectStackProtocolImplementationinto the facet of their section, exactly as the first pass would have taken them: the same stay rules (plan, any reason refuses),host-split.mjs'splanMoveandinsertHostEntries, the first pass's lift and docblock-ownership rule, and the lifted one-line stub.--members --verify --base REFre-proves the moves on disk. The first pass is unchanged and still refuses its own output.It accepts the hand edits
main's facet modules carry (header paragraphs after the generated first one, imports, top-level declarations, facet members nobody moved). It grows only: the generated first header paragraph (the name, re-wrapped), the facet class (the member in class order), and the import block (a binding joins a declaration of its specifier and kind in that declaration's own layout, or becomes a new declaration, inprotocol.ts's import order). It refuses a facetprotocol.tsdoes not already import, a body reading a top-level name the generated export list does not export, a first paragraph that is not the generated one, and a binding the module holds under another source or kind. This is the same acceptance rule #30572 asks of theengine.ts--memberspass (hand-edited headers and import blocks), kept consistent here; the engine codemod is not touched.The proof is the undo against the pre-move tree, not the split's #29985 base: from the head alone, each moved body (rewrites and re-indentation undone) and any owned docblock goes back on its stub; each receiving module loses the moved members, their header names and the import bindings nothing reads any more; the factory and the interface lose the entries the base host did not carry. The result must be the base
protocol.ts(its import bindings only moved bodies read pruned, as the first pass prunes them),protocol-host.tsand receiving modules byte for byte, every other section module unchanged, each facet member its base method's text as the first pass lifts it, andhost-split.mjs'scheckMovegreen on the unlifted pair.The moves.
getData,cloneData,saveMetaItem,publishMetaItem,rollbackMetaItemanddeleteMetaItemnow delegate toProtocolDataCrudFacet,ProtocolSaveFacet,ProtocolHistoryAndPublishFacet,ProtocolPackageCommitsFacetandProtocolDiffDeleteLoadFacet;protocol-host.tsgains the eight entries those bodies read. Their six rows leavescripts/facade-delegation-registry.json(50 named exceptions remain). Written bynode scripts/codemod-split-protocol.mjs --members getData,cloneData,saveMetaItem,publishMetaItem,rollbackMetaItem,deleteMetaItem --write, no hand edit after it.getDiscoveryandfindDatastay for the second PR of #30518: all eight together come to 3,775 changed lines, over the 3,000-line budget. Their two rows now name #30518.Why
#30054 spelled the eight doors' return types (PR #30516) so their bodies could leave the facade, but the codemod could not move a member of a facade that had already landed. #30518 asked for that pass.
Tests
node scripts/codemod-split-protocol.mjs --self-test: 85 cases in 10 batteries pass. Three new batteries:members pass(8: the move proves; stub; class-order placement before the next member and last; header paragraph with a hand-written paragraph kept; import joins its declaration; new declaration ahead ofProtocolHost's with a hand-written import kept;protocol.tsprune; determinism),members proof(12 negative controls, each must change the head and must fail: an edited moved body, an edited hand-written facet member, a second blank line, a header missing a name, a changed untouched module, an edited interface entry, an entry noPicknames, a stub calling another facet, an edited public docblock, an edit elsewhere inprotocol.ts, a dropped import no moved body reads, a proof over nothing) andmembers refusals(10).main(f4d568ba):--members(six names) exits 0 and--members --verify --base HEAD~1at head exits 0: 6 moved,checkMove6/6,protocol.ts13,927 -> 13,743 lines, 9 import bindings pruned. Measured also with all eight names: exit 0,checkMove8/8, the built declarations byte-equal too.@objectstack/metadata-protocolatc2e3fa7f: vitest 317 files passed / 4 skipped, 22,454 tests passed / 26 skipped (exit 0);typecheckexit 0.main'ssrc/: exit 1, six problems, one per moved door; at head exit 0 (50 named exceptions).Acceptance notes
mainf4d568ba: the first pass still refuses its own output (exit 2), and--verify --base 48914fdc^is now 77/85 bodies and 69/78checkMove(the card read 79/85, 71/78; more hand edits since).Fixes #30518) movesgetDiscoveryandfindDatawith this pass.findDatahas a path reader,protocol.query-transport-dialect.test.ts(the fold names the spec export at the call sitereadsprotocol.ts), which goes red when only the body moves (measured); that PR gives the reader the facet module, as ruling 6597555122 item 3 does.scripts/check-filter-alias-parity.mjsalso readsprotocol.tsand is re-run there.PATH_READER_NEEDLESis empty in this codemod, so the first pass would not have keptfindDatafor that reader either; not changed here (it is the first pass's table).--self-testof this codemod is not run by a CI workflow (true onmaintoo); run locally above.Verification
Declaration files
pnpm --filter @objectstack/metadata-protocol buildat basef4d568baand at head:dist/index.d.tsanddist/index.d.ctscmpbyte-equal (sha256726c856a6a748865…on both sides).dispatch-gates
node scripts/pm/dispatch-gates.mjs --commandsatc2e3fa7f: 78 families derived, each run with its exit code captured before any pipe.check-plugin-teardown-shape.mjs --self-testexit 3 in the shallow clone, exit 0 after fetching its pinned commit;check:lean-entry-closureexit 3, exit 0 afterpnpm turbo run build --filter=@objectstack/objectql).pnpm check:dual-build-cjs-loads(exit 3, needs a whole-tree build; CI runs it).dispatch-gates --ran: 78 derived, 77 run, 1 NOT-MEASURED, 0 UNRUN.node scripts/check-facade-delegation-only.mjsexit 0 (50 named exceptions);eslint --no-inline-configover the 9 changed source files exit 0;node scripts/codemod-split-protocol.mjs --self-testexit 0.Changed lines
1,353 changed lines (+1,098 / -255) in 11 files, under 3,000:
scripts/codemod-split-protocol.mjs+711/-1,protocol-data-crud.ts+220/-2,protocol.ts+19/-203,protocol-history-and-publish.ts+59/-1,scripts/facade-delegation-registry.json+4/-40,protocol-save.ts+28/-2,protocol-diff-delete-load.ts+19/-2,protocol-package-commits.ts+18/-2, the changeset +10,protocol-host.ts+7, the return-type pin's docblock +3/-2.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code