Skip to content

Commit 3f76d83

Browse files
committed
refactor(metadata-protocol): move getDiscovery and findData into their 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
1 parent b618224 commit 3f76d83

11 files changed

Lines changed: 1359 additions & 1265 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
refactor(metadata-protocol): `getDiscovery` and `findData` hand their bodies to their facets
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- The last two `ObjectStackProtocolImplementation` doors that #30054 typed keep their signature and docblock on the class and delegate in one line to `ProtocolDiscoveryAndBasesFacet` and `ProtocolDataCrudFacet`, which now hold the bodies, moved unchanged. The built `index.d.ts` and `index.d.cts` are byte-equal before and after, and no behaviour changes. Nothing to do on upgrade.

‎docs/qa/platform-checklist/areas/api-backend.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@
525525
"source": [
526526
"packages/spec/src/data/filter.zod.ts#AST_OPERATOR_MAP (AST_OPERATOR_MAP / FieldOperatorsSchema — the operator variant source)",
527527
"packages/spec/src/data/query.zod.ts#QueryAST (QueryAST keys)",
528-
"packages/metadata-protocol/src/protocol.ts#UNSUPPORTED_QUERY_PARAM (supported $-params + UNSUPPORTED_QUERY_PARAM #2926 ⑩, INVALID_FIELD #4134)",
528+
"packages/metadata-protocol/src/protocol-data-crud.ts#UNSUPPORTED_QUERY_PARAM (supported $-params + UNSUPPORTED_QUERY_PARAM #2926 ⑩, INVALID_FIELD #4134)",
529529
"packages/spec/src/data/filter.zod.ts#checkFilterConditionComparands (the request-schema refusal of a scalar list comparand on the POST door, #20116 — the $-object spelling, located at query.where.<field>.$nin)",
530530
"packages/spec/src/data/data-engine.zod.ts#lowerFoldedTransportValues (the AST/FilterArray spelling on the POST door, refused at query.where when it cannot be lowered)",
531531
"packages/spec/src/data/data-engine.zod.ts#QueryTransportParamsSchema (`filter` is a declared transport spelling of `where` — why negative[0] no longer probes with it)",

‎docs/qa/platform-checklist/areas/search.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
"examples/app-showcase/src/security/permission-sets.ts#invoice_own_rows (invoice_own_rows: owner == current_user.email, positions ['contributor'])",
283283
"examples/app-showcase/src/data/seed/index.ts (INV-1001..1012 owner spread; 'ada sees INV-1001/1002's lines but never linus's INV-1003')",
284284
"packages/objectql/src/engine.ts#expandSearchOnAst (expandSearchOnAst ANDs into ast.where; count() rides the read middleware — the #2737 total-leak fix)",
285-
"packages/metadata-protocol/src/protocol.ts#findData (the paged arm counts a searched list: engine.count is handed the query's search and searchFields, so total is the counted number of matches and hasMore agrees with it; the `countable` exception and its page-local estimate were deleted by #22790, PR #22857) + packages/rest/src/list-search-total-door.test.ts ('[#22790] a paged search reports the counted total', including 'a member counts only the matches it can read')"
285+
"packages/metadata-protocol/src/protocol-data-crud.ts#findData (the paged arm counts a searched list: engine.count is handed the query's search and searchFields, so total is the counted number of matches and hasMore agrees with it; the `countable` exception and its page-local estimate were deleted by #22790, PR #22857) + packages/rest/src/list-search-total-door.test.ts ('[#22790] a paged search reports the counted total', including 'a member counts only the matches it can read')"
286286
],
287287
"history": [
288288
{ "revision": 1, "date": "2026-08-07", "change": "new item: RLS × $search both-personas contract; total-leakage clause grounded in the protocol's page-local total for searched lists and the #2737 count middleware fix, persona provisioning gap recorded honestly", "ref": "claude/platform-test-checklist-ocwugl" },

‎packages/metadata-protocol/src/protocol-data-crud.ts‎

Lines changed: 787 additions & 2 deletions
Large diffs are not rendered by default.

‎packages/metadata-protocol/src/protocol-discovery-and-bases.ts‎

Lines changed: 531 additions & 4 deletions
Large diffs are not rendered by default.

‎packages/metadata-protocol/src/protocol-host.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,19 @@ export interface ProtocolHost {
6161
readonly applyRemoteMetadataMutation: ObjectStackProtocolImplementation['applyRemoteMetadataMutation'];
6262
readonly applySeedBodies: ObjectStackProtocolImplementation['applySeedBodies'];
6363
readonly artifactLockLayerAt: ObjectStackProtocolImplementation['artifactLockLayerAt'];
64+
readonly assertAggregationFieldsExist: ObjectStackProtocolImplementation['assertAggregationFieldsExist'];
6465
readonly assertExpandTargetsExist: ObjectStackProtocolImplementation['assertExpandTargetsExist'];
66+
readonly assertFilterFieldsExist: ObjectStackProtocolImplementation['assertFilterFieldsExist'];
67+
readonly assertGroupByFieldsExist: ObjectStackProtocolImplementation['assertGroupByFieldsExist'];
6568
readonly assertLockAllowsDelete: ObjectStackProtocolImplementation['assertLockAllowsDelete'];
6669
readonly assertLockAllowsWrite: ObjectStackProtocolImplementation['assertLockAllowsWrite'];
70+
readonly assertNoInternalFieldEvaluated: ObjectStackProtocolImplementation['assertNoInternalFieldEvaluated'];
6771
readonly assertObjectRegistered: ObjectStackProtocolImplementation['assertObjectRegistered'];
6872
readonly assertProjectionFieldsExist: ObjectStackProtocolImplementation['assertProjectionFieldsExist'];
73+
readonly assertQueryParamsAreFields: ObjectStackProtocolImplementation['assertQueryParamsAreFields'];
6974
readonly assertRuntimeAuthoringRules: ObjectStackProtocolImplementation['assertRuntimeAuthoringRules'];
75+
readonly assertSearchFieldsAreSearchable: ObjectStackProtocolImplementation['assertSearchFieldsAreSearchable'];
76+
readonly assertSortFieldsExist: ObjectStackProtocolImplementation['assertSortFieldsExist'];
7077
readonly assertVersionMatch: ObjectStackProtocolImplementation['assertVersionMatch'];
7178
readonly authoredLockFamily: ObjectStackProtocolImplementation['authoredLockFamily'];
7279
readonly authoringChannel: ObjectStackProtocolImplementation['authoringChannel'];
@@ -231,6 +238,7 @@ export interface ProtocolHost {
231238
readonly saveMetaItem: ObjectStackProtocolImplementation['saveMetaItem'];
232239
readonly saveMetaItemUnaudited: ObjectStackProtocolImplementation['saveMetaItemUnaudited'];
233240
readonly saveWriteBinding: ObjectStackProtocolImplementation['saveWriteBinding'];
241+
readonly searchAll: ObjectStackProtocolImplementation['searchAll'];
234242
readonly seedExternalIdSaveRefusal: ObjectStackProtocolImplementation['seedExternalIdSaveRefusal'];
235243
readonly servedExpand: ObjectStackProtocolImplementation['servedExpand'];
236244
readonly servedLockState: ObjectStackProtocolImplementation['servedLockState'];

‎packages/metadata-protocol/src/protocol.query-transport-dialect.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ function resolveCanonical(name: string): string {
212212
// ---------------------------------------------------------------------------
213213

214214
describe('[#16066] §3 the single source is the spec export', () => {
215-
const source = readFileSync(resolve(HERE, 'protocol.ts'), 'utf8');
215+
// [#30518] `findData`'s body moved to its facet (`protocol-data-crud.ts`),
216+
// so the call site is read there; the class stays read for a local table.
217+
const source = ['protocol.ts', 'protocol-data-crud.ts'].map((f) => readFileSync(resolve(HERE, f), 'utf8')).join('\n');
216218

217219
it('no local `WIRE_QUERY_ALIAS_SLOTS` / `WIRE_DOLLAR_ALIASES` declaration survives', () => {
218220
expect(source).not.toMatch(/(?:const|let|var)\s+WIRE_QUERY_ALIAS_SLOTS\b/);

0 commit comments

Comments
 (0)