Repository navigation
Commit 0b788da
feat(spec): declare the query transport dialect as the flattened spelling of the QueryAST (#18704)
Fixes #16066
Clause-②: yes (widening)
Authored by Claude Code, session
https://claude.ai/code/session_01LvwGppdonww4zGLWZo5rho
The `findData` slot declared one query dialect and accepted two.
`FindDataRequestSchema.query` was `QuerySchema` — the canonical QueryAST
— while the shipped door also folded `$filter` / `$top` / `$skip` /
`$orderby` / `$select` / `$expand`, the plural `filters` and the bare
aliases `filter` / `select` / `sort` / `skip` / `populate`, from a table
that lived module-private inside `@objectstack/metadata-protocol` and
whose own comment called them "the wire-only spellings no schema
declares". Two dialects, one slot, one of them declared: unverifiable at
build time, unrejected at runtime.
Director seat ruling, decision batch #129 item 4 (2026-09-13, comment
5651810333). Maintainer, verbatim: 「你是项目总监,9306
这种为什么你不直接决策呢?而且不是说要以协议为准吗?还需要立卡问 spec 多次一举啊。这个也需要更新skills。其他同意。」 —
「其他同意」 covers this card.
## What landed
**1. `packages/spec` declares the transport dialect, once.** In
`src/data/data-engine.zod.ts`, beside `RPC_QUERY_ALIAS_SLOTS` — "the ONE
place the alias to canonical mapping is declared":
| export | what it is |
|---|---|
| `QueryTransportParamsSchema` + `QueryTransportParams` /
`QueryTransportParamsParsed` | every spelling the tables name that is
not itself a QueryAST key, each carrying the value set the canonical
slot serves |
| `QUERY_TRANSPORT_ALIAS_SLOTS` | `RPC_QUERY_ALIAS_SLOTS` extended with
the transport-only spellings (`filters`/`$filter` onto `where`,
`$expand` onto `expand`) |
| `QUERY_TRANSPORT_DOLLAR_ALIASES` | the `$`-to-bare pairs that fold in
two hops (`$top` onto `top` onto `limit`) |
| `QUERY_TRANSPORT_DOLLAR_PARAMS` | the `$` set a boundary quotes when
it refuses an undeclared one |
| `QueryWithTransportSchema` + `QueryWithTransport` /
`QueryWithTransportParsed` | the query slot itself: input is the AST or
its transport spelling, output is the AST plus the `count` flag |
9 exports added, 0 removed (`api-surface/data.json`). `top` is the one
alias the tables name that the transport schema does NOT declare:
`BaseQuerySchema` already carries it beside `limit`, and re-declaring it
would widen a canonical member rather than a transport one.
**2. `FindDataRequestSchema.query` is that slot.** `z.input` admits the
canonical AST, the transport spelling, or a bag carrying both.
`z.output` is `QueryAST & { count?: boolean }`, and it is CONSTRUCTED
rather than asserted: the fold's result is parsed by the AST schema and
that parse's result is what leaves the transform. Prime Directive #12 is
kept the way the ruling specifies — the transport form is the FLATTENED
SPELLING of the same AST with a 1:1 alias table, never a second
semantics — so `QuerySchema` itself is untouched and still drops a `$`
key as unknown. The hint table in `metadata-protocol`
(`QUERY_PARAM_NEAR_MISS`) is untouched and still accepts nothing as
input.
**3. `metadata-protocol` folds by the spec export.**
`WIRE_QUERY_ALIAS_SLOTS` / `WIRE_DOLLAR_ALIASES` are gone; the
`UNSUPPORTED_QUERY_PARAM` refusal now quotes
`QUERY_TRANSPORT_DOLLAR_PARAMS` instead of a hand-copied sentence.
**4. `scripts/check-filter-alias-parity.mjs` follows the hoist.** Its
own header named this hoist as the open option and said the script "can
be deleted rather than migrated" once BOTH sides derive. Only one side
does: `packages/rest`'s `FILTER_SLOT_QUERY_PARAMS` still names `filters`
/ `$filter` literally, so the drift the gate exists for is still
reachable and the gate was **re-pointed, not deleted** — its readers now
read the spec file. Self-test green (7 batteries), gate green over the
real tree: `4 transport spelling(s) of the 'where' slot, identical on
both sides`.
## The dropped-refinement ledger, declared
1 parent b0b5f31 commit 0b788da
21 files changed
Lines changed: 1809 additions & 171 deletions
File tree
- .changeset
- content/docs/references
- api
- data
- docs/audits
- packages
- metadata-protocol/src
- rest/src
- spec
- api-surface
- authorable-surface
- declaration-map
- export-origins
- json-schema.manifest
- src
- api
- data
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
867 | 867 | | |
868 | 868 | | |
869 | 869 | | |
870 | | - | |
| 870 | + | |
871 | 871 | | |
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
878 | | - | |
879 | | - | |
| 878 | + | |
| 879 | + | |
880 | 880 | | |
881 | | - | |
| 881 | + | |
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
893 | 909 | | |
894 | 910 | | |
895 | 911 | | |
| |||
0 commit comments