Repository navigation
refactor(metadata-protocol): spell the inferred return types of the eight protocol.ts doors the facade keeps (.d.ts byte-equal) - #30516
Conversation
…ight protocol.ts doors kept on the facade Claude-Session: https://claude.ai/code/session_01Utp6CXZTh9qvT24wTN6dd6 Co-authored-by: Claude <noreply@anthropic.com>
…ypes Claude-Session: https://claude.ai/code/session_01Utp6CXZTh9qvT24wTN6dd6 Co-authored-by: Claude <noreply@anthropic.com>
… is spelled and why the body stays Claude-Session: https://claude.ai/code/session_01Utp6CXZTh9qvT24wTN6dd6 Co-authored-by: Claude <noreply@anthropic.com>
… types Claude-Session: https://claude.ai/code/session_01Utp6CXZTh9qvT24wTN6dd6 Co-authored-by: Claude <noreply@anthropic.com>
…he seed receipt's landed rows from main Claude-Session: https://claude.ai/code/session_01Utp6CXZTh9qvT24wTN6dd6 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 30 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 11 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 db73d84694c4bdb187b1a73963d1d00506b9be8f && git checkout db73d84694c4bdb187b1a73963d1d00506b9be8f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 455b4f095a1c71252bbebac4e1bc8b43ab9a2dae 1777fb2d2cdf6ff6057a9f53ed1bafb023033809 && git checkout -B drift-repro 455b4f095a1c71252bbebac4e1bc8b43ab9a2dae && git merge --no-ff 1777fb2d2cdf6ff6057a9f53ed1bafb023033809
node scripts/docs-audit/affected-docs.mjs --json 455b4f095a1c71252bbebac4e1bc8b43ab9a2dae
|
|
domain:server#5 · os-bill · session_01Utp6CYVV6fcAQrNTDQRvPb 维护者速读
席位意见:同意落地,作为 #30054 的第一部分。方法体搬进 facet 现在做不了,因为 codemod 不能在已拆好的文件上重跑,已另立工具卡 #30518。 席位核对Head
|
Requested by Bill · project thread
domain:server#5 · os-bill · session_01Utp6CYVV6fcAQrNTDQRvPb
维护者速读
protocol.ts门面上 8 个因返回类型靠推断而留在类上的公开方法(getDiscovery、findData、getData、cloneData和四个*MetaItem)把返回类型写明在签名上,类型逐字取自它今天被推断进的.d.ts;方法体一行未动。.d.ts就会经新位置重新推断(拆分时实测getDiscovery丢过一个@deprecated注释),所以它们只能留在门面上;写明之后类型不再取决于方法体放在哪。index.d.ts/index.d.cts改前改后逐字节相同;只有 source map 随新增行变动。回滚即撤本 PR。packages/metadata-protocol/src/protocol.ts里getDiscovery的新签名(最长的一段),再看scripts/facade-delegation-registry.json改了理由的 8 行。pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.facade-door-return-types.pin.test.ts,预期 9 条全绿;在 main 的protocol.ts上其中 8 条是红的。engine.ts那一半排在 refactor: sweep the #4918as anysites in engine.ts's six erasure-pinned methods so the codemod can move them (about 550 lines) #30055 之后。Part of #30054 (the
protocol.tshalf, step 1 only: the return types are spelled; the bodies stay, and theengine.tshalf is owed. Both are listed under Acceptance notes.)Clause-②: no — the published
index.d.tsandindex.d.ctsof@objectstack/metadata-protocolare byte-equal before and after, so no exported member changes.Metadata-protocol: none
Skills-docs: none — an internal refactor of eight method signatures whose printed types do not change; no skill text names them.
What changes
packages/metadata-protocol/src/protocol.ts. The eight doors the tooling: a structural gate that refuses any method body in a facade file once protocol.ts and engine.ts land in facade form (ruling 6624258595) #30019 gate lists asinferred-return-typeexceptions on card 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 now declare their return type:getDiscovery,findData,getData,cloneData,saveMetaItem,publishMetaItem,rollbackMetaItem,deleteMetaItem. Each type is copied, text for text, from the line the base build printed for that method indist/index.d.ts: the type literals, their docblocks (the@deprecatedongetDiscovery'sapiName, the onespublishMetaItemcarries), the double-quoted string unions and the| undefinedthe printer writes are all kept, so the declaration emit reprints them unchanged. No body, parameter or modifier changes.tsc --noEmitaccepts every body against its spelled type.scripts/facade-delegation-registry.json. The eight rows stay (their bodies are still on the class, and the gate refuses a row whose member is already a delegation). Theirreasonno longer says "stays until the return type is spelled", which is now false; it says the type is spelled and why the body still stays.protocol.facade-door-return-types.pin.test.tsparsesprotocol.tsand requires each of the eight doors to carry a return type annotation, so an edit cannot quietly drop one before a later move would re-infer it.@objectstack/metadata-protocolpatch: the published declarations are byte-equal, but the shipped source maps move with the new lines, so the package's published files do change.Tests
origin/main'sprotocol.ts(restored unstaged, then put back fromHEAD,git diff HEADempty) 8 of 9 fail, one per door.scripts/ablation-replace.mjs):rollbackMetaItem's annotation removed, anchor 1 → 0, blob0a87e4f8→ec11148a; the pin goes 1 failed / 8 passed, namingrollbackMetaItem; restored to theHEADblob withgit diff HEADempty.@objectstack/metadata-protocolfull suite at head1777fb2d2: 317 files passed, 4 skipped; 22,434 tests passed, 26 skipped.pnpm typecheckexit 0. (The same suite ran at63a626492, before the second merge: 316 files, 22,419 tests, all passing.)pnpm lint(eslint . --no-inline-config) exit 0 at63a626492; at head1777fb2d2, eslint--no-inline-configover the two changed source files exit 0.Acceptance notes
scripts/codemod-split-protocol.mjscannot re-run on the landed facade: onorigin/mainit refuses with "protocol.ts already carries [Codemod split: generate the rest of the metadata-protocol protocol.ts split with a deterministic script, verified byte-identical #29985 codemod] stubs: run the script on an unsplit file". Its regenerate-from-base route no longer holds either:--verify --base 48914fdc^(the Codemod split: generate the rest of the metadata-protocol protocol.ts split with a deterministic script, verified byte-identical #29985 split's base) now reports 79/85 moved bodies identical and 71/78 host-split checks passing, because later PRs edited moved bodies in the facet modules (fix(plugin-auth)!: an organization cannot require MFA while two-factor enrollment is off (#30201) #30293, fix(metadata-protocol,rest): a .custom pair's declared override is labelled in the ruled order on every /meta read #30353, fix(metadata-protocol,cli): os migrate packageless-overlays lists a package-less view container cannot_declare, and --apply never attempts it #30380, fix(metadata-protocol): duplicating a package copies a permission set that grants on an optional plugin's object not installed here #30414), and two facet modules gained top-level statements that are not facet methods (PackagedArtifactBaseTypeinprotocol-discovery-and-bases.ts,storedGrantObjectKeysinprotocol-package-commits.ts), which the facade layer's unlift refuses. Moving the eight bodies needs a pass over the landed facade, as the engine codemod has (--scoped,--hand-docs, and refactor: sweep the #4918as anysites in engine.ts's six erasure-pinned methods so the codemod can move them (about 550 lines) #30055's--members). That is an edit toscripts/codemod-split-protocol.mjs, outside this card's file surface; carrier: the seat.protocol.ts(body move):getDiscovery,findData,getData,cloneData,saveMetaItem,publishMetaItem,rollbackMetaItem,deleteMetaItem.engine.ts(types and move, serial behind refactor: sweep the #4918as anysites in engine.ts's six erasure-pinned methods so the codemod can move them (about 550 lines) #30055):registerApp,registerHook,registerDriver,init,triggerHooks,destroy,setDatasourceMapping,getStatus..d.tsprints the signature, not the body. Measured on this branch:origin/maingainedseedApplied.landedon the publish receipt (feat(spec,metadata-protocol): the publish receipt names the rows a seed created and the rows it only matched #30427,a7b8876f5) while this PR was open; the branch's first spelling (copied atc5800818) merged with no conflict, and would have droppedlandedfrom the publishedpublishMetaItemtype. The type was re-copied froma1d0b1ee9's build (commit1777fb2d2), and the proof below is against that base. A later change to what one of these doors returns edits the signature too.packages/objectqlfile changes, so its declaration files are not re-proved here.Verification
Head
1777fb2d2(branch merged withorigin/maina1d0b1ee9), basea1d0b1ee9.Declaration-file proof
origin/maina1d0b1ee9'sprotocol.tsrestored into the merged tree (the merged file differs from it only by the eight annotations),turbo run build --filter=@objectstack/metadata-protocol...,dist/index.d.tsanddist/index.d.ctscopied aside. The eight types were copied from thatindex.d.ts.1777fb2d2:pnpm buildinpackages/metadata-protocol(tsup with DTS, thencheck-dts-emitted: 2/2 declaration files present);cmpagainst the base copies:index.d.tsbyte-equal,index.d.ctsbyte-equal (index.d.tssha256f7c56a2155a2b77a…on both sides).c5800818(byte-equal, sha2562f93f627839cccd7…), before the merge that brought feat(spec,metadata-protocol): the publish receipt names the rows a seed created and the rows it only matched #30427.Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat head1777fb2d2: 69 derived commands (change set: 4 paths, +251 / -16, under the 3,000 threshold). Each was run with its exit code recorded before any pipe; all 69 exit 0.--ranreconciles 69 derived, 69 run, 0 NOT-MEASURED, 0 UNRUN.check-plugin-teardown-shape --self-testneededgit fetch origin 621a4876…first (shallow clone).63a626492(same 69 commands) had 68 exit 0 andcheck:dual-build-cjs-loadsexit 3 (no full workspace build then); at the final head it ran and passed.pnpm check:facade-delegation-only: "5 facade class(es) in 3 file(s) hold delegations only", exit 0; the registry still carries the eight rows.pnpm lintexit 0 at63a626492.Generated by Claude Code