test(db): cover includes query-shape bugs - #1725
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
More templates
@tanstack/angular-db
@tanstack/browser-db-sqlite-persistence
@tanstack/capacitor-db-sqlite-persistence
@tanstack/cloudflare-durable-objects-db-sqlite-persistence
@tanstack/db
@tanstack/db-ivm
@tanstack/db-sqlite-persistence-core
@tanstack/electric-db-collection
@tanstack/electron-db-sqlite-persistence
@tanstack/expo-db-sqlite-persistence
@tanstack/node-db-sqlite-persistence
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/react-native-db-sqlite-persistence
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/tauri-db-sqlite-persistence
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 132 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 3.79 kB ℹ️ View Unchanged
|
This adds three independent recompute-oracle drivers for includes query shapes: join multiplicity, correlation through a joined alias, and nullable
findOne()materialization. Each driver pins a known failure while nearby control cases remain green; this PR changes tests only.Approach
Each case uses the shared trace runner with a small driver for live state and a separate projection that recomputes the expected result from plain model state.
materialize()subquery resolves to[]when its correlation predicate targets a joined alias #1704): materialize a subquery whose predicate targets an alias introduced by an inner join. The known mismatch occurs at checkpoint 0; correlation through the source alias is the green control.findOne()correlation (materialize(q…findOne())resolves tonull, notundefined, when the correlation key is itself null #1706): start with a null correlation key and expectundefined. The known mismatch occurs at checkpoint 0 because the live result containsnull. An unmatched non-null key and a matched key updated to null both remain green, which narrows the defect to rows that start null.The property cases use fixed seeds, 12 runs, and bounded integer or child-count ranges. The nullable driver also gives collection ingestion and the recompute model separate row objects so a live-side mutation cannot alter the expected state.
Key invariants
Non-goals
This PR is intentionally stacked on #1722 (
codex/includes-state-aware-transitions) so reviewers see only the query-shape oracle work.Trade-offs
The three drivers remain local and independent instead of introducing a broader query-shape abstraction. That keeps the failure boundaries readable and this stacked PR small, while the bounded fast-check variants still test that each classification is not tied to one fixture value.
Verification
The combined oracle run passes 52 tests, including the expected-failure classifications.
Files changed
packages/db/tests/query/includes-query-shape-oracle.test.ts— adds the three drivers, their recompute projections, bounded generated variants, and green controls.Refs #1658, #1703, #1704, #1706