Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

oracle-coverage.md

540 lines68.1 KB

1# Oracle coverage and closeout
2​
3Use [Writing reliable oracle tests](oracle-tests.md) when adding or reviewing a
4law. This map identifies existing owners, their judgment, and their limits. It
5is not a claim that every state or every test has been audited.
6​
7The [project glossary](glossary.md) owns terms shared by these executable
8models and their production subsystems. A coverage owner may define narrower
9local terms, but it must not silently rename a production concept.
10​
11## Scope of the oracle repair project
12​
13[Issue #1808](https://github.com/TanStack/db/issues/1808) commissioned a bounded
14portfolio audit and repair. The September 11 inventory contained 329 tracked
15paths: 132 selected/support entries and 197 discovery-tier files. The latter
16received routing recommendations, not 197 full semantic reviews. Focused
17examples, type tests, and host-wiring tests remain useful; converting them all
18to generated tests is not a completion criterion.
19​
20## Literate model audit
21​
22The literate-model pass audits every primary executable owner in
23[Find an owner](#find-an-owner) and every repository file explicitly named
24`oracle` or `property`. Derive that strict inventory from the repository rather
25than copying a count into this document:
26​
27```sh
28git ls-files -co --exclude-standard packages \
29 | rg '/[^/]*(oracle|property)[^/]*$' \
30 | sort -u
31```
32​
33The command includes tracked and untracked package files so an in-progress
34audit cannot hide a new owner. A surface is complete only when each primary
35owner states its contract, model, history grammar, production driver, and
36refinement check—including its public observations and checkpoint—in the
37executable file. Focused regressions outside that inventory may remain short,
38but a file named `oracle` or `property` cannot use that allowance to omit the
39literate structure.
40​
41The pass must not change product behavior. If clearer prose exposes a missing
42model rule or assertion, strengthen the oracle and run it against unchanged
43production first. Track any production failure as separate follow-up work.
44​
45The same pass audits vocabulary. Shared concepts use the production names in
46the project glossary. The audit corrected model prose that collapsed a physical
47acquisition into a request or called an acquisition lease merely a lease.
48Model-only terms such as an appointment ledger or fault tape remain local and
49say what production facts they abstract. This is a semantic review, not a rule
50that test identifiers must copy production's private data structures.
51​
52| Surface | Status | Completed or next owner |
53| --- | --- | --- |
54| Ordered relations and BTree | Complete | The signed top-K relation, BTree/Map refinement model, and DBSP incrementalization laws are literate. |
55| Includes and publication | Complete | The central recomputation model plus cross-formulation, temporal demand, layered publication, Collection facade lifecycle and space bounds, route-context transport, functional projection, query-shape, optimistic, and source-work owners are literate. They keep the architecture document as their contract source. |
56| Collection lifecycle | Complete | The shared logical-owner/acquisition-attempt/sync-run grammar plus mutation admission, lifecycle trace, publication, replay, disposal, and transaction-refinement boundaries are literate. |
57| Paced mutations | Partial | The virtual-clock owner checks queue order, bounded admission, cleanup draining in FIFO/LIFO order at the configured wait, admitted writes after separate Collection cleanup, post-cleanup queue rejection with a disposal reason, pending debounce drain at the last call's quiet edge, pending trailing throttle drain at its regular edge, debounce and throttle edge options including omitted options, immediate rejection of dropped leading-only calls and both-disabled calls, caller-option immutability, and settlement. New debounce/throttle admission after cleanup, failed persistence, and broader generated schedules remain open. |
58| Optimistic state | Complete | The independent base/intent/source-queue graph plus outcome, transaction-payload, and publication drivers are literate. |
59| Drafts and native values | Complete | Native differential behavior, draft change tracking, detachment and its class-instance exception, hostile keys, aliases, cycles, and Map/Set live iteration are literate. |
60| Query DB and observer | Complete | Query-scope row ownership, subset identity and cancellation, failure and recovery, and the per-listener eligibility ledger are literate. |
61| Ordered acquisition | Complete | Exact demand identity, applied settlement, independent pagination recomputation, request work, lifecycle products, replay authority, source-generation readiness, and transaction-refinement abort boundaries are literate. |
62| Indexed predicate filtering | Complete for bounded dotted-path collision | An independent row filter checks direct predicates and public callback predicates for a dotted scalar field beside a nested path, with and without an index. Selected-field ordering checks the same distinction through `$selected`. |
63| Lazy target path identity | Focused compiler boundary | A same-source union/coalesce witness keeps dotted and nested demand paths distinct during target deduplication. |
64| Correlated include path identity | Focused public route-context witnesses | One-level and nested includes keep dotted and nested parent paths, including ancestor aliases, distinct. Conditional result paths receive separate routes. Fixed fixtures cover initial reads and selected source updates; other recursive source forms and arbitrary path segments remain outside this witness. |
65| Join equality and cold acquisition | Complete | Independent cold relational recomputation, acquisition evidence, established equality domains, replacements, and scan/index routes are literate. |
66| Opaque backend pagination | Complete | The full-relation value model plus opaque token, cache generation, publication, browser acquisition, and live-window integration owners are literate. |
67| Electric and TrailBase | Complete | Electric replica and recovery models, installed-SDK HTTP delivery, PostgreSQL serialization, and TrailBase's controlled RecordApi/native-stream lifecycle are literate with their real-provider limits intact. |
68| PowerSync | Complete | Patch conservation, effective-update receipts, metadata and falsey changes, declared-view keys, transformed schema output, logging, cleanup, and native SQLite reach are literate. |
69| SQLite persistence and native hosts | Complete | Persisted hydration/replay and ownership, shared-handle driver transaction laws, OPFS page and diagnostic state machines, and the 113-law native conformance manifest are literate. Native execution remains distinct from registration and shim evidence. |
70| Offline execution | Complete | FIFO retry, scheduler eligibility, leadership replay, transaction settlement, and typed wire serialization are literate. |
71| Frameworks | Complete | Shared live-query and infinite-query models are literate. Each framework keeps its own realm, ownership, and scheduling driver. |
72| Structural values and ordered primitives | Complete | Structural hashing, deep equality, comparison, cursor denotation, index refinement, and query-identity output equivalence are literate. |
73| Boundary refinements | Complete | Cleanup/restart admission, metadata publication, retained state, acquisition cells, D2 source reconciliation, top-K support windows, and nested Query work bounds are literate. |
74| Small structures and test mechanics | Complete | SortedMap, cleanup appointments, and guarded replay are literate. |
75​
76### Recent fix-wave authority inventory
77​
78This inventory records the permanent authority for the September 17 fix wave. It
79distinguishes an executable oracle from a specialized real-provider authority and
80does not award oracle credit for a filename alone.
81​
82| PR | Classification | Permanent authority and campaign |
83| --- | --- | --- |
84| [#1831](https://github.com/TanStack/db/pull/1831) | Explicit oracle | PowerSync's `packages/powersync-db-collection/tests/correctness-oracle.test.ts` crosses real PowerSync receipts and native SQLite behavior. It runs in the package test campaign and the focused `test:oracles` campaign; portable declarations retain compiler authority. |
85| [#1832](https://github.com/TanStack/db/pull/1832) | Equivalent specialized authority | `packages/electric-db-collection/e2e/sql-predicate-semantics.e2e.test.ts` and `packages/electric-db-collection/e2e/subset-sql-acceptance.e2e.test.ts` run through the package's real-provider `test:e2e` campaign. Compiler unit tests are collateral, not substitutes for either service boundary. |
86| [#1833](https://github.com/TanStack/db/pull/1833) | Explicit oracle | `packages/db/tests/query/pagination-oracle.property.test.ts` owns inherited collection collation, actual `item2`/`item10` order, exact request options, hostile lexical/numeric controls, and both scan and auto-index paths. It runs in `@tanstack/db`'s `test:oracles` campaign. |
87| [#1834](https://github.com/TanStack/db/pull/1834) | Explicit oracle | `packages/db/tests/query/cold-join-reconciliation-oracle.test.ts` owns join/predicate equality equivalence across the established value domains, binary/string and nullish controls, replacement histories, raw lazy demand, and scan/auto-index paths. It runs in `@tanstack/db`'s `test:oracles` campaign. |
88| [#1835](https://github.com/TanStack/db/pull/1835) | Explicit oracle | The existing `packages/db/tests/collection-state-retention-oracle.property.test.ts` and `packages/db/tests/optimistic-transaction-oracle.property.test.ts` owners cover separate collection-state and transaction-history laws. Both were already registered in `@tanstack/db`'s `test:oracles` campaign; focused storage/local-only tests remain collateral. |
89| [#1837](https://github.com/TanStack/db/pull/1837) | Explicit oracle | The offline scheduler, leadership replay, and serializer owners cover selective replay retirement, durable per-ID settlement, stale-read fencing, lifecycle recovery, native scalar encoding, and prior wire compatibility. They run in the package test campaign; generated owners expose `OFFLINE_ORACLE_{SEED,PATH,RUNS}` or the scheduler's `TANSTACK_DB_OFFLINE_ORACLE_*` replay interface. |
90| [#1842](https://github.com/TanStack/db/pull/1842) | No shipped-law case | The PR changed only focused observer tests and introduced no production behavior. `packages/db/tests/live-query-observer.test.ts` remains the correct evidence; no synthetic oracle or campaign claim is added. |
91​
92[PR #1816](https://github.com/TanStack/db/pull/1816) preserves existing witnesses,
93repairs false-green assertions and drivers, adds missing histories, and includes
94narrow runtime fixes reproduced by the stronger tests. The later ten-area audit
95found 59 actionable findings or optional suggestions: 46 repaired, one partly
96repaired storage item, nine contract decisions, and three deferred suggestions.
97These are **not counts of production bugs**. The earlier 13-item review is a
98separate ledger, not another 13 unique defects.
99​
100## Find an owner
101​
102Paths below are relative to the repository root. Follow each suite's domain
103comment and the current API/architecture contract before extending its model.
104​
105| Surface | Primary executable owners | Independent judgment and important limit |
106| --- | --- | --- |
107| Ordered relations and BTree | [top-K relation oracle](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/operators/topk-relation-oracle.test.ts), [fractional-index window moves](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/operators/topKWithFractionalIndex.test.ts), [BTree/Map](https://github.com/TanStack/db/blob/main/packages/db/tests/btree-map-oracle.test.ts), [incrementalization laws](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/incrementalization-law.property.test.ts) | Independent ordered relations and cumulative signed output. Top-K consolidation compares same-key values without hashing, including cyclic replacements and fresh transient cancellation. The fractional-index test checks an empty output message for a window move after all rows retract; it does not prove downstream lazy acquisition. Other hash-based operators retain hashing's declared domain. Algebra does not specify client readiness. |
108| Includes and publication | [cross-formulation](https://github.com/TanStack/db/blob/main/packages/db/tests/query/includes-cross-formulation-oracle.property.test.ts), [temporal](https://github.com/TanStack/db/blob/main/packages/db/tests/query/includes-temporal-oracle.test.ts), [Collection includes](https://github.com/TanStack/db/blob/main/packages/db/tests/query/includes-collection-oracle.property.test.ts), [architecture and complete suite map](https://github.com/TanStack/db/blob/main/packages/db/src/query/live/ARCHITECTURE.md#executable-contracts) | Per-parent/flat-join/partition relations, callback-time rows, nested values, and route histories. Fragmented lazy-demand consolidation covers delta growth and successful, rejected/retried, and obsolete replacements at the Collection request boundary; it observes exact key unions and abort checkpoints. A compiled-includes fixture makes adapter unload evict owned child rows and proves a rejected union cannot remove established public child rows. Retry after that terminal live-query failure remains covered at the acquisition boundary; no automatic in-place recovery is claimed. Observe raw promised order; fresh queries do not establish continuous publication safety. |
109| Collection lifecycle | [mutation startup](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-mutation-startup-oracle.test.ts), [change-event history](https://github.com/TanStack/db/blob/main/packages/db/tests/change-event-history-oracle.test.ts), [history](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-subscription-lifecycle-history.property.test.ts), [publication](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-subscription-lifecycle-publication.property.test.ts), [replay](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-subscription-replay-oracle.property.test.ts), [effect disposal](https://github.com/TanStack/db/blob/main/packages/db/tests/effect-disposal-oracle.test.ts), [PR #1902 review](oracle-reviews/pr-1902-change-event-history.md), [batch-order decision review](oracle-reviews/change-event-batch-order.md) | Core Collection `insert`/`update`/`delete` admission while `startSync:false` is idle; complete public-row/change-message agreement across bounded one- and two-key histories plus replayable four-key campaigns; a two-key deferred sync history checks each key's causal insert/update/delete trace while allowing any cross-key interleaving. Reversing all deferred messages fails that check; reversing each sync transaction's distinct-key messages passes. Queued duplicate admission and cancellation, ownership and phase histories, exact caller/error/publication evidence, and late completion and restart have separate witnesses. Generated deferred histories with cancellation or reentrant callbacks need a witness in the change-event history owner before claiming general batch-shape coverage. Query write utilities and effect self-dependent disposal remain separate contracts. |
110| Paced mutations | [virtual-clock oracle](https://github.com/TanStack/db/blob/main/packages/db/tests/paced-mutations-oracle.test.ts) | `createPacedMutations` with queue front/back options, bounded waiting capacity at zero and one, cleanup draining in FIFO/LIFO order after a held write, cleanup timing at the configured wait for immediate writes, admitted writes after separate Collection cleanup, debounce and throttle schedules with explicit and omitted options, and first-leading throttle execution at epoch zero. Finite histories compare optimistic rows, returned transaction identity and receipt outcome, execution order and virtual-clock time. Held writes verify queue serialization. Leading-only throttle and debounce witnesses reject skipped calls immediately with their named dropped-call errors, including omitted edges, both edges disabled, and same-row rollback while a prior write is held. Capacity witnesses cover overflow rejection, distinct-key optimistic rollback, same-key admitted-write survival, and in-flight versus waiting admission. Cleanup witnesses check repeated queue cleanup, eventual admitted receipt settlement, direct queue strategy rejection of new callbacks, public post-cleanup rollback with `QueueDisposedError`, pending debounce transactions that wait until the last call's quiet edge after separate Collection cleanup, and a trailing throttle timer that runs at its regular edge after separate Collection cleanup. Deferred custom queue and batch callbacks check compatibility with `void` and `false` execute results, respectively. Frozen options verify factory non-mutation; a mutable option witness checks that debounce uses its construction-time trailing setting. New debounce/throttle admission after cleanup, failed persistence, broader capacities and schedules remain outside this owner. |
111| Optimistic state | [history model](https://github.com/TanStack/db/blob/main/packages/db/tests/optimistic-history-oracle.ts), [generated histories](https://github.com/TanStack/db/blob/main/packages/db/tests/optimistic-transaction-oracle.property.test.ts), [truncate capture ownership](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-truncate-ownership-oracle.property.test.ts), [outcomes](https://github.com/TanStack/db/blob/main/packages/db/tests/optimistic-history-outcomes.test.ts), [publication](https://github.com/TanStack/db/blob/main/packages/db/tests/optimistic-history-publication.test.ts) | Independent whole-row snapshots, rollback dependencies, captured truncate ownership, metadata and prior-value events. Never rebase a pending snapshot merely to simplify the model. |
112| Drafts and native values | [proxy](https://github.com/TanStack/db/blob/main/packages/db/tests/proxy.test.ts), [detachment](https://github.com/TanStack/db/blob/main/packages/db/tests/proxy-detachment-contract.test.ts), [iteration](https://github.com/TanStack/db/blob/main/packages/db/tests/proxy-iteration-contract.test.ts) | Native-operation controls, exact patches and actual stored rows; alias/cycle/adversarial-key histories. Set and Map reorder histories check draft patches and stored iteration order after replacement and clear-and-readd; RegExp replacement/reversion histories check `lastIndex`. General native-mutator and symbol-write support is not established by a plain-object oracle. |
113| Query DB and observer | [ownership](https://github.com/TanStack/db/blob/main/packages/query-db-collection/tests/ownership-lifecycle.oracle.test.ts), [load lifecycle](https://github.com/TanStack/db/blob/main/packages/query-db-collection/tests/load-subset-lifecycle-oracle.test.ts), [observer histories](https://github.com/TanStack/db/blob/main/packages/db/tests/live-query-observer-history.property.test.ts) | Real QueryClient boundary, applied-settlement barriers for existing and cached demand, mutation-handler Collection identity, terminal fetch-record lifecycle, and a per-listener eligibility ledger, not a duplicate dispatch queue. The bounded handler grammar crosses insert, update, delete, parameter and mutation-alias access, refetch, and clearError. The mutation overlap grammar crosses both start orders. Check reentry, peer survival, FIFO and disposal independently of final rows. |
114| Ordered acquisition | [pagination](https://github.com/TanStack/db/blob/main/packages/db/tests/query/pagination-oracle.property.test.ts), [ordered work](https://github.com/TanStack/db/blob/main/packages/db/tests/query/ordered-work-oracle.property.test.ts), [ordered lifecycle](https://github.com/TanStack/db/blob/main/packages/db/tests/query/ordered-lifecycle-oracle.property.test.ts), [ordered loader state](https://github.com/TanStack/db/blob/main/packages/db/tests/query/ordered-source-loader-state.test.ts), [graph scheduler](https://github.com/TanStack/db/blob/main/packages/db/tests/query/scheduler.test.ts), [issue #1880 ordered-repair review](oracle-reviews/issue-1880-ordered-repair.md), [issue #1882 custom local collation review](oracle-reviews/issue-1882-custom-local-collation.md), [issue #1898 relation-filter review](oracle-reviews/issue-1898-relation-filter.md), [PR #1909 external review](oracle-reviews/pr-1909-external-review.md) | Complete finite provider results, inherited locale and bounded/unbounded custom collation with exact request options, query-level inheritance across source aliases, real lexical/numeric disagreement, custom comparator ties, scan/index paths, pending windows, ties/nulls, lease ownership, Effect callback gates, including an indexed source update during Effect startup, and documented repair timing. Direct LEFT-joined filters cover local finite prefixes, pending child demand, child removal, and anti-join publication with custom full-source and unindexed fallback loading; unrelated include demand cannot stall the root continuation, and an empty joined replay wakes held Effect callbacks; remote relation hints remain outside this owner. Graph scheduler checks coalescing, dependency order, synchronous loader input, and repeated-alias failure ownership. The ordered-work oracle checks that a synchronous root refill reaches D2 before joined publication; a mutant that omitted the post-loader graph step failed at the second child demand. Custom collation proves local full-source acquisition only; it does not establish provider cursor capability or backend collation fidelity. Sibling-source input during a synchronous ordered continuation returns to graph work before another ordered acquisition. Request completion is not proof of unrequested source extent. A window move during existing joined demand waits for its root continuation, including an independently held root request; current demand failure rejects the move, while retirement and an obsolete rejection do not. A bounded ordered repair resumes its refill after joined demand settles. The ordered-source-loader state test checks that an explicit failed-request retry blocked by joined demand retains its generation until it can issue a request. Multiple simultaneously pending joined plans during a window move and a public-query failed-retry overlap still need dedicated witnesses. |
115| Indexed predicate filtering | `packages/db/tests/query/index-path-collision-oracle.test.ts` | A bounded cross product of numeric values checks exact public keys before and after adding a nested-field BTree index. Direct predicates vary argument order, bound inclusivity, reversed operands, and bound field. Public Collection subscription and live-query callbacks run with and without the index. Selected-field ordering compares a direct JavaScript sort with a public `$selected` callback; restoring the dotted-key proxy cache made that comparison fail. The original compound grouping failed four indexed cases while scan controls passed. The original callback proxy caches also failed both unindexed public routes. A hostile cleanup control preserves the primary mismatch and secondary release error. Arbitrary path segments, nullish values, custom collation, and incremental publication need separate witnesses if claimed. |
116| Lazy target path identity | `packages/db/tests/query/compiler/lazy-targets.test.ts` | A focused same-source `UnionFrom`/`coalesce` witness requires both [`a.b`] and [`a`, `b`] demand targets. Restoring dotted-string deduplication drops the second target at the compiler boundary. A public on-demand adapter and row-publication history still need a separate witness. |
117| Correlated include path identity | `packages/db/tests/query/includes-context-transport-oracle.test.ts` | A flat parent field and nested parent field reach one-level and nested `toArray` results independently; dotted ancestor aliases remain distinct through a grandchild route. Initial results and parent updates have exact public-value checks. A conditional projection gives [`a.b`] and [`a`, `b`] different include results and checks parent-key changes plus later child inserts. Removing the compiler's unique route-key allocator loses a public child result; restoring dotted-string deduplication at either builder site loses a distinct parent value. These fixed witnesses do not establish arbitrary path segments, every recursive source form, or every materialization form. |
118| Join equality and cold acquisition | `packages/db/tests/query/cold-join-reconciliation-oracle.test.ts` | Independent recomputation for cold acquisition plus direct join/predicate equivalence across established equality domains. Binary/string and nullish classes, replacement histories, raw on-demand values, and both scan/auto-index paths are explicit; compound join syntax is not claimed. |
119| Optimizer aggregate pushdown | `packages/db/tests/query/optimizer-semantics-oracle.test.ts`, [review record](oracle-reviews/2026-09-28-optimizer-aggregate-pushdown.md) | Independent sum recomputation and a materialized-Collection formulation check the first public snapshot of a nested aggregate under a left join. Direct, arithmetic-wrapped, and conditional aggregates distinguish safe from unsafe pushdown; a grouped-key control covers the grouped boundary. The owner does not cover every predicate, wrapper, join type, or incremental update. An inner join with a global aggregate returned no row even without a WHERE clause in the initial probe; that separate path still needs a public witness and owner before claiming optimizer coverage there. |
120| QueryRef operators and user-value boundaries | `packages/db/tests/query/subquery-user-value-oracle.test.ts`, `packages/db/tests/transactions.test.ts` | A finite array/Set model checks the compiled output bag for a joined DISTINCT subquery with an outer WHERE. Live-query drivers check selected containers, no-select, functional, and predicate-literal user objects with IR-like fields, top-level and aggregate-subquery proxy-shaped fields, arrays of selected references, outer virtual-field filters on joined DISTINCT and nested aggregate QueryRefs, and a renamed no-select source. The transaction suite documents the existing development-browser duplicate-load guard. The bounded cases run in `test:oracles` or the full DB suite; they do not establish `singleResult` subqueries, other join forms, source-update histories, or cross-copy value handling outside that guard. |
121| Opaque backend pagination | [window oracle](https://github.com/TanStack/db/blob/main/packages/query-db-collection/tests/cursor-pagination.oracle.test.ts), [cache histories](https://github.com/TanStack/db/blob/main/packages/query-db-collection/tests/cursor-pagination.cache-oracle.test.ts), [cache publication](https://github.com/TanStack/db/blob/main/packages/query-db-collection/tests/cursor-pagination.publication-oracle.test.ts), [browser acquisition boundaries](https://github.com/TanStack/db/blob/main/packages/query-db-collection/tests/cursor-pagination.boundary-oracle.test.ts), [QueryCollection integration](https://github.com/TanStack/db/blob/main/packages/query-db-collection/tests/cursor-pagination.integration.test.ts) | Full filter/sort/slice reference, opaque token transport, actual Query cache expiry/invalidation/GC, forced refresh during growth, protocol failure publication/recovery, bounded slice work, nested cancellation/replacement, reader abort, browser retry defaults, manual-write cache isolation, and production window publications. Stable backend sequences; not snapshot guarantees for changing endpoints. Peek-ahead remains enabled. |
122| Electric and TrailBase | [Electric histories](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/tests/electric-oracle.property.test.ts), [recovery histories](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/tests/electric-recovery-oracle.test.ts), [held resume snapshots](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/tests/electric-resume-snapshot-races.test.ts), [PostgreSQL semantics](https://github.com/TanStack/db/blob/main/packages/electric-db-collection/e2e/sql-predicate-semantics.e2e.test.ts), [TrailBase contract](https://github.com/TanStack/db/blob/main/packages/trailbase-db-collection/tests/ORACLE.md) | Installed SDK delivery/framing, independent predicates, exact subscription arguments, restart/reset lineage, held certification and durability races, source-order publication before durability, and late errors. The queued-presence property runs identical fixed/random generators plus isolated seed-and-path replay across insert, update, delete, and truncate callbacks. The recovery fixtures use a mocked ShapeStream; they do not establish live Electric-service framing or native persistence-host behavior. |
123| PowerSync | [tests](https://github.com/TanStack/db/tree/main/packages/powersync-db-collection/tests), `tests/correctness-oracle.test.ts` | Applied receipt positions crossed with held peers, native SQLite/SDK and cleanup evidence. Run the focused owner with the package's `test:oracles` command. A timeout mutant proves a progress failure, not every value assertion. |
124| SQLite persistence and native hosts | [persisted histories](https://github.com/TanStack/db/blob/main/packages/db-sqlite-persistence-core/tests/persisted.test.ts), [reset/resume histories](https://github.com/TanStack/db/blob/main/packages/db-sqlite-persistence-core/tests/sqlite-core-adapter.test.ts), [dual-adapter resume snapshots](https://github.com/TanStack/db/blob/main/packages/db-sqlite-persistence-core/tests/sqlite-resume-snapshot.test.ts), [Browser composed-owner histories](https://github.com/TanStack/db/blob/main/packages/browser-db-sqlite-persistence/tests/per-collection-coordinator-oracle.test.ts), [Browser coordinator RPC](https://github.com/TanStack/db/blob/main/packages/browser-db-sqlite-persistence/tests/browser-coordinator.test.ts), [shared-driver fairness](https://github.com/TanStack/db/blob/main/packages/browser-db-sqlite-persistence/tests/shared-driver-fairness-oracle.test.ts), [driver contracts](https://github.com/TanStack/db/blob/main/packages/db-sqlite-persistence-core/tests/contracts/sqlite-driver-contract.ts), [Node shared-handle scheduling](https://github.com/TanStack/db/blob/main/packages/node-db-sqlite-persistence/tests/node-driver.test.ts), [OP-SQLite shared-handle scheduling](https://github.com/TanStack/db/blob/main/packages/react-native-db-sqlite-persistence/tests/op-sqlite-driver.test.ts), [browser OPFS lifecycle](https://github.com/TanStack/db/blob/main/packages/browser-db-sqlite-persistence/tests/opfs-page-lifecycle-oracle.test.ts), [worker diagnostics](https://github.com/TanStack/db/blob/main/packages/browser-db-sqlite-persistence/tests/opfs-worker-diagnostics-oracle.test.ts), [Electron IPC and composed owner](https://github.com/TanStack/db/blob/main/packages/electron-db-sqlite-persistence/tests/electron-ipc.test.ts), [113-law manifest](https://github.com/TanStack/db/blob/main/packages/db-collection-e2e/src/fixtures/persisted-conformance-manifest.ts) | Core cache/remote rejection/peer/reopen histories, atomic reset/resume lineage, key-set evidence, dual-adapter races, queued coordinator reload/gap notifications during startup, unscheduled startup/reset overlap, and exact driver results. The shared core-adapter contract checks custom local comparator dispatch for ascending, descending, and comparator-equal public-key ordering at `loadSubset` completion. Host packages register this contract, but the local sqlite3 CLI run does not prove native host execution. Browser composes public source commits with per-collection elected-owner routing and covers the complete committed-transaction wire partition through deterministic Node transport seams. Remote-subset histories distinguish logical demand, physical acquisitions, exact acquisition leases, and released replay tombstones. Electron composes source commits with a per-collection renderer owner, IPC adapter, real SQLite, and reopen checks. The shared-driver fairness owner checks K=1 complete-logical-hydrate scheduling with identical fixed, random, and seed-plus-path campaigns. It records public rows, raw dequeue reach, and a persist-first FIFO hostile control. Its Chromium OPFS fixture refines the provider boundary but does not establish a browser matrix, elapsed-time latency, unbounded eventuality, or multi-process coordination. Same-handle Node and OP-SQLite tests cover transaction admission. Controlled OPFS page/worker histories cover ownership and diagnostic-cause retention. The reset/resume owners use sqlite3 CLI and in-memory node:sqlite seams; they do not prove multi-process WAL, mobile/Tauri, or other native-device execution. Distinct database handles rely on SQLite lock admission rather than one in-process queue. React Native hosts without async-context propagation must use the transaction driver supplied to the callback for nested work. Fake workers and synthetic page events do not prove native handle release or real bfcache admission. The Browser composed seams are not real multi-context/OPFS-worker execution; the Electron harness is not an actual Electron process unless its explicit runtime-bridge mode runs. An ownerless elected node suppresses core routing, while a follower may route demand to the elected owner; host coordinators retry only classified transport or admission failures while demand remains retained. The manifest excludes progressive and move suites; registration and shim runs are not device execution. |
125| SQLite expression-index planning | [Node expression-index oracle](https://github.com/TanStack/db/blob/main/packages/node-db-sqlite-persistence/tests/expression-index-oracle.test.ts) | RFC #1659 invariant 8 owns identical persisted-index and runtime-expression shapes. Independent expected keys are checked against direct captured SQL, adapter results, and named-index plans. Generated BigInts use SQLite's signed range; one fixed case checks legacy oversized-value reads. Other limits: bounded unqualified JSON paths/scalars, Node BetterSQLite, and no null, arbitrary raw SQL, or native-host planning. Run the package's `test:oracles` campaign. |
126| Offline execution | [scheduler](https://github.com/TanStack/db/blob/main/packages/offline-transactions/tests/KeyScheduler.property.test.ts), [leadership](https://github.com/TanStack/db/blob/main/packages/offline-transactions/tests/leadership-replay.property.test.ts), [settlement](https://github.com/TanStack/db/blob/main/packages/offline-transactions/tests/transaction-settlement.property.test.ts), [serialization](https://github.com/TanStack/db/blob/main/packages/offline-transactions/tests/transaction-serializer.property.test.ts) | Declarative FIFO eligibility, per-transaction outcomes, durable state and typed wire trees. Issued work may finish after ownership loss, but new work must not start. Exactly-once network execution is not promised. |
127| Frameworks | [React conformance](https://github.com/TanStack/db/blob/main/packages/react-db/tests/conformance.test.tsx), [React pagination](https://github.com/TanStack/db/blob/main/packages/react-db/tests/infinite-query-conformance.test.tsx), [shared suites](https://github.com/TanStack/db/tree/main/packages/db-collection-e2e/src/suites) | Exact exposed rows/pages and each framework's own lifecycle cuts. A React witness does not prove Vue/Solid/Angular/Svelte scheduling. Preserve their receiving registrations. |
128| Window-controller overlap | [shared infinite-query conformance](https://github.com/TanStack/db/blob/main/packages/db/tests/conformance/infinite-suite.ts), [React driver](https://github.com/TanStack/db/blob/main/packages/react-db/tests/infinite-query-conformance.test.tsx), [Vue driver](https://github.com/TanStack/db/blob/main/packages/vue-db/tests/infinite-query-conformance.test.ts), [Svelte driver](https://github.com/TanStack/db/blob/main/packages/svelte-db/tests/infinite-query-conformance.svelte.test.ts), [review record](oracle-reviews/dec-03-window-overlap.md) | Four or five ordered source rows, two window-settlement orders, and public snapshots after each settlement, a subscribed observer update, a detached controller read, and explicit recovery. Insertion and removal of the fifth row distinguish both continuation directions while an earlier error remains visible. The detached read follows a source change with no controller subscriber; its preloaded Collection retains the five-row window. The exact overlap uses the exported DB controller in each package realm. Framework hooks expose no controller preload, so this cell does not establish a hook scheduling path; direct hook paging remains in the adjacent shared scenarios. An unsubscribed controller has no notification claim. |
129| Structural values and ordered primitives | [hash values](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/hash.property.test.ts), [hash graphs](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/hash-graph.property.test.ts), [mixed hash graphs](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/hash-mixed-graph.property.test.ts), [hash retry](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/hash-failure-retry.property.test.ts), [comparison](https://github.com/TanStack/db/blob/main/packages/db/tests/comparison.property.test.ts), [deep equality](https://github.com/TanStack/db/blob/main/packages/db/tests/utils.property.test.ts), [cursor](https://github.com/TanStack/db/blob/main/packages/db/tests/cursor.property.test.ts), [indexes](https://github.com/TanStack/db/blob/main/packages/db/tests/index-update.property.test.ts), [query identity](https://github.com/TanStack/db/blob/main/packages/db/tests/query/identity-output-shape-oracle.test.ts), [LIKE semantics](https://github.com/TanStack/db/blob/main/packages/db/tests/query/compiler/evaluators.test.ts) | Independent flat values, graph topology, algebraic laws, Map/group/sort recomputation, expression denotation, custom comparator dispatch/reference identity/index compatibility, LIKE wildcard refinement, compiled output bags, declared value-pair agreement between D2 equality keys and IR equality operands, and Collection collation with exact public scan/index order and one-index reuse across repeated reads. The auto-index cells cross BasicIndex and BTreeIndex; scan cells omit indexes. Both paths cover lexical and numeric `en-US` locale defaults plus an explicit ordinary locale override of a numeric default. An unindexed six-row work cell bounds Collection collation resolution to at most two reads per ordered scan: one index-path check and one scan clause. Other locales and ordered histories are outside this owner. The identity pair grammar covers primitives, signed zero, NaN/invalid Date, valid Date/timestamp, binary/Buffer, Temporal, nested references, symbols, and functions; fixed and sampled pairs do not prove every JavaScript value or hash collision freedom. Ref proxies are expressions rather than literal values in this lane. The hash-values owner samples Set/object and Map/object type-marker distinctions in fixed and random campaigns with seed-and-path replay; collision freedom is not promised. Custom string indexes do not optimize ordinary ranges, and custom cursors remain unsupported. The LIKE owner covers boolean string matching and bounded work, not nullish three-valued logic or a general Unicode collation contract. Unsupported composite cursors reject. |
130| Minified DB public API | [consumer bundle check](https://github.com/TanStack/db/blob/main/scripts/test-minified-db.mjs) | CI bundles the public `@tanstack/db` entry with db-ivm inlined through esbuild `minify: true`. It checks every exported error class's current public `name`, the built-in `BasicIndex` resolver name in index metadata and its event, complete query rows (after removing the four documented virtual fields) against an independent array filter/sort/projection, and one live update. The `new.target.name`, public-member mangle, and extra-output-field calibration modes fail at the intended observations. This fixed slice does not replace the unminified generated oracles, exercise framework adapters, or establish stable names for custom index resolvers. |
131| Boundary refinements | [cleanup/restart](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-cleanup-restart-oracle.test.ts), [issue #1891 async-cleanup review](oracle-reviews/issue-1891-async-cleanup.md), [issue #1891 cleanup-start follow-up](oracle-reviews/issue-1891-cleanup-start-followup.md), [metadata publication](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-metadata-publication-oracle.property.test.ts), [state retention](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-state-retention-oracle.property.test.ts), [acquisition cells](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-subscription-lifecycle-oracle.test.ts), [D2 source reconciliation](https://github.com/TanStack/db/blob/main/packages/db/tests/d2-source-reconciliation-oracle.property.test.ts), [top-K support windows](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/operators/topk-support-window-oracle.test.ts), [nested Query work](https://github.com/TanStack/db/blob/main/packages/query-db-collection/tests/includes-work-counter-oracle.test.ts) | Explicit lifecycle products, independent source maps and weighted relations, exact publication cuts, support/multiplicity, and value-plus-work observations. These refine the larger subsystem models; they do not replace them. |
132| Small structures and test mechanics | [SortedMap](https://github.com/TanStack/db/blob/main/packages/db/tests/SortedMap.test.ts), [cleanup queue](https://github.com/TanStack/db/blob/main/packages/db/tests/cleanup-queue.property.test.ts), [live-query GC clock](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-gc-clock.test.ts), [guarded replay](https://github.com/TanStack/db/blob/main/packages/db/tests/oracle-replay.test.ts) | Map/full-sort and elapsed appointment-list models with executed target/seed/path checks. Wall-clock steps do not move due times, and a focused public witness checks source subscription release. Callback-reentrant scheduling, OS suspend/resume, environments without `performance.now()`, and fake/real Performance clock replacement while GC is pending remain outside this coverage. Tests must drain or reset pending GC before switching timer providers. |
133​
134The query identity owner generates both equal and unequal primitive string
135pairs. Its fixed pairs also check public `groupBy` rows after initial
136publication. End-to-end subset-demand reuse is still unproven: the demand-key
137check observes internal identity only. The identity owner needs a subscription
138witness that compares public rows and acquisition counts after equivalent and
139distinct predicate demands settle.
140​
141The subscription callback-reentry companion kills eleven guard-deletion mutants
142at the named request, resource, status, replay, or retention checkpoint on the
143reviewed production head. It also checks that releasing a direct snapshot
144during an unoptimized callback or snapshot evaluation prevents publication.
145A combined-predicate loader case checks release by the original request
146predicate before the loader returns. Three
147guards remain for a separate code-weight review (SUBS-09): M1's generation
148check after `loadSubset` is followed by demand-membership and generation checks
149after cleanup removes a starting demand; M6's replaced-state check before
150restart setup is followed by detached-demand and replay-state checks; M8's
151`releaseAttempted` true branch was unreached in 538 focused tests and its callers
152remove or detach ownership before invoking adapter unload. These are bounded
153equivalence arguments, not permission to delete the guards without a separate
154review. The companion does not establish arbitrary provider callback behavior.
155​
156The Collection lifecycle publication owner checks 32 bounded histories in which
157cleanup interrupts nested publication deferrals and a restarted sync run later
158publishes or discards one or two source rows. It compares the next subscriber's
159exact batch when the new deferral closes, including an old handle closed before
160or during that deferral. The includes publication owner still needs a
161compiled includes witness for cleanup during a discarded source deferral,
162followed by a parent or child publication at its callback boundary.
163​
164The [Temporal group-key oracle](../../packages/db-ivm/tests/temporal-group-key-oracle.test.ts)
165owns the db-ivm `groupBy` value boundary for the eight Temporal kinds recognized
166by structural hashing. It compares public group counts with fixture-defined
167identity classes after one input batch, including distinct and matching fresh
168values and a plain object with its own spoofed Temporal tag. Nested
169serialization controls cover records, arrays, Maps, and Sets. Incremental
170retractions and unsupported symbols, cycles, and mutable RegExp state are outside
171this owner's bounded domain. The owner uses db-ivm's established kind-and-string
172Temporal key domain. Alternate representations remain separate: Durations such
173as `PT1H` and `PT60M` form different groups even when they compare equal. The
174supported inputs are ordinary native Temporal values or values from one
175polyfill copy. A custom prototype that impersonates Temporal can still merge a
176plain object with a genuine value. A genuine value with a replaced prototype
177can split from an equal value. Both altered-prototype cases and separately
178loaded polyfill copies are outside this contract. The oracle still protects a
179plain object's own spoofed tag without a custom prototype.
180​
181The [includes publication oracle](../../packages/db/tests/query/includes-publication-oracle.test.ts)
182now checks one held ordered repair with two public parent rows and one inline
183child. Its bounded history crosses a single-step row move, a private value
184change that returns to the prior value, and a final value change. It compares
185root Collection reads and subscriber callbacks with an independent sorted
186source Map, and checks Effect callbacks against the last callback-visible row.
187The [DEC-02 review record](oracle-reviews/2026-09-28-retracted-value-retention.md)
188retains the RED and mutant evidence. This owner does not cover a held reorder
189inside a Collection-valued child facade. The receiving owner is
190`packages/db/tests/query/includes-collection-oracle.property.test.ts`; it
191needs a child-row A→B→A update during a held child repair and a facade
192subscriber observation. Concurrent optimistic changes to the same root row
193during a held repair also need a public snapshot and event witness in
194`packages/db/tests/query/includes-optimistic-oracle.property.test.ts`.
195​
196The SQLite resume-snapshot owner also checks a cold, unique-key, non-delete
197full replacement with 205 rows. It compares exact durable rows, row metadata,
198key-set evidence, resume metadata, and applied position at transaction return;
199the driver query/run count is bounded, and a later-batch fault rolls back the
200whole transaction. Duplicate-key and delete histories keep their sequential
201semantics. This in-memory driver-call law does not measure Chromium OPFS
202latency, worker scheduling, or an end-to-end Electric snapshot.
203​
204The Cloudflare Durable Object replacement test applies 25-, 26-, and 205-row
205full replacements through the actual Cloudflare driver. A storage seam enforces
206Cloudflare's documented 100-bound-parameter query limit and checks the durable
207keys after each transaction. This Node SQLite seam does not execute in Workers.
208​
209The browser OPFS lifecycle owner also checks that a silent initialization
210rejects at the default or overridden open deadline, terminates its worker,
211ignores a late response, and releases the deadline and abort listener after a
212successful open. It also checks an abort during synchronous option evaluation,
213after the initial signal check but before listener registration. A Chromium
214fixture holds the VFS database Web Lock while a second tab times out. It checks
215that the queued request disappears, then reopens the database after releasing
216the lock. This controlled lock holder does not
217reproduce a frozen tab or establish behavior in other browsers.
218The [issue #1883 review record](oracle-reviews/issue-1883-opfs-open-deadline.md)
219preserves the exact-head unit and Chromium evidence and the queued-lock mutant.
220​
221The ordered-work owner also checks that an Effect with `skipInitial` waits for
222joined demand before ending initial callback suppression. A deterministic work
223counter rejects an extra joined-filter graph schedule on root readiness while
224preserving the joined-source wake-up. Nonterminal per-demand failure recovery
225is outside this owner: `failDemand` enters terminal live-query error while its
226plan record remains unsettled until sync teardown. A future recovery contract
227must reconcile plan and subscription pending state before reopening publication.
228Its startup witness covers one synchronous rank update after an indexed page
229load and before the last source subscription returns. It does not cover every
230source ordering, multiple buffered mutations, or asynchronous startup changes.
231The [ordered Effect startup review](oracle-reviews/gap-06-ordered-effect-startup.md)
232records its baseline and hostile-mutant observations.
233​
234The Collection lifecycle change-event history owner also checks eager auto-index
235equality buckets and fresh indexed `eq` live queries against its independent
236row Map. Its required same-turn delete/reinsert prefix reaches an already-built
237index for both BasicIndex and BTreeIndex. In the batched lane, public rows and
238equality buckets are checked after each mutation returns, before any transaction
239is awaited; the batched final state and each sequential settled prefix are also
240checked. Fresh indexed queries are checked at the final checkpoint.
241Fixed and random tails check nearby legal histories. One temporary mutant that
242skipped index updates failed the fixed batched final count: one indexed key
243versus two model rows. Another fault that preserved the final keys failed the
244new returned-mutation check. The direct index refinement owner does not prove
245this Collection mutation path. Callback-time index agreement,
246the reported insert-seeded string-key setup, adapter cancellation, and
247non-local-only persistence remain outside this lane.
248The [issue #1912 review record](oracle-reviews/issue-1912-eager-index-history.md)
249records the grammar controls, exact reviewed commit, and ORC audit.
250​
251The [live Electric immediate-reload witness](../../packages/browser-db-sqlite-persistence/e2e/electric-immediate-reload.opfs.spec.ts)
252checks one Chromium/OPFS history: an `onInsert` handler receives PostgreSQL
253transaction evidence, `awaitTxId` and the optimistic transaction settle while
254the source row's adapter write is held, and a hard page close is followed by
255an empty raw OPFS snapshot before the recovering Collection or Electric starts.
256After release, the witness checks the exact public and durable row from live
257Electric and records that the reopened page sent no user-insert request. Public
258rows are polled before durable snapshots to avoid a full OPFS read on every
259pre-publication tick. This bounded history does not prove Windows/Edge behavior,
260offline recovery, arbitrary later re-inserts, or a durable-acknowledgment
261contract for `awaitTxId`.
262​
263The [PR #1914 follow-up review record](oracle-reviews/pr-1914-immediate-reload-follow-up.md)
264preserves the held-checkpoint and extra-POST mutant results at the exact
265reviewed executable commit.
266​
267The [PR #1902 review record](oracle-reviews/pr-1902-change-event-history.md)
268also covers one-pass queued-sync cancellation, partial-update dependencies on
269queued source rows, and focused late-hydration cases in
270`packages/db/tests/db-client.test.ts`. Those cases cross queued adapter insert
271and delete with a held local mutation. The
272[DbClient hydration authority oracle](../../packages/db/tests/db-client-hydration-authority-oracle.test.ts)
273crosses applied adapter insert, update, delete, and truncate with hydration
274before and after the applied receipt. It includes delete/reinsert and
275truncate/reinsert controls. These owners do not establish arbitrary hydration
276stream order, a later authoritative hydration epoch, or unbounded retention.
277​
278The [two-tab OPFS remote-subset oracle](../../packages/browser-db-sqlite-persistence/e2e/remote-subset-two-tab.opfs.spec.ts)
279now exercises a real Chromium follower with a QueryClient-backed, filtered
280on-demand live query. It checks the function-bearing local request, clone-safe
281follower post, public row, and rejection of an invalid nested wire value before
282transport. A raw-options mutant fails with browser `DataCloneError`. The
283[review record](oracle-reviews/2026-09-27-remote-subset-two-tab.md) names the
284exact reviewed commit. The test does not run React, Firefox/Zen, or a live
285backend, and it does not settle exclusive OPFS ownership during leadership
286transfer.
287​
288The [two-tab live Electric OPFS oracle](../../packages/browser-db-sqlite-persistence/e2e/electric-resume-two-tab.opfs.spec.ts)
289crosses real Chromium tabs, Web Locks, OPFS workers, PostgreSQL, and the
290installed Electric SDK. It checks distinct per-Collection schema versions,
291unchanged public and durable rows when a follower opens, leadership transfer
292with later source rows, and recovery of partial-row loss or a fully empty
293pre-key-ledger baseline with a stale resume marker. A wrapped source-commit
294test in `packages/browser-db-sqlite-persistence/tests/browser-coordinator.test.ts`
295checks scheduler entry before the writer-lock request; the old bypass fails at
296that order assertion. The live recovery histories also guard the resulting
297progress. These bounded histories do not prove Firefox/Zen,
298React rendering, React Native, arbitrary large datasets, or an exclusive-OPFS
299ownership topology. Their
300[review record](oracle-reviews/issue-1589-live-electric-opfs.md) preserves the
301RED and GREEN host observations.
302​
303The [live Electric hydration-straddle oracle](../../packages/browser-db-sqlite-persistence/e2e/electric-hydration-straddle.opfs.spec.ts)
304owns one #1754 host history: an on-demand Collection has an initial durable row;
305an OPFS subset hydration is held after its local read; a PostgreSQL update
306begins an Electric source transaction during that hold; and the row-bearing
307commit is released only after the hydration scope exits. It checks the old row
308before release and the exact new public and durable row afterward, then after
309follower takeover and reopen. A late-buffer mutant leaves the old row in both
310observations. The [core persistence tests](../../packages/db-sqlite-persistence-core/tests/persisted.test.ts)
311own the adjacent during/straddling/after settlement, FIFO, abort, and failure
312histories. The live oracle does not prove eager-startup overlap, other mutation
313shapes, arbitrary Electric fetch schedules, Firefox/Zen, React rendering, or
314exclusive OPFS ownership. The
315[review record](oracle-reviews/issue-1754-live-electric-hydration-straddle.md)
316preserves the live-host and mutant evidence.
317​
318## Acceptance map
319​
320The post-merge review added three missing domains to existing owners:
321​
322- [Top-K batch contracts](https://github.com/TanStack/db/blob/main/packages/db-ivm/tests/operators/topk-batch-contract.test.ts)
323 cross sparse-array length/holes and RegExp source/flags/position with equal
324 controls, replacement order, hash consolidation, and actual retained graph
325 output. Ordinary replacements also run without the global `File` constructor.
326- [Leadership replay](https://github.com/TanStack/db/blob/main/packages/offline-transactions/tests/leadership-replay.property.test.ts)
327 holds real storage-read delivery across successful and permanently rejected
328 durable removals, with bounded scans, concurrent loads, and unfinished peers.
329 This is distinct from exactly-once execution across independent owners.
330- Accepted-snapshot retention is owned by
331 [state retention](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-state-retention-oracle.property.test.ts)
332 and its focused
333 [truncate-capture ownership refinement](https://github.com/TanStack/db/blob/main/packages/db/tests/collection-truncate-ownership-oracle.property.test.ts).
334 They vary truncate before/during/after an optimistic delete, rejection versus
335 rollback, post-capture direct insertion, and later ordinary sync/key reuse. A
336 hidden accepted insert returns after rollback; an uncaptured insert retires,
337 and neither snapshot is rebased onto synced fields. The state-retention owner
338 also crosses both accepted-delete/dependent-edit settlement orders with
339 reinsert success or failure, with and without truncate. Its public row and
340 change-message checks run after every step. These eight histories do not
341 establish every ordering of the insert outcome relative to sibling settlement
342 or an arbitrary later source acknowledgement.
343 The [PR #1907 review record](oracle-reviews/pr-1907-accepted-delete-ownership.md)
344 preserves the exact RED/GREEN evidence and reviewed commits.
345​
346| Issue obligation | Implemented evidence | Limit |
347| --- | --- | --- |
348| Metamorphic laws | Includes cross-formulation/partition, D2 independent-key commutation, DBSP incremental/full recomputation, pagination provider/UI boundaries, optimistic snapshot stability | Equivalence premises are explicit; not arbitrary query rewrites. |
349| Public observations | Reads, exact event payloads and reconstructed state, observer eligibility, downstream includes, lifecycle and ownership checks | Count/work budgets are separate from row truth and only pin established promises. |
350| Meaningful async histories | Applied receipts, truncate/replay, cleanup/restart, pending optimistic work, held provider completion, leadership loss | Control real causes; unsupported SDK traces receive no coverage credit. |
351| Checker sensitivity | Faulty output controls, missing/duplicate events, stale completion/ownership controls, forced collisions and pre-fix runtime witnesses | Setup failures and timeouts are recorded separately from assertion kills. |
352| Executed reach and replay | Named manifest with guarded replay, finite boundary products, pinned examples, fixed/random lanes and explicit stress runs | Root `test:oracles` is a selected core/Query DB campaign, not all repository oracles. |
353| Contract and scope records | Guide, companion case notes, this map, suite-local law/domain comments and architecture | This is an executable testing method, not a completeness proof or new product specification. |
354​
355## Running and replaying
356​
357Build workspace dependencies before testing consumers of package exports. Use
358the package's checked-in config; source aliases and native shims must be named
359when they replace that path.
360​
361```sh
362pnpm --filter @tanstack/db-ivm build
363pnpm --filter @tanstack/db build
364pnpm --filter @tanstack/db test:oracles
365pnpm --filter @tanstack/powersync-db-collection test:oracles
366pnpm --filter @tanstack/db-sqlite-persistence-core build
367pnpm --filter @tanstack/node-db-sqlite-persistence test:oracles
368# Service-dependent: requires Electric and PostgreSQL to be running.
369pnpm --filter @tanstack/electric-db-collection test:e2e
370pnpm run typecheck:tests
371pnpm exec tsc --noEmit -p packages/db/tsconfig.json
372pnpm --dir packages/db exec vitest run --coverage.enabled=false --maxWorkers=2
373pnpm --dir packages/db-ivm exec vitest run --coverage.enabled=false --maxWorkers=2
374pnpm --dir packages/offline-transactions exec vitest run --maxWorkers=2
375```
376​
377Core guarded replay is run from `packages/db`, for example:
378​
379```sh
380TANSTACK_DB_ORACLE_SEED=1813 TANSTACK_DB_ORACLE_PATH=0 \
381TANSTACK_DB_ORACLE_PROPERTY=live-query-observer.granular-history \
382node --import tsx tests/oracle-replay.ts \
383 tests/live-query-observer-history.property.test.ts \
384 -t 'granular listeners follow the eligibility ledger with a random or replayed seed' \
385 --coverage.enabled=false --typecheck.enabled=false
386```
387​
388Use the failure's actual seed/path for a reproduction. The example establishes
389target execution, not reproduction of a particular bug. Local IVM and offline
390properties have separate environment variables; inspect their test headers.
391Do not assume the core multiplier reaches them.
392​
393The Node expression-index oracle runs matching fixed-seed and seedless-random
394campaigns by default. Supplying both replay values selects only the requested
395seed and shrink path:
396​
397```sh
398TANSTACK_DB_WS5A_SEED=1659005 TANSTACK_DB_WS5A_PATH=0 \
399pnpm --filter @tanstack/node-db-sqlite-persistence test:oracles
400```
401​
402Stress runs need an explicit file list, run budget, seed policy, runtime, exit
403status and cost. For long synchronous campaigns, yield **between complete
404histories**, never between an action and its synchronous observation. In this
405project, worker progress RPC starvation produced passing assertions with a
406nonzero process exit. Such a run is not green. Raising a test timeout alone
407does not let the worker process its progress messages.
408​
409## Reusable-law backlog
410​
411RFC #1659 reviews found several green oracles whose stated laws remained valid
412but whose fixtures, grammars, or observations did not cover a neighboring
413boundary. Track the generalized repairs here instead of accumulating isolated
414regressions. Completion requires an executable owner, a production-path witness,
415a hostile wrong-answer control, and an explicit statement of remaining limits.
416​
417- [x] **Real-provider conformance fixtures.** Frozen 15.2.7 React Native and
418 Node receipts cover the supported peer version; 18.2.1 React Native, Node,
419 and browser receipts cover the known forward shapes. Exact-row checks and a
420 row-dropping hostile control prove the shim accepts those envelopes without
421 mutating them. Owner:
422 `packages/react-native-db-sqlite-persistence/tests/fixtures/op-sqlite-provider-results.ts`
423 and `packages/react-native-db-sqlite-persistence/tests/op-sqlite-driver.test.ts`.
424 Native device/host execution remains a separate runtime receipt.
425- [x] **Minimal ambiguity and name invariance.** Generate one-field and
426 otherwise minimally distinguishable results. Renaming a selected column to a
427 structural-looking alias must not turn a data row into a write envelope.
428 Owner: `packages/react-native-db-sqlite-persistence/tests/op-sqlite-driver.test.ts`.
429- [x] **Carrier coexistence and representation symmetry.** Cross `rows`,
430 `rawRows`, `columnNames`, and supported result containers, including legal
431 coexistence. Equivalent array and object forms must agree on rows or on the
432 documented rejection. Owner:
433 `packages/react-native-db-sqlite-persistence/tests/op-sqlite-driver.test.ts`
434 and the shared SQLite driver contract.
435- [x] **Shared-handle transaction admission.** Concurrent driver wrappers for
436 one provider database handle serialize root transactions. Nested work must
437 use the transaction driver supplied to the callback on hosts without async
438 context propagation. Owners:
439 `packages/node-db-sqlite-persistence/tests/node-driver.test.ts` and
440 `packages/react-native-db-sqlite-persistence/tests/op-sqlite-driver.test.ts`.
441- [x] **Transitions at every relevant await.** Hold each coordination boundary,
442 then change leadership, remote-subset ownership, abort state, cleanup, or
443 restart generation before release. Owners: browser/electron coordinator,
444 persisted-history, and collection cleanup/restart oracles.
445- [x] **Local-versus-transport refinement.** Compare local-leader and transported
446 remote-subset behavior for immutable values. Separately prove that local
447 `signal` and `subscription` references survive delivery and reach matching
448 unload cleanup. Owners: browser/electron coordinator and persisted-history
449 suites.
450- [x] **Partial-construction cleanup.** Fail database, driver, worker, and
451 subscription construction after each acquired resource. Preserve the primary
452 failure while proving all acquired resources are released exactly once.
453 Owners: OP-SQLite driver-contract construction and OPFS page/worker lifecycle
454 suites.
455- [x] **On-demand persistence after evidence changes.** Cross baseline versus
456 on-demand hydration with consistent, unknown, and incompatible key-set
457 evidence. A baseline certification failure must not silently erase valid
458 on-demand rows. `loadSubset` checks baseline visibility and on-demand rows;
459 the sync-absent `forceReloadSubset` route crosses the same startup evidence
460 states but records baseline visibility as unobserved because that API does
461 not expose baseline hydration. Owner:
462 `packages/db-sqlite-persistence-core/tests/persisted.test.ts`.
463- [x] **Deterministic value-and-work laws.** Pair row correctness with stable
464 statement, scan, trigger, or queue-cardinality observations where the
465 subsystem promises bounded work. Owners: SQLite resume snapshots, Electric
466 acquisition work, shared-driver scheduling suites, and the Node
467 same-database-handle admission law.
468- [x] **Startup generation interleavings.** Hold persisted startup between its
469 metadata and hydration snapshots, then cross no write, a managed mutation,
470 and hostile raw loss. Compare public rows with the atomic durable snapshot,
471 and require mutation persistence to wait until the prior stream position is
472 known. Owners: SQLite resume snapshots and Electric resume snapshot races.
473- [x] **Schema-generation fences on cached adapters.** Cross a newer-schema
474 reset with snapshot, row, metadata, delta, position, and index-lifecycle
475 operations from the cached older adapter. Every stale operation rejects;
476 the current adapter remains readable and its index registry remains intact.
477 Owners: SQLite resume snapshots plus browser/electron coordinator routing.
478- [x] **Explicit omission records.** Add a short `Known omissions` section to
479 each primary executable owner touched above and keep this map synchronized as
480 laws land. An omission record narrows evidence; it does not waive a product
481 obligation.
482- [ ] **Atomic active-subset full reload.** Load collection metadata and every
483 active subset from one adapter generation, including filtered and paginated
484 on-demand subsets. A sound implementation needs an atomic multi-subset API;
485 loading all rows or accepting a metadata/row torn pair is not equivalent.
486 RED evidence and the deferred executable placeholder live in
487 `packages/db-sqlite-persistence-core/tests/persisted.test.ts` under R5-007.
488​
489- [ ] **Joined aggregate and `singleResult` subquery histories.** Extend
490 `packages/db/tests/query/subquery-user-value-oracle.test.ts` with source
491 changes after initial publication and joined `findOne()` subqueries.
492 Recompute complete result bags or public singleton values at each checkpoint;
493 the current fixed DISTINCT and nested aggregate witnesses do not establish
494 those neighboring paths.
495​
496## Deferred contracts and evidence
497​
498The maintainer assigned offline policy work to
499[RFC #1659](https://github.com/TanStack/db/issues/1659). It is not a merge blocker
500for this oracle repair. Keep these scenarios and decisions with that owner:
501​
502- **A10 R7/R13:** provider succeeds, outbox deletion fails, then restart can replay
503 the retained work. IndexedDB transaction-completion settlement is fixed here;
504 LocalStorage's failure/read policy and post-success acknowledgment remain open.
505- **A10 R4/R5/R9:** loss before durable admission, terminal waiter/removal/clear
506 and restored optimistic lifetimes, and retry-hook failures.
507- **A10 R11/R12 and earlier R8:** metadata/native-value domain, old readers of
508 new wire records, and unreadable/unknown-version outbox recovery. New readers
509 accepting old records does not prove reverse compatibility. Do not delete
510 unreadable work silently or invent exactly-once guarantees.
511​
512Other explicit follow-up boundaries are owned by
513[issue #1820](https://github.com/TanStack/db/issues/1820), not silently claimed
514green:
515​
516- **Effect disposal:** the existing external-disposal wait and synchronous
517 in-handler cancellation are tested. Waiting for independent work returned by
518 the initiating handler conflicts with supporting a handler that awaits its
519 own disposal. The candidate implementation was removed pending a contract.
520- **Proxy native mutators and symbol writes:** retain supported standard
521 Map/Set behavior. Decide additional support versus a clear error before
522 generalizing expectations; do not silently drop native edits.
523- **Progressive/native execution:** eight progressive registrations lack valid
524 phase/capability evidence. Electric's ready gate is after application, not a
525 pre-swap source gate; TrailBase does not supply that capability. The 24 move
526 cases and actual native hosts need separate execution receipts. A green
527 registration helper or package job does not prove these cells ran.
528- **Optional mechanics/performance:** separating the expensive replay-process
529 campaign, sharing native runner code only with both host builds verified,
530 optional cancellation calibration and proxy construction-work budgets.
531 An earlier suggestion to merge unnamed cleanup helpers still lacks exact
532 targets; do not perform a blind consolidation.
533​
534## Final evidence record
535​
536Verification receipts and follow-up issue links are recorded in the PR and
537the issue closeout comment. Keep their exact revision/runtime boundaries;
538historical counts in research notes do not certify later commits. Closing the
539bounded repair means the acceptance map has evidence and each remaining
540question has an owner—not that there can be no more bugs.