Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/fix-adapter-page-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@tanstack/db': patch
'@tanstack/db-ivm': patch
'@tanstack/react-db': patch
'@tanstack/preact-db': patch
'@tanstack/vue-db': patch
'@tanstack/solid-db': patch
'@tanstack/angular-db': patch
'@tanstack/svelte-db': patch
---

Keep adapter-owned live queries and their source subscriptions when only the ordered query's finite `.limit()` or `.offset()` changes. Preserve exact requested bounds and select only installed ranks when page windows include negative offsets. Keep Angular's list/findOne result shape consistent with the current query during reactive changes, and avoid React 18 layout-effect warnings during server rendering.
2 changes: 1 addition & 1 deletion docs/contributing/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ production queues, caches, or semantic helpers merely to share their names.
| source Collection | A Collection read by a query or adapter. | Source relation when the value is a public Collection. |
| live-query Collection | A Collection whose rows are produced by a live query. | Query, observer, or result set. |
| framework binding | What one mounted framework hook or injector keeps between updates: its compiled live query or window binding, its observer or controller, and its source Collection ID claims. | Subscription, observer, or live-query Collection. |
| query identity | The value that decides whether a framework binding compiles its query input again: a nonempty `queryKey`, or the identity derived from the query IR. A `DbClient` matches preloaded and hydrated queries by its hash. React and Preact compare it on every render; reactive adapters compile again when their reads change and compare none. | Query hash when the value is not hashed, or dependency list. |
| query identity | The value that invalidates a framework binding's authored query input: a nonempty `queryKey`, or the identity derived from the query IR. A `DbClient` matches preloaded and hydrated queries by its hash. React and Preact compare it on every render; reactive adapters resolve again when their reads change and compare none. An adapter-owned finite outer-window change can retain its compiled plan and Collection despite a changed result identity. | Query hash when the value is not hashed, or dependency list. |
| source Collection ID claim | A framework binding's record of which source Collection object each Collection ID named, per `DbClient` scope, kept while the binding is mounted. A binding that compares query identity rejects a different object under a claimed ID. | Collection registry or source identity. |
| window binding | The infinite-query state a framework binding keeps between updates: the input, its identity dependencies, the page shape, the window collection, and its controller. `bindLiveQueryWindow` decides whether to keep it, replace its controller, or bind a new window collection. | Window controller or live-query Collection. |
| pooled live query | A live query on one source Collection whose `where` has at least one `eq(field, literal)` conjunct and otherwise reads only the row, optionally ordered by the row's own fields without a limit, served from an equality partition; its live-query Collection is built only when read. | Cached query or shared live-query Collection. |
Expand Down
122 changes: 122 additions & 0 deletions docs/contributing/oracle-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,21 @@ is not browser evidence. `hydration.svelte.test.ts` separately receives
normalized transport and normal warm-browser initialization through its native
scheduler.

The [React SSR diagnostic receiver](../../packages/react-db/tests/ssr-effects-oracle.test.ts)
extends that preparation grammar and judgment with real matched React/ReactDOM
18.3.1 and 19.2.4 development server renderers. Separate paths cover provider
and explicit-client ordinary hooks, completed non-streaming Suspense through
both client forms, standalone builders and supplied Collections. A disabled
input replays the same diagnostic comparison. Each checks return and the raw
React client-layout diagnostic after server render and cleanup; ordinary
descriptor paths also compare admission, selected rows and status, while
prepared Suspense compares rows. Standalone/supplied paths make no hydration
claim. Fixed/fresh campaigns retain per-runtime/path reach and direct replay;
this does not establish streaming Suspense, actual browser hydration, arbitrary
provider delivery or every React version. Client commit and abandonment remain
with the window receiving owner. [SSR effect evidence](oracle-reviews/2026-10-30-react-ssr-effects.md)
records pre-edit RED, repaired GREEN and hostile rejection.

The shared admission owner also defines runtime ready/error outcomes, browser
explicit preparation and defined/undefined causes. Its receiving drivers are
`packages/react-db/tests/ssr-runtime-error-handoff-oracle.test.tsx` and
Expand Down Expand Up @@ -3811,6 +3826,21 @@ target execution, not reproduction of a particular bug. Local IVM and offline
properties have separate environment variables; inspect their test headers.
Do not assume the core multiplier reaches them.

The adapter-window properties have named replay routes in
`packages/db/tests/oracle-replay-manifest.ts`. Each shared history property
includes its production driver: `framework.<driver>.window-history`,
`framework.<driver>.pending-window-history`, or
`framework.<driver>.publication-window-history`. The drivers are `react`,
`react-dependency-list`, `preact`, `vue`, `solid`, `angular`, and `svelte`.
Each route selects its own conformance file and names the shared model module
as its source. React and Preact render witnesses, all twelve React SSR
runtime/path cells, and the IVM numeric-window lane retain their own routes.
Selectors choose only the fresh or random campaign. The earlier three shared
`framework.*` names are retired because they lost the failing driver's identity.
The [replay review](oracle-reviews/2026-10-30-adapter-page-window-replay.md)
records the 21 driver/history witnesses and correction of the earlier canonical
React routing claim in the preparation record.

The Node expression-index oracle runs matching fixed-seed and seedless-random
campaigns by default. A path replay of its property selects only the
requested seed and shrink path:
Expand Down Expand Up @@ -6619,6 +6649,98 @@ but its helper-level evidence does not by itself exercise distinct storage.
The separate Index structural-collision obligation above remains open.
See the appended [review evidence](oracle-reviews/2026-10-30-distinct-collisions.md).


### Adapter-owned page windows

The framework owner includes [window-history-oracle.ts](../../packages/db/tests/conformance/window-history-oracle.ts), registered through the shared conformance suite in React, Preact, Vue, Solid, Angular and Svelte. Maintainer decision 2026-10-30 for #2291: changing only `.limit()`/`.offset()` moves the existing outer window; it adds no hook option. The independent sort/filter/slice model checks ordered selected rows and keyed-map values after each framework flush, Collection retention for page moves, replacement for source/filter/order/projection/nested-window changes, and retained upstream ownership. Direct and nested paths have separate reach, as do changing/stable/opaque keys where the driver supports keys. Keyed source swaps include distinct source objects under one Collection ID. Generated source updates check liveness after reuse. The bare-callback lanes also vary a Collection option together with a page change and check its applied value. The pending lane observes a move during initial loading, oldest settlement while the latest remains pending, initial readiness, overlapping held acquisitions, final latest rows, and unmount before settlement. The publication-callback lane changes offset, limit or both from a public change callback, then checks the retained Collection after the host settles. It controls demand settlement over already installed source rows; the core pagination owner continues to own source delivery, failures and ordered repair.

The [React receiving witness](../../packages/react-db/tests/window-render-oracle.test.tsx) reuses this model/checker at suspended, cancelled and committed render cuts for eager and finite on-demand sources, with derived and explicit keys. It checks the captured committed Collection and provider acquisition count while a render is abandoned. The [Preact receiving witness](../../packages/preact-db/tests/window-render-oracle.test.tsx) checks an aborted render under a real error boundary while a public subscription keeps the committed Collection active. Both run separate offset-only, limit-only and combined-move campaigns with declared reach per category. These do not establish arbitrary concurrent framework schedules. The retained-work observation checks continuous upstream ownership and every public subscription-count transition during a retained move; add-before-remove replacement fails, while retired Collections may complete GC. This is not a bound on CPU time or every possible internal compilation strategy. DbClient/hydration and Suspense shared-result caches, supplied Collections, opaque-plan optimization, queries without an outer limit and findOne retain their existing contracts and paths; this fix does not retarget their shared Collections. The generated retention guarantee covers finite bounds. An explicit Infinity limit can also move to a finite target under the resolver guard, but this evidence does not establish that additional domain or promise replacement outside the finite domain. The existing identity, deferred-acquisition, window-controller and includes owners remain authoritative for their neighboring laws.

Evidence, per-path reach counts, reviewer reconciliation and mutation outcomes are recorded in [the page-window review](oracle-reviews/2026-10-30-adapter-page-windows.md).

The [fresh independent review](oracle-reviews/2026-10-30-adapter-page-windows-round-2.md) records observation and failure-fidelity repairs. Shared and receiving campaigns preserve the first violated law, checkpoint and input trace through shrinking. Later action and cleanup failures remain distinguishable; non-reproducing shrink candidates supply no successful product evidence. The original late-coverage process gap remains documented.

The existing [top-K support-window owner](../../packages/db-ivm/tests/operators/topk-support-window-oracle.test.ts) also has a numeric-window lane for safe-integer maximum offsets and widths, exact omitted-bound inheritance on partial moves, and required demand messages when installed ranges are empty. It permits additional messages. It observes one-group settled operator rows, size and demand signals; real framework source growth belongs to the shared receiving owner above. [Numeric evidence](oracle-reviews/2026-10-30-topk-numeric-windows.md) records RED, GREEN, reach, replay and mutants.

### Projection and negative-window gaps from removal review (2026-11-02)

The shared framework owner now includes
[result-shape-oracle.ts](../../packages/db/tests/conformance/result-shape-oracle.ts).
One independent authored-source model and generated grammar run through React
(both registrations), Preact, Vue, Solid, Svelte and Angular. List/findOne
transitions, repeated modes, return transitions, empty/single/multiple source
rows and both data-first/Collection-first reads are checked at each driver's
native parameter cut, then after settlement. Finite singleton queries retain
identical offset/limit across projection changes, including positive offsets.
Native cuts require raw shape; settled cuts also compare selected values and
keyed state. This does not promise synchronous row freshness or identical host
scheduling. Disabled inputs, errors, supplied Collections, DbClient and broad
host/AOT behavior remain outside this lane.

**Repaired receiving defect:** Angular previously returned the old query's raw
projection at its synchronous Signal read before effects. Both directions
failed even though the new input reached the callback and later settlement
passed. It now reprojects captured rows through the current query while keeping
the normal snapshot path and pooled-query laziness. All six frameworks complete
their fixed/random campaigns; restoring the defect fails the native comparison.
Generated guarded replay seed 2316,
property `framework.angular.result-shape`, path `28` reproduces the defect;
finite paths `1` and `25` preserve nonempty offset-0/offset-1 evidence.

The existing top-K support-window owner adds a negative-offset grammar through
direct array top-K, one-group top-K and public orderBy. Under the maintainer's
2026-11-02 absolute-rank decision, nonnegative widths select the installed ranks
in `[offset, offset + limit)`, including intervals crossing zero. Generated
histories reach wholly negative/zero-width/crossing-zero windows, negative
source edits, partial moves, nonnegative returns and offsets below negative
cardinality. Signed rows, order, values, multiplicity and size remain observed.
The direct and orderBy size getters also count with an always-true predicate,
which must equal the selected row count. Negative widths, fractional bounds,
multiple groups, varying prefix predicates and downstream acquisition remain
outside this lane; existing support/numeric budgets and their prior evidence
remain unchanged.

Review5740133634 raises an adjacent negative-width contract question. The
support-window owner above is the location for a future maintainer decision and
its witness. With `TopKArray(5, -2)`, install ordered values0/4/6/8/10, then insert2
at rank1. Both maina3c4d0676 and the integrated branch emit moveIn10/moveOut6 while
reporting size0. The executable same-source probe is recorded in the
[second-main integration review](oracle-reviews/2026-11-02-removal-oracle-gaps.md#second-main-integration--a3c4d0676).
The accepted rank-selection law in this change covers nonnegative widths.
No negative-width empty-result law is claimed. Defining that behavior needs a
maintainer decision before extending generated moves and source-edit histories.
The adapter reuse path requires nonnegative target bounds and cannot take this
negative-width input as an eligible page-window move.

**Repaired operator defects:** negative-window rows, size, source edits and
return moves now agree with absolute ranks on all three paths. Each path's
fixed/random campaign reaches all eight declared states in 101 histories
(one example and 100 generated). Restoring relative slicing, the old size rule
or the old leading-count start separately fails the corresponding observation.
Each property `ivm.topk-negative-window-array`,
`ivm.topk-negative-window-grouped` and `ivm.topk-negative-window-orderBy` has a
guarded generated RED on the original code at seed 2316, path `1`, and a GREEN
on the repair. This closes the recorded negative-window defects within the
declared grammar, D2 paths and graph-drain cuts. Exact original/reduced traces,
declared reach, receiving cuts, calibrations and independent review outcomes
are in the [oracle extension record](oracle-reviews/2026-11-02-removal-oracle-gaps.md).
Its [production repair entry](oracle-reviews/2026-11-02-removal-oracle-gaps.md#production-repairs-2026-11-02)
records completed GREEN reach, isolated mutants and the rejected intermediate
Angular pooling regression. The earlier page-window oracle-first qualification
remains unchanged.

**Open test-mechanics gap from the repair run:** the guarded replay owner
(`packages/db/tests/oracle-replay.test.ts`, Small structures and test mechanics)
does not enforce singleton execution for a successful shrink-chain path.
With seed 2316 on the repaired code, `framework.angular.result-shape` at
`28:0:0:0:0:0:0` reports one registration but two histories, and each
`ivm.topk-negative-window-*` at `1:0:0:0` reports one registration but eight
histories, although `randomParameters` requests `numRuns: 1`. Original
one-segment paths and failing shrink paths report one history. Add a generated
passing shrink-path receiving witness and constrain continuation before claiming
one-history replay for that case. These extra GREEN executions are recorded
accurately in the repair entry and are not used as singleton product evidence.

## Loading sibling replay and final catch-up reach (2026-10-30)

The primary load-subset replay owner now constructs 48 finite histories where
Expand Down
Loading
Loading