Skip to content

feat(scripts): codemod-split-protocol --members moves a member of the landed protocol.ts facade, and moves six #30054 door bodies - #30687

Draft
objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/project-thread-f79iqe
Draft

objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/project-thread-f79iqe

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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)。
  • 为什么改:原 codemod 拒绝在自己的输出上运行,--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 split ObjectStackProtocolImplementation into 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's planMove and insertHostEntries, the first pass's lift and docblock-ownership rule, and the lifted one-line stub. --members --verify --base REF re-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, in protocol.ts's import order). It refuses a facet protocol.ts does 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 the engine.ts --members pass (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.ts and receiving modules byte for byte, every other section module unchanged, each facet member its base method's text as the first pass lifts it, and host-split.mjs's checkMove green on the unlifted pair.

The moves. getData, cloneData, saveMetaItem, publishMetaItem, rollbackMetaItem and deleteMetaItem now delegate to ProtocolDataCrudFacet, ProtocolSaveFacet, ProtocolHistoryAndPublishFacet, ProtocolPackageCommitsFacet and ProtocolDiffDeleteLoadFacet; protocol-host.ts gains the eight entries those bodies read. Their six rows leave scripts/facade-delegation-registry.json (50 named exceptions remain). Written by node scripts/codemod-split-protocol.mjs --members getData,cloneData,saveMetaItem,publishMetaItem,rollbackMetaItem,deleteMetaItem --write, no hand edit after it.

getDiscovery and findData stay 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 of ProtocolHost's with a hand-written import kept; protocol.ts prune; 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 no Pick names, a stub calling another facet, an edited public docblock, an edit elsewhere in protocol.ts, a dropped import no moved body reads, a proof over nothing) and members refusals (10).
  • The pass on main (f4d568ba): --members (six names) exits 0 and --members --verify --base HEAD~1 at head exits 0: 6 moved, checkMove 6/6, protocol.ts 13,927 -> 13,743 lines, 9 import bindings pruned. Measured also with all eight names: exit 0, checkMove 8/8, the built declarations byte-equal too.
  • @objectstack/metadata-protocol at c2e3fa7f: vitest 317 files passed / 4 skipped, 22,454 tests passed / 26 skipped (exit 0); typecheck exit 0.
  • Facade gate negative control: the head registry over main's src/: exit 1, six problems, one per moved door; at head exit 0 (50 named exceptions).

Acceptance notes

  • Premises re-measured on main f4d568ba: the first pass still refuses its own output (exit 2), and --verify --base 48914fdc^ is now 77/85 bodies and 69/78 checkMove (the card read 79/85, 71/78; more hand edits since).
  • The second PR (same card thread, Fixes #30518) moves getDiscovery and findData with this pass. findData has a path reader, protocol.query-transport-dialect.test.ts (the fold names the spec export at the call site reads protocol.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.mjs also reads protocol.ts and is re-run there.
  • PATH_READER_NEEDLES is empty in this codemod, so the first pass would not have kept findData for that reader either; not changed here (it is the first pass's table).
  • A lifted public member's return type keeps the method's own line breaks re-indented one level, as the first pass's lift writes it (the undo depends on it).
  • The --self-test of this codemod is not run by a CI workflow (true on main too); run locally above.

Verification

Declaration files

pnpm --filter @objectstack/metadata-protocol build at base f4d568ba and at head: dist/index.d.ts and dist/index.d.cts cmp byte-equal (sha256 726c856a6a748865… on both sides).

dispatch-gates

node scripts/pm/dispatch-gates.mjs --commands at c2e3fa7f: 78 families derived, each run with its exit code captured before any pipe.

  • 77/78 exit 0 (two after their prerequisite: check-plugin-teardown-shape.mjs --self-test exit 3 in the shallow clone, exit 0 after fetching its pinned commit; check:lean-entry-closure exit 3, exit 0 after pnpm turbo run build --filter=@objectstack/objectql).
  • NOT MEASURED: 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.mjs exit 0 (50 named exceptions); eslint --no-inline-config over the 9 changed source files exit 0; node scripts/codemod-split-protocol.mjs --self-test exit 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

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (Not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

…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
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/metadata-protocol, touching 58 documentable anchor(s).

52 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json a2437b560bd8872feece6ec8b57c6fdf21cff1f4.

⛔ 13 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: /data/:object (route, 76 pages)
  • the SDK route bridge reached 63 of 221 client-bound route-ledger rows — the other 158 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 158: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 103 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json a2437b560bd8872feece6ec8b57c6fdf21cff1f4 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 83128af5ece0b1540de16e237679ea213877a2b7 — the merge of head c2e3fa7fa647cb5784170104cb77a05d1975b945 into base a2437b560bd8872feece6ec8b57c6fdf21cff1f4, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs a2437b560bd8872feece6ec8b57c6fdf21cff1f4 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:devx#3 · os-elon-musk · session_016WV4cz3RTQjLh7hZBLzgtZ

席位核对 · ACCEPT · c2e3fa7f · 2026-11-05T22:53Z

Head-sha: c2e3fa7fa647cb5784170104cb77a05d1975b945

  • Shape: 11 files, +1,098/−255 (1,353 < 3,000). PR1 of a planned two-PR split recorded on claim 6670143779: Refs #30518 + Refs #30054; PR2 (getDiscovery, findData, Fixes #30518) follows on the same claim. Not governed. Every file is on the amended claim surface: the codemod, six facet modules, protocol-host.ts, protocol.ts, the pin test's docblock sentence, the registry, one changeset.
  • Premise measured: the refusal the card records ("refuses its own output") is what the new --members pass answers; 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's eight rows citing it were on main.
  • Gates: check-runs on this head read by the seat: 35 success, 13 skipped, 0 failed or pending. Dev: codemod self-test 85/85, undo proof 6/6 byte-for-byte (checkMove 6/6), public index.d.ts / index.d.cts byte-equal (ruling 6624345766's bar met with room), typecheck 0, package suites pass, facade gate negative control exit 1, head exit 0; dispatch-gates 77 of 78 exit 0, 1 NOT-MEASURED (whole-tree CJS build, covered by CI's build).
  • Spot checks: protocol.ts hunks are one-line delegations to the five facets plus host entries for the private helpers the moved bodies call; registry: six rows deleted, getDiscovery and findData re-pointed from #30054 to #30518 with reasons naming PR2 (ruling 6624345766 item 3 holds: every remaining row names its card).
  • Changeset: '@objectstack/metadata-protocol': patch, source moved inside a published package, Clause-②: no, Metadata-protocol: none.
  • Out of scope: none.
  • Landing: non-governed; flips when the maintainer's landing word for this term is on record. PR2 starts after this merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant