Repository navigation
fix(core): drill a relationship path as one nested-relation condition, pushed down by the server - #35423
Conversation
convertFiltersToAST lowers the spec's nested-relation form (a plain object with no `$` key beneath a field) to one equality node that parseFilterAST reads back as the nested condition. resolveDatasetDrillFilter writes a relationship-path dimension as that condition, one level per hop, instead of reading related ids on the client, so the server matches it with an in-database subquery. The id cap and the too-many answer are no longer produced; the exports stay, deprecated. Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB Co-authored-by: Claude <noreply@anthropic.com>
…sted-relation-filter-node
…pec predicate to the driver Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB Final head for review · area data-2 · 2026-11-19T09:22Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head
|
… as Clause-② yes L1-a ACCEPT 7005070933: convertFiltersToAST is a published @object-ui/core export and now accepts the nested-relation map it refused, so the declaration is a widening. Metadata-protocol stays none; level stays patch. Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgmentsRead against the net diff
② Semver level
③ Boundary flags
S1 (should-fix) — the widened node reaches Implemented-by: VERDICT: PASS |
…T arm by name
convertFiltersToAST now lowers { rel: { field: value } } to
['rel', '=', { field: value }]. The in-memory matcher's object arm already
refused the nested condition by name; its AST arm compared the condition
object by reference, so `=` matched no row in silence and `!=` matched
every row. matchesComparisonNode now gives a comparand that is a non-empty
object with no `$` key the object arm's refusal, through one shared
sentence builder, for every operator that reads the comparand.
Also adds the nested-relation row to the data-objectstack README lowering
table and extends the existing changeset's prose.
Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgmentsThis is a delta record on contract review 7005257036 (head S1 of record 7005257036 is closed.
The shared builder keeps both lines byte-identical.
The delta narrows a published accept set.
Nothing else moved.
② Semver level
③ Boundary flags
M1 (must-fix) — the declaration under-states the diff.
The alternative is to scope the refusal to S1 of record 7005257036 — closed on Implemented-by: VERDICT: FAIL |
The AST-arm refusal in ValueDataSource turns a comparison whose comparand is a plain object with no `$` key from served rows into a refusal under `!=`, `not_contains` and the ordering operators. That narrows the accept set of a published @object-ui/core export, so the changeset's direction line reads `Clause-②: yes (narrowing)` (the converter half widens), and it gains a BREAKING paragraph with its FROM / TO mapping and one ADR-0087 `not-required (no-migration-prescription)` disposition. The level stays patch and `Metadata-protocol: none` stays: no form an author can save changes, since the spec's comparand door already refuses that comparand. Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgmentsThis is a whole-PR record on the narrowing face. It reads the net diff of Widening:
Round trip with the spec's
Where the widened node goes, by code reading.
Narrowing:
Tests. The cap leg and the empty- ② Semver level
③ Boundary flags
④ Design judgmentThe narrowing makes the spec's refusal real; it takes no declared capability away. The spec accepts six comparand types and two The widening closes the gap the card was filed for. The spec declares form 4, the engine serves it, and the client refused to send it. That was the implementation gap, and it is implemented here at the one lowering door rather than worked around at the drill. The bounded Prime Directive 5 exception (ruling 6961225798) is retired with its docblock, and the old two-step is not kept behind a flag. Tried and held.
S2 (should-fix) — the AST refusal takes more than the plain object the changeset declares.
Nits (no effect on correctness or the contract of this PR; none holds it):
Out of the diff, for cards (read, not reviewed; neither is graded on this PR):
M1: closed M1 (record 7006192304) is closed on this head: both declaration lines read Implemented-by: VERDICT: PASS |
…tion comparand nestedRelationComparandKey now treats an AST comparand as a nested relation condition only when it is a plain object (prototype Object.prototype or null) with no $ key, the spec's own filter-structure test. A class instance with keys of its own (a moment, luxon or decimal object) is a value again: under an ordering operator it compares through its valueOf instead of being refused with the nested-relation sentence. Pins: the not_contains and > refusal legs beside = and !=, and CONTROL legs for a valueOf-bearing class instance under > and < and for a Date under >. The changeset names the exact refused population, and a stale comment in queryDataset.test.ts no longer says a path dimension is resolved through the related ids. Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgmentsThis is the delta record for the narrowing-face review of What the head is.
The predicate,
The pins.
The changeset.
② Semver levelUnchanged by the delta, and still right.
③ Boundary flags
④ Design judgmentThe fix is the first of the two S2 offered, and it is the right one. The refusal now takes exactly the population the changeset declares and the spec calls filter structure. A class instance is data on every face of the platform: the spec's filter walk reads it as data, not structure, and the engine's door does not judge it. The value source no longer calls a date a relation, and the object dialect and its lowered node agree on it again. The narrowing still makes the spec's refusal real and still takes no declared capability away. Tried and held.
No must-fix, no should-fix. Nits (no effect on correctness or the contract of this PR; none holds it):
S2: closed Record 7008152912 raised S2; it is closed on this head by the prototype test and its two CONTROL legs, with the changeset stating the carve-out. M1, raised by record 7006192304, and S1, raised by record 7005257036, stay closed as record 7008152912 found them. What M1 asked of the battery is now recorded with counts in os-dev-report 7011424436; the two things the landing gate still needs are in ③ and are a body edit and a comment. Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB Landing · area data-2 · 2026-11-19T14:34Z
State: draft → ready + auto-merge (merge queue). #34990 closes on merge via |
Fixes #34990
Part of #35447
Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: follow-up #35481
维护者速读
What changes
convertFiltersToAST(@object-ui/core) now lowers the nested-relation form the spec already declares onFilterCondition(form 4:{ account: { owner: 'u1' } }, a plain object with no$key beneath a field) to one equality node,['account', '=', { owner: 'u1' }]. The spec'sparseFilterASTreads that node back as the same nested condition, which the server serves. It used to refuse the shape as an unknown operator. The recognised population is the engine's ownisNoOperatorObject(no$key), so client and server name one shape; a map that mixes$operators with plain keys is still refused. Nothing on the client judges the inner condition: whether the field is a relationship is decided by the server, which refuses anything else withINVALID_FILTER/ 400. The engine-internal semi-join leaf (ADR-0139 / ADR-0155) is never spelled.resolveDatasetDrillFilter: the two-step is removed. A relationship-path dimension (account.owner, up to ADR-0071's three hops) now drills as one nested condition, one level per hop ({ account: { parent: { kind: VALUE } } }), instead of reading up to 200 related ids per hop and filtering on$inthem. No related record is read and nothing is capped. Unchanged: the per-hop schema read that confirms each hop is a single-valued relationship, the hop limit, the empty-bucket refusal, and the plain-dimension-on-the-relationship-field case (it becomes anidkey inside the nested condition).DATASET_DRILL_RELATED_ID_CAPand thetoo-manymember ofDatasetDrillResolutionare no longer produced. They stay exported, marked@deprecated, because removing them is a narrowing of@object-ui/core's published surface and their consumers (the drawer'stoo-manynotice and its locale strings) sit outside this claim's file surface (see Acceptance notes).Tests
At head
0ff1d0ab(origin/main0967cbe6merged; the incoming commits touch none of the packages below).dba9da83adds one comment-only commit restoring the objectstack#17469 citation the plugin-detail pin requires;a7203afachanges only the changeset'sClause-②line.pnpm --filter @object-ui/core test: Test Files 243 passed (243), Tests 4482 passed, 27 skipped.pnpm --filter @object-ui/core type-check: exit 0.pnpm --filter @object-ui/plugin-dashboard --filter @object-ui/plugin-report type-check: exit 0.filter-converter.test.tsgains a top-leveldescribe('the nested-relation node (objectstack#34990)')(lowering + spec round trip, a deeper relation with inner operators, beside plain keys and under$or, CONTROL mixed map refused withINVALID_FILTER/400 namingowner/account, CONTROL operator map and empty map unchanged).dataset-drill-relationship-path-34907.test.tsthe 1-hop/2-hop/id-cap/empty-$inlegs became 1-, 2- and 3-hop nested-condition legs with zerofindcalls, a drawer-lowering leg (convertFiltersToAST+parseFilterASTround trip), the shared-hop leg and a plain-dimensionidleg; inDatasetWidget.test.tsxthe first leg and thetoo-manynotice leg; inDatasetReportRenderer.test.tsxthe first leg. Hop-limit, unknown/multi-valued relationship, empty bucket, CONTROL single-object drill and builder refusal legs are unchanged.Ablation (one per changed behaviour, each via scripts/ablation-replace.mjs, restored blob == HEAD and git diff HEAD empty)
if (isNestedRelationCondition(...))toif (false && ...), anchor 1 to 0, blob 53704b04 to d69c22c6): 5 failed / 23 passed, each failureUnknown filter operator 'owner'/'owner_id'/'parent'; restored to 53704b04.{ $in: [] }(blob 8c335150 to 2783b612): 6 failed / 3 passed in the 34907 file; restored to 8c335150.Both suites import the module under test from source by relative path, so no dist leg applies.
Acceptance notes
exactRecordListFilter(app-shell) offers the escape hatch only for a filter the list page'sfilter[...]URL dialect writes exactly; that dialect has no spelling for a nested condition, so it answersnulland the drill stays in the drawer (code reading of its operator loop, not a browser run). Under the two-step a drill with at most 200 related ids could escalate throughfilter[account][in]. Seat 5 picked A (seat note on filter grammar: a client node for the nested-relation form, so a dataset drill-through pushes one nested condition down instead of the bounded two-step id resolution (exit for #34907's PD5 exception) #34990): ship as is; the URL spelling is Dashboard drill: give the list URL a nested-relation filter spelling so a relationship-path drill can offer Open in list #35438.too-manyarm inDatasetWidget.tsx/DatasetReportRenderer.tsx, the'too-many'entry ofDrillDownDrawer's notice table and its locale strings, plus the deprecated exports above, are now unreachable. Removing them narrows a published export; triage closed that card (Dashboard drill: remove the unreachable too-many related-ids notice and DATASET_DRILL_RELATED_ID_CAP (narrowing) #35439) as not planned at first touch (7005794295): the removal rides the next major that narrows@object-ui/coreexports.ui/packages/data-objectstack/src/queryDataset.test.ts("resolved through the related ids first") is corrected fromb950ae60.afterFindhook, another datasource, a federated object), it reads the related ids itself under its 1,000 cap and refuses past it withINVALID_FILTER/ 400; the drawer then shows its localized load-failure sentence. That is the server's documented behaviour, not a client bound.Verification
A1: the server takes the client's wire spelling and pushes it down (SQLite, real engine, throwaway test, not committed)
Real
ObjectQL+SqlDriver(better-sqlite3) +SecurityPlugin+RestServer,GET /api/v1/data/:objectwith?filter=set to the AST JSON the client sends, knex query log captured:['owner','=',{region:'NA'}]: 200, ids d1, d3; 1 statement: select from the ledger where owner in (select id from the owner table where region = ? and the owner's row-scope predicate).['ledger','=',{owner:{region:'NA'}}](two hops): 200, id n1; 1 statement with two nested in-subqueries, each carrying its object's row scope.['and',['id','!=','zz'],['ledger','=',{title:'a',owner:{region:'NA'}}]]: 200, id n1; 1 statement.['owner','in',['u1']]: 200, ids d1, d3; 1 statement with a bound id list.No statement reads related ids before the main read. A2: before this change
convertFiltersToASTrefused the nested form (the converter ablation above shows the refusal text). A3: 7 files, +207 / -128.Gates
Local families: derived with
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat0ff1d0ab(39 commands) and run in full; results are in the report comment on the card.node scripts/pm/overlap-check.mjs:VERDICT clean exit 0before each push. CI-owned families (lint, type-check programs, Test UI) are read from this PR's check-runs.Generated by Claude Code