Repository navigation
fix(metadata-protocol): move findData into its facet; host-split refuses a method read as a value, so getDiscovery stays - #30838
Conversation
…r facets with codemod-split-protocol --members Written by `node scripts/codemod-split-protocol.mjs --members getDiscovery,findData --write` and re-proved by `--members --verify --base`. Their last two facade-registry rows are dropped. findData's path reader (protocol.query-transport-dialect.test.ts) now reads the data-crud facet too, where the fold's call site moved. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cweKLi1i8z12wPbsnw
📓 Docs Drift CheckThis PR changes 2 package(s): 35 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 171 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 cbd7280421322b41f0393224d7a1e08e740883a3 && git checkout cbd7280421322b41f0393224d7a1e08e740883a3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 042efb7f12e935c913d1d6e323d2101827c78998 0df9bd1d34653363a81ac162fa66916ec2dafde7 && git checkout -B drift-repro 042efb7f12e935c913d1d6e323d2101827c78998 && git merge --no-ff 0df9bd1d34653363a81ac162fa66916ec2dafde7
node scripts/docs-audit/affected-docs.mjs --json 042efb7f12e935c913d1d6e323d2101827c78998
|
… ledger citations Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cweKLi1i8z12wPbsnw
… a value; getDiscovery stays on the class A host entry forwards a method through a closure that is always a function, so getDiscovery's moved `typeof host.searchAll === 'function'` probe answered true for a protocol without searchAll. host-split.mjs now refuses a method read other than as a callee, as it does for a private static; getDiscovery stays, named under #30147 in the facade registry, and only findData moves. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cweKLi1i8z12wPbsnw
|
domain:devx#3 · os-elon-musk · session_016WV4cz3RTQjLh7hZBLzgtZ 席位核对 · ACCEPT ·
|
Requested by Elon · project thread
Fixes #30518
Refs #30054
Refs #30147
Clause-②: no
Metadata-protocol: none
维护者速读
--members把findData的方法体搬进ProtocolDataCrudFacet,删掉它的门面例外登记;host-split.mjs新增一条规则:实例方法若不是被调用、而是当作值读取,就拒绝搬移;getDiscovery因此留在类上,登记行改挂 Facade codemods: retire the codemod-limit exception rows in the facade gate registry (protocol.ts, engine.ts, sql-driver.ts) #30147。getDiscovery,但它用typeof this.searchAll === 'function'算出capabilities.search;搬走后宿主条目是一个转发闭包,永远是函数,于是不能搜索的协议也会宣称可以搜索(rest 的discovery-search-capability-agreement.test.ts抓到)。index.d.ts/index.d.cts前后字节相等;回滚即 revert 本 PR。host-split.mjs新增的 4 行与host-split.test.mjs的两个用例;scripts/facade-delegation-registry.json的 getDiscovery 行;protocol.query-transport-dialect.test.ts的 4 行。node scripts/codemod-split-protocol.mjs --members --verify --base b6182249,预期1 moved method(s) (findData)、退出码 0;node scripts/codemod-split-protocol.mjs --members getDiscovery预期退出码 2,理由为instance method \searchAll` read as a value`。What changes
The move.
findData(751 body lines) now delegates in one line toProtocolDataCrudFacet; its signature and docblock stay on the class.protocol-host.tsgains the eight entries its body reads (searchAlland sevenassert*field guards).protocol.tsgoes from 13,775 to 13,007 lines and drops 28 import bindings only the moved body read. Written bynode scripts/codemod-split-protocol.mjs --members findData --write, no hand edit after it. Its registry row leaves.The rule.
host-split.mjsrefuses an instance method read other than as a callee (typeof this.m,const f = this.m): a host entry forwards a method through a closure, which is always a function, so the moved read would see the closure, not the instance's member. This mirrors the rule it already had for a private static method read as a value.host-split.test.mjsgains two refusal cases (thegetDiscoveryprobe shape and a plain value read); both fail without the rule. Over the first pass's own--verify --base 48914fdc^, the rule changes exactly one member's verdict,getDiscovery.getDiscoverystays. Its body setscapabilities.searchfromtypeof this.searchAll === 'function'(#7541). The first version of this PR moved it, andpackages/restdiscovery-search-capability-agreement.test.tswent red (2 of 4): a protocol that shadowssearchAllwithundefinedadvertised search while/searchanswered 501. Its row returns toscripts/facade-delegation-registry.jsonunder #30147 (the codemod-limit rows card), with that reason; theliveness/qa.jsoncitation stays onprotocol.ts#getDiscovery.The path reader.
protocol.query-transport-dialect.test.ts("the fold names the spec export at the call site") readprotocol.tsby path forfindData's call site; it now readsprotocol.tsandprotocol-data-crud.tsjoined.The citations that moved with the body:
packages/spec/liveness/query.jsonanddocs/qa/platform-checklist/areas/search.json(protocol.ts#findData->protocol-data-crud.ts#findData), anddocs/qa/platform-checklist/areas/api-backend.json(protocol.ts#UNSUPPORTED_QUERY_PARAM->protocol-data-crud.ts#UNSUPPORTED_QUERY_PARAM, a string token insidefindData's body thatcheck-platform-checklist.mjsreported as ABSENT SYMBOL).Why
#30054 spelled the eight doors' return types (PR #30516) so their bodies could leave the facade; #30518 asked for the pass that moves them. PR #30687 added the pass and moved six; this PR moves
findDataand closes #30518 withgetDiscoverya named codemod-limit exception carried by #30147.Tests
--members --verify --base b6182249at0df9bd1d: exit 0, 1 moved,checkMove1/1.--members getDiscovery: exit 2 with the new reason.node scripts/codemod-split-protocol.mjs --self-test: 85 cases in 10 batteries pass.host-split.test.mjs: 40 pass; 2 fail with the rule removed (negative control).@objectstack/metadata-protocolat0df9bd1d: vitest 320 files passed, 4 skipped; 22,487 tests passed, 26 skipped.typecheckexit 0.packages/restdiscovery-search-capability-agreement.test.ts: 4/4 at0df9bd1d(2/4 at946d40b7). Fullpackages/restlocally: 12 failures, all_migrate-record-currency-codesrows ofrest-write-route-hook-refusal-sentence.ledger.test.ts, the same 12 with this PR'ssrcreverted (a local build artifact of feat(rest, client): a tenant-admin REST door for the record-currency code backfill #30809's packages; CI's verdict on the new head decides).check:livenessexit 0 and its tests (359) pass;check:platform-checklistexit 0;check-facade-delegation-only.mjsexit 0 (46 named exceptions).Verification
Declaration files
pnpm --filter @objectstack/metadata-protocol buildat baseb6182249and at0df9bd1d:dist/index.d.tsanddist/index.d.ctscmpbyte-equal (sha2565cf3216a10daa533…on both sides).dispatch-gates
node scripts/pm/dispatch-gates.mjs --commandsat0df9bd1d: 80 families derived, all 80 exit 0 (exit codes captured before any pipe).--ran: 80 derived, 80 run, 0 NOT-MEASURED, 0 UNRUN.Changed lines
1,626 changed lines (+834 / −792, 11 files, changeset included), under the 3,000 budget.
Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code