Skip to content
Source
Sign inSign up
TanStack/db

fix(db): publish initial ordered fallback synchronously #2159

MergedKyleAMathewsmerged 19 commits intomain fromrefs/pull/2159/headmerged by KyleAMathews

KyleAMathewscommented

🎯 Changes

An ordered findOne() query over a locale string can request one page and then require the full source. The boundary cannot form a provider cursor. If both requests return literal true after applying their rows, the first React layout commit now sees the selected row and ready status. This prevents the brief empty state reported for queries ordered by an ISO date string.

For example, an eager source holds 2026-10-01 and 2026-10-02. The React query is:

const latest = useLiveQuery((q) =>
  q
    .from({ row: source })
    .orderBy(({ row }) => row.at, 'desc')
    .findOne(),
)

At the first layout commit, latest.data?.at is 2026-10-02 and latest.status is ready.

The loader previously treated the full-source fallback as later work because the ordered page settled first. The fallback still completes the unpublished first window. A literal-true full-source request can now settle in the current graph turn when needsOrderingRepair is false. This includes the first fallback and gives it the synchronous initial cut. The loader no longer uses Collection readiness as a proxy for first publication.

An explicit window move stays asynchronous. A request with needsOrderingRepair set also stays asynchronous. A Promise fallback remains asynchronous. The initial timing promise ends when the first window publishes. A later full-source request may finish synchronously when needsOrderingRepair is false.

The architecture document states the initial timing law and its limits. The ordered lifecycle oracle checks indexed and unindexed locale-string paths with distinct and tied values. It checks literal-true and Promise fallbacks. It requires an unfiltered full-source request and reads public rows and status at fallback entry, immediately after preload() starts, and after settlement. The tied case catches a fallback that loses the winning row. Each cell also requires one complete public insert after fallback settlement. Promise cells require no row event at the immediate cut.

The warm null-boundary cases cover both preload-started and constructor-started on-demand sync runs. The former owes a synchronous first window. The latter resumes deferred acquisition asynchronously and owes the same result after settlement. The React test checks the first layout commit with an eager source.

A Query DB test checks the real on-demand adapter with warm cached subsets. Both adapter calls return literal true with source rows visible at each return. The findOne() query is immediately ready without a new fetch. Other adapters and an on-demand React first commit remain outside these witnesses.

A later oracle checks a full-source fallback after the first joined window publishes. A marker deletion or retargeting disqualifies the first row. The next ordered page ends at a null boundary and triggers an unfiltered full-source request. A finite join model predicts the final row and the delete and insert events. Each event must match the public rows that its callback reads.

The histories use literal true, a Promise after applied writes, and a held applied receipt. For the held receipt, the oracle also settles child demand before the marker changes. It then checks the public loading flag while the root write waits and after it applies. A fault that ignores the receipt fails at that loading check. The intermediate window may retain the first row or become empty. The later request has no initial synchronous timing promise. The unheld Promise case checks final coherence.

Four more histories hold the provider Promise after root 3 applies. They change another marker while that Promise remains pending. The child demand is pending or settled in each marker history. The join model then selects root 2. The oracle reads public rows before and after the second change. It also checks every callback through provider settlement. A coherent root-3 window may publish before the second marker change. An extra stale publication after that change fails the event check. These four histories have no later provider write or rejection. They do not prove when the loader claims full-source authority.

Four neighboring histories retarget the second marker to root 4 while the provider Promise remains pending. The provider writes root 4 after its gate opens and before its returned Promise settles. The finite join model checks the final row and every callback. The adapter checks that the prior cursor-page acquisition remains owned while the Promise is pending. It checks that the lease retires after full-source settlement. A temporary early-completion fault failed all four histories at the held lease check. Provider rejection and real adapter delivery remain outside this witness.

Two cleanup-error histories check a later literal-true fallback. The replacement row and change event remain visible after the first acquisition's unload throws. The marker source's commit() returns normally, and the live query reports error. A temporary rethrow fault failed both histories at that commit.

The controlled providers now record applied-receipt results for comparison after production returns. This keeps a test assertion from becoming a provider failure.

✅ Checklist

  • I have tested this code locally with pnpm test.

Verification

  • On the earlier implementation commit, 427 ordered DB tests and both package TypeScript checks passed.
  • On the earlier merged head, the ordered lifecycle, ordered work, and includes work counter suites exited 0.
  • On the earlier merged head, 78 React conformance tests passed with no type errors.
  • On the prior two-history oracle update, all 279 ordered lifecycle tests passed. Temporary dropped-write and duplicate-event faults failed both marker histories at the public comparison.
  • On the prior eight-history oracle, all 285 ordered lifecycle tests and DB test TypeScript passed. A temporary ignored-receipt fault failed all four held cases at the public loading check.
  • On the earlier cleanup follow-up, all 287 ordered lifecycle tests passed. Three focused DB suites passed 405 tests with no type errors. A temporary release-error rethrow fault failed both cleanup histories at the marker commit.
  • On the earlier overlap head, all 292 ordered lifecycle tests passed with no type errors. A synthetic stale callback trace failed the event check while final rows still matched the model. An early-loader-completion fault survived those four overlap histories.
  • On the current head, all 296 ordered lifecycle tests passed with no type errors. The same early-completion fault failed all four late-write histories at the held lease check. The normal loader passed those histories.
  • The ordered loader state and ordered work suites passed 177 tests on the earlier head.
  • Prettier and git diff --check passed. ESLint reported no errors and one warning on an unchanged line.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Fixes #2152

Summary by CodeRabbit

  • Bug Fixes
    • Fixed ordered live queries that could initially show no results when the first result window required a fallback. When the fallback completes synchronously, results and ready status are available immediately.
    • Promise-based fallbacks remain asynchronous. Later loading and explicit window changes do not receive the initial synchronous readiness behavior.
    • Warm on-demand ordered findOne queries can return a cached result and become ready synchronously without another query request.
    1. changeset-bot[bot](GitHub profile, opens in a new tab)commented

      🦋 Changeset detected

      Latest commit: 74e022c1250b31d51856b433902b1c15ee58bc52

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 24 packages
      NameType
      @tanstack/dbPatch
      @tanstack/angular-dbPatch
      @tanstack/capacitor-db-sqlite-persistence-e2e-appPatch
      @tanstack/db-sqlite-persistence-corePatch
      @tanstack/electric-db-collectionPatch
      @tanstack/expo-db-sqlite-persistence-e2e-appPatch
      @tanstack/offline-transactionsPatch
      @tanstack/powersync-db-collectionPatch
      @tanstack/query-db-collectionPatch
      @tanstack/react-dbPatch
      @tanstack/rxdb-db-collectionPatch
      @tanstack/solid-dbPatch
      @tanstack/svelte-dbPatch
      @tanstack/tauri-db-sqlite-persistence-e2e-appPatch
      @tanstack/trailbase-db-collectionPatch
      @tanstack/vue-dbPatch
      @tanstack/browser-db-sqlite-persistencePatch
      @tanstack/capacitor-db-sqlite-persistencePatch
      @tanstack/cloudflare-durable-objects-db-sqlite-persistencePatch
      @tanstack/electron-db-sqlite-persistencePatch
      @tanstack/expo-db-sqlite-persistencePatch
      @tanstack/node-db-sqlite-persistencePatch
      @tanstack/react-native-db-sqlite-persistencePatch
      @tanstack/tauri-db-sqlite-persistencePatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      Incremental update benchmark

      Comparing 255e15f2 (this PR) against ce0b4a98 (base). Write times are per-write medians over 100 iterations (20 warmup writes). Cold hydrate is one timed first load of each query.

      Overall median write time vs base: 0.97× · cold hydrate time: 1.01× (geometric mean of per-case ratios; lower is faster).

      Writes: 0 regression(s), 3 improvement(s) (threshold: ±20% and >0.05ms).

      Cold hydrate: 0 regression(s), 1 improvement(s) (threshold: ±50% and >5ms).

      Per-case flags are noisy on shared runners. Read the geometric means first.

      Writes

      QueryΔ median write time (geomean)Best caseWorst caseFlags
      list: newest 50 open-1.5%-32.7%+20.7%—
      list + author-2.0%-7.9%+3.2%—
      list + comment count-4.2%-45.7%+8.9%1 🟢
      list + 3 recent comments-5.2%-36.3%+13.5%1 🟢
      issue detail + comments-2.7%-33.2%+9.3%1 🟢

      Cold hydrate

      QueryΔ cold hydrate time (geomean)Best caseWorst caseFlags
      list: newest 50 open+3.7%-34.8%+79.2%—
      list + author-4.1%-21.8%+14.6%—
      list + comment count+4.3%-23.6%+94.4%—
      list + 3 recent comments+2.9%-27.6%+56.9%—
      issue detail + comments-6.5%-64.1%+28.7%1 🟢

      Each row aggregates the 14.4 scale/index/write-mode configurations of that query; per-configuration tables below.

      100 rows/collection | source indexes: none | synced writes — geomean 0.96×, cold 1.03×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.203ms0.205ms+1.2%0.364ms0.355ms-2.3%14.045ms13.665ms-2.7%
      list: newest 50 open0.483ms0.487ms+0.8%0.699ms0.726ms+3.8%3.007ms3.569ms+18.7%
      list + author0.225ms0.207ms-7.9%0.349ms0.379ms+8.7%9.729ms9.765ms+0.4%
      list + comment count0.431ms0.416ms-3.4%0.674ms0.631ms-6.4%16.047ms12.265ms-23.6%
      list + 3 recent comments0.245ms0.217ms-11.4%0.378ms0.344ms-9.1%11.208ms12.820ms+14.4%
      issue detail + comments0.158ms0.159ms+0.2%0.266ms0.225ms-15.3%1.609ms1.872ms+16.4%
      100 rows/collection | source indexes: none | optimistic writes — geomean 1.01×, cold 1.15×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.139ms0.138ms-0.3%0.225ms0.237ms+5.3%3.322ms4.361ms+31.3%
      list: newest 50 open0.366ms0.366ms+0.3%0.622ms0.629ms+1.0%2.035ms2.179ms+7.1%
      list + author0.161ms0.163ms+1.7%0.270ms0.306ms+13.3%5.164ms4.038ms-21.8%
      list + comment count0.231ms0.231ms+0.0%0.406ms0.430ms+5.7%3.488ms4.545ms+30.3%
      list + 3 recent comments0.143ms0.137ms-4.2%0.276ms0.256ms-7.3%5.842ms9.164ms+56.9%
      issue detail + comments0.116ms0.127ms+9.3%0.210ms0.216ms+2.7%0.770ms0.797ms+3.5%
      100 rows/collection | source indexes: manual | synced writes — geomean 1.01×, cold 1.06×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.117ms0.105ms-10.3%0.222ms0.179ms-19.3%3.107ms2.907ms-6.4%
      list: newest 50 open0.418ms0.434ms+3.8%0.607ms0.615ms+1.2%1.117ms1.211ms+8.4%
      list + author0.179ms0.180ms+0.5%0.250ms0.293ms+17.1%4.177ms4.750ms+13.7%
      list + comment count0.245ms0.250ms+2.1%0.439ms0.434ms-1.1%5.035ms5.288ms+5.0%
      list + 3 recent comments0.158ms0.165ms+4.6%0.249ms0.220ms-11.7%4.251ms4.151ms-2.4%
      issue detail + comments0.120ms0.126ms+4.5%0.220ms0.243ms+10.2%0.464ms0.549ms+18.3%
      100 rows/collection | source indexes: manual | optimistic writes — geomean 1.02×, cold 1.09×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.105ms0.108ms+2.6%0.203ms0.179ms-11.6%0.991ms1.289ms+30.1%
      list: newest 50 open0.290ms0.285ms-1.5%0.509ms0.488ms-4.2%1.080ms1.065ms-1.4%
      list + author0.138ms0.142ms+3.2%0.230ms0.234ms+1.5%2.839ms2.591ms-8.7%
      list + comment count0.197ms0.214ms+8.9%0.329ms0.341ms+3.5%2.449ms2.994ms+22.2%
      list + 3 recent comments0.127ms0.123ms-3.4%0.206ms0.205ms-0.4%4.577ms4.139ms-9.6%
      issue detail + comments0.106ms0.108ms+1.3%0.143ms0.171ms+19.5%0.407ms0.524ms+28.7%
      1,000 rows/collection | source indexes: none | synced writes — geomean 0.92×, cold 0.89×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.131ms0.088ms-32.7%0.175ms0.174ms-0.6%10.771ms7.023ms-34.8%
      list: newest 50 open1.073ms1.058ms-1.4%1.365ms1.988ms+45.7%8.462ms9.168ms+8.3%
      list + author0.109ms0.105ms-3.5%0.141ms0.140ms-1.0%22.642ms19.526ms-13.8%
      list + comment count0.192ms0.189ms-1.6%0.242ms0.222ms-8.4%9.938ms7.761ms-21.9%
      list + 3 recent comments0.131ms0.133ms+1.2%0.231ms0.277ms+19.7%10.247ms9.070ms-11.5%
      issue detail + comments0.156ms0.153ms-2.1%0.214ms0.264ms+23.4%1.236ms1.448ms+17.2%
      1,000 rows/collection | source indexes: none | optimistic writes — geomean 1.03×, cold 1.02×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.142ms0.172ms+20.7%0.198ms0.238ms+20.4%9.738ms9.288ms-4.6%
      list: newest 50 open1.221ms1.249ms+2.3%2.189ms1.779ms-18.7%5.260ms6.265ms+19.1%
      list + author0.132ms0.129ms-2.0%0.187ms0.224ms+19.4%21.979ms20.302ms-7.6%
      list + comment count0.191ms0.188ms-1.6%0.317ms0.299ms-5.6%8.723ms8.699ms-0.3%
      list + 3 recent comments0.115ms0.113ms-1.1%0.144ms0.161ms+11.7%9.496ms9.794ms+3.1%
      issue detail + comments0.106ms0.105ms-1.6%0.189ms0.188ms-0.6%1.012ms1.061ms+4.8%
      1,000 rows/collection | source indexes: manual | synced writes — geomean 0.98×, cold 1.05×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.080ms0.076ms-5.0%0.106ms0.103ms-2.9%1.030ms1.043ms+1.2%
      list: newest 50 open0.309ms0.290ms-5.9%0.546ms0.558ms+2.2%1.065ms1.403ms+31.7%
      list + author0.108ms0.106ms-1.3%0.140ms0.160ms+14.4%1.872ms1.896ms+1.3%
      list + comment count0.225ms0.219ms-2.6%0.357ms0.271ms-24.0%2.678ms2.750ms+2.7%
      list + 3 recent comments0.146ms0.147ms+0.7%0.194ms0.203ms+4.6%5.605ms5.287ms-5.7%
      issue detail + comments0.107ms0.107ms+0.0%0.137ms0.135ms-0.9%0.392ms0.394ms+0.5%
      1,000 rows/collection | source indexes: manual | optimistic writes — geomean 0.87×, cold 0.90×, 2 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.094ms0.090ms-4.6%0.172ms0.118ms-31.4%0.763ms0.782ms+2.5%
      list: newest 50 open0.273ms0.286ms+4.8%0.332ms0.482ms+45.3%1.009ms0.817ms-19.0%
      list + author0.121ms0.118ms-1.9%0.149ms0.147ms-1.4%2.115ms2.006ms-5.2%
      list + comment count0.193ms0.200ms+3.2%0.317ms0.329ms+3.7%2.578ms2.642ms+2.5%
      list + 3 recent comments0.189ms0.120ms-36.3%0.229ms0.172ms-24.8%🟢3.929ms4.309ms+9.7%
      issue detail + comments0.161ms0.108ms-33.2%0.204ms0.187ms-8.4%🟢0.586ms0.360ms-38.5%
      10,000 rows/collection | source indexes: none | synced writes — geomean 1.02×, cold 0.94×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.122ms0.121ms-1.2%0.159ms0.159ms-0.2%62.900ms64.728ms+2.9%
      list: newest 50 open9.933ms10.112ms+1.8%10.510ms10.718ms+2.0%55.290ms55.096ms-0.4%
      list + author0.141ms0.137ms-3.0%0.217ms0.211ms-2.9%203.812ms200.156ms-1.8%
      list + comment count0.202ms0.199ms-1.6%0.274ms0.335ms+22.3%76.848ms72.908ms-5.1%
      list + 3 recent comments0.140ms0.159ms+13.5%0.242ms0.272ms+12.4%99.444ms93.288ms-6.2%
      issue detail + comments0.103ms0.104ms+0.8%0.131ms0.134ms+2.6%9.108ms6.826ms-25.1%
      10,000 rows/collection | source indexes: none | optimistic writes — geomean 0.99×, cold 0.86×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.101ms0.104ms+2.9%0.179ms0.200ms+11.3%67.022ms65.838ms-1.8%
      list: newest 50 open11.034ms11.171ms+1.2%11.717ms11.917ms+1.7%54.251ms53.670ms-1.1%
      list + author0.125ms0.120ms-3.6%0.174ms0.151ms-13.1%194.774ms187.120ms-3.9%
      list + comment count0.224ms0.223ms-0.6%0.338ms0.264ms-22.0%76.647ms72.670ms-5.2%
      list + 3 recent comments0.116ms0.116ms-0.1%0.157ms0.146ms-6.9%72.714ms94.305ms+29.7%
      issue detail + comments0.114ms0.108ms-4.8%0.146ms0.169ms+15.4%16.729ms6.000ms-64.1%🟢
      10,000 rows/collection | source indexes: manual | synced writes — geomean 0.87×, cold 0.88×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.096ms0.082ms-14.9%0.145ms0.112ms-23.0%3.373ms2.360ms-30.0%
      list: newest 50 open0.939ms0.931ms-0.8%1.410ms1.489ms+5.6%1.673ms1.608ms-3.9%
      list + author0.110ms0.102ms-7.1%0.141ms0.154ms+9.3%2.801ms2.510ms-10.4%
      list + comment count0.397ms0.216ms-45.7%0.523ms0.251ms-52.1%🟢3.937ms3.550ms-9.8%
      list + 3 recent comments0.149ms0.147ms-0.8%0.182ms0.274ms+50.8%6.248ms4.526ms-27.6%
      issue detail + comments0.112ms0.114ms+2.6%0.209ms0.147ms-29.9%0.604ms0.699ms+15.8%
      10,000 rows/collection | source indexes: manual | optimistic writes — geomean 1.00×, cold 1.29×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.101ms0.115ms+14.1%0.197ms0.194ms-1.8%1.535ms2.752ms+79.2%
      list: newest 50 open0.944ms0.933ms-1.2%1.030ms0.989ms-3.9%1.697ms1.794ms+5.7%
      list + author0.121ms0.124ms+1.9%0.157ms0.198ms+26.0%2.670ms3.061ms+14.6%
      list + comment count0.236ms0.255ms+8.2%0.305ms0.411ms+34.6%3.236ms6.292ms+94.4%
      list + 3 recent comments0.160ms0.135ms-15.5%0.275ms0.216ms-21.3%4.134ms4.394ms+6.3%
      issue detail + comments0.118ms0.115ms-2.3%0.206ms0.151ms-26.5%0.564ms0.581ms+3.1%
      Runner: node v24.8.0, linux 6.17.0-1022-azure, AMD EPYC 7763 64-Core Processor. Timings on shared CI runners are noisy; treat small deltas as indicative only.
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Note

      Reviews paused

      It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

      • Last reviewed commit: 3aca442c6549048246379661f2dcc133f12d0d53
      • Latest commit, not reviewed: 74e022c1250b31d51856b433902b1c15ee58bc52

      Use the following commands to manage reviews:

      • @coderabbitai resume to resume automatic reviews.
      • @coderabbitai review to trigger a single review.

      Use the checkboxes below for quick actions:

      • ▶️ Resume reviews
      • 🔍 Trigger review

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: d8a4a3d2-a4ef-47c4-8951-a0da2e94bff1
      📥 Commits

      Reviewing files that changed from the base of the PR and between 1e4bba40ca789147ec65b38f5bb90bcd584d3ee5 and 3aca442c6549048246379661f2dcc133f12d0d53.

      📒 Files selected for processing: 5
      • docs/contributing/oracle-coverage.md
      • docs/contributing/oracle-reviews/issue-2152-initial-ordered-fallback.md
      • packages/db/src/query/live/ARCHITECTURE.md
      • packages/db/src/query/live/ordered-source-loader.ts
      • packages/db/tests/query/ordered-lifecycle-oracle.property.test.ts
      🚧 Files skipped from review as they are similar to previous changes: 2
      • packages/db/src/query/live/ARCHITECTURE.md
      • docs/contributing/oracle-coverage.md

      Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

      📝 Walkthrough

      The ordered loader now settles full-source requests synchronously when they have no ordering-repair debt. Initial ordered fallbacks are included in the readiness cut while the first window remains unpublished. Tests cover database, React, and Query DB behavior.

      Changes: Initial ordered fallback

      Layer / File(s)Summary
      Fallback settlement and readiness contract
      packages/db/src/query/live/ordered-source-loader.ts, packages/db/src/query/live/ARCHITECTURE.md
      The loader permits synchronous settlement for full-source requests without ordering-repair debt. The architecture notes include a pre-publication fallback in the initial readiness cut and retain exclusions for later full-source work and repair.
      Lifecycle oracle and readiness cases
      packages/db/tests/query/ordered-lifecycle-oracle.property.test.ts
      The oracle covers indexed and unindexed locale-string fallback cases, tied and distinct rows, and synchronous and Promise results. It checks request traces, immediate readiness, settled results, and publication. Warm-readiness cases cover preload-started and constructor-started sync.
      Receiving tests and supporting records
      packages/react-db/tests/conformance.test.tsx, packages/query-db-collection/tests/query.test.ts, .changeset/fix-initial-ordered-fallback.md, docs/contributing/oracle-coverage.md, docs/contributing/oracle-reviews/issue-2152-initial-ordered-fallback.md
      React tests check first-commit readiness. Query DB tests check warm-query readiness without another fetch. The changeset and contributor records describe the contract, checks, and evidence limits.

      Priority: ⬇️ Low

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Possibly related PRs

      • TanStack/db#2055: Adds bounded-prefix acquisition and ordered-loader settlement rules. This PR also changes settlement behavior in the ordered loader.
      • TanStack/db#1896: Defines the initial ordered-readiness cut. This PR includes a pre-publication full-source fallback in that initial request chain.
      Merge Risk: ⚪ Minimal · up to 3aca4

      No actionable merge-blocking risk is identified; the change is ready for normal merge checks.

      Pre-merge checks: Passed 4 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (3 skipped: 3 …Write docstrings for the functions missing them to satisfy the coverage threshold.
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Linked Issues checkPassedIssue [#2152] requires the initial ordered string query to publish its full-source fallback in the initial synchronous cut. OrderedSourceLoader.observe now permits synchronous settlement for a liter…
      Out of Scope Changes checkPassedThe loader change directly addresses [#2152]. The architecture and oracle documents define the timing contract and its limits. The lifecycle, React, and Query DB tests verify the changed behavior. The…
      Title checkPassedThe title is concise, specific, and accurately summarizes the main change: synchronous publication of the initial ordered fallback.
      Description checkPassedThe description includes the required Changes, Checklist, and Release Impact sections. It clearly explains the motivation, implementation scope, limitations, tests, verification results, and changeset…
      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (3 skipped: 3 unsupported.)

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches: 💡 1
      📝 Generate docstrings: 💡
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    4. pkg-pr-new[bot](GitHub profile, opens in a new tab)commented
      More templates

      @tanstack/angular-db

      npm i https://pkg.pr.new/@tanstack/angular-db@2159

      @tanstack/browser-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/browser-db-sqlite-persistence@2159

      @tanstack/capacitor-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/capacitor-db-sqlite-persistence@2159

      @tanstack/cloudflare-durable-objects-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/cloudflare-durable-objects-db-sqlite-persistence@2159

      @tanstack/db

      npm i https://pkg.pr.new/@tanstack/db@2159

      @tanstack/db-ivm

      npm i https://pkg.pr.new/@tanstack/db-ivm@2159

      @tanstack/db-sqlite-persistence-core

      npm i https://pkg.pr.new/@tanstack/db-sqlite-persistence-core@2159

      @tanstack/electric-db-collection

      npm i https://pkg.pr.new/@tanstack/electric-db-collection@2159

      @tanstack/electron-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/electron-db-sqlite-persistence@2159

      @tanstack/expo-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/expo-db-sqlite-persistence@2159

      @tanstack/node-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/node-db-sqlite-persistence@2159

      @tanstack/offline-transactions

      npm i https://pkg.pr.new/@tanstack/offline-transactions@2159

      @tanstack/powersync-db-collection

      npm i https://pkg.pr.new/@tanstack/powersync-db-collection@2159

      @tanstack/query-db-collection

      npm i https://pkg.pr.new/@tanstack/query-db-collection@2159

      @tanstack/react-db

      npm i https://pkg.pr.new/@tanstack/react-db@2159

      @tanstack/react-native-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/react-native-db-sqlite-persistence@2159

      @tanstack/react-router-with-db

      npm i https://pkg.pr.new/@tanstack/react-router-with-db@2159

      @tanstack/rxdb-db-collection

      npm i https://pkg.pr.new/@tanstack/rxdb-db-collection@2159

      @tanstack/solid-db

      npm i https://pkg.pr.new/@tanstack/solid-db@2159

      @tanstack/svelte-db

      npm i https://pkg.pr.new/@tanstack/svelte-db@2159

      @tanstack/tauri-db-sqlite-persistence

      npm i https://pkg.pr.new/@tanstack/tauri-db-sqlite-persistence@2159

      @tanstack/trailbase-db-collection

      npm i https://pkg.pr.new/@tanstack/trailbase-db-collection@2159

      @tanstack/vue-db

      npm i https://pkg.pr.new/@tanstack/vue-db@2159

      commit: 74e022c

    5. github-actions[bot](GitHub profile, opens in a new tab)commented

      Size Change: -27 B (-0.01%)

      Total Size: 216 kB

      📦 View Changed
      FilenameSizeChange
      packages/db/dist/esm/query/live/ordered-source-loader.js4.46 kB-27 B (-0.6%)
      ℹ️ View Unchanged
      FilenameSize
      packages/db/dist/esm/client.js4.22 kB
      packages/db/dist/esm/collection-options-brand.js219 B
      packages/db/dist/esm/collection-options.js258 B
      packages/db/dist/esm/collection/change-events.js1.76 kB
      packages/db/dist/esm/collection/changes.js2.96 kB
      packages/db/dist/esm/collection/cleanup-queue.js901 B
      packages/db/dist/esm/collection/config-errors.js547 B
      packages/db/dist/esm/collection/events.js481 B
      packages/db/dist/esm/collection/index.js5.23 kB
      packages/db/dist/esm/collection/indexes.js2.3 kB
      packages/db/dist/esm/collection/lifecycle.js2.94 kB
      packages/db/dist/esm/collection/mutations.js2.99 kB
      packages/db/dist/esm/collection/state.js7.13 kB
      packages/db/dist/esm/collection/subscription.js8.84 kB
      packages/db/dist/esm/collection/sync.js5.32 kB
      packages/db/dist/esm/collection/validate-config.js1.17 kB
      packages/db/dist/esm/deferred.js207 B
      packages/db/dist/esm/error-message.js642 B
      packages/db/dist/esm/errors.js6.53 kB
      packages/db/dist/esm/event-emitter.js1.06 kB
      packages/db/dist/esm/index.js4.51 kB
      packages/db/dist/esm/indexed-db-wrapper.js1.91 kB
      packages/db/dist/esm/indexed-db.js3.7 kB
      packages/db/dist/esm/indexes/auto-index.js926 B
      packages/db/dist/esm/indexes/base-index.js1.92 kB
      packages/db/dist/esm/indexes/basic-index.js1.93 kB
      packages/db/dist/esm/indexes/btree-index.js1.62 kB
      packages/db/dist/esm/indexes/index-registry.js916 B
      packages/db/dist/esm/indexes/reverse-index.js1.01 kB
      packages/db/dist/esm/live-query-adapter.js338 B
      packages/db/dist/esm/live-query-observer.js4.8 kB
      packages/db/dist/esm/live-query-options.js1.4 kB
      packages/db/dist/esm/live-query-window-controller.js4.27 kB
      packages/db/dist/esm/local-only.js1.08 kB
      packages/db/dist/esm/local-storage.js3.93 kB
      packages/db/dist/esm/optimistic-action.js359 B
      packages/db/dist/esm/paced-mutations.js1.11 kB
      packages/db/dist/esm/persisted-readiness.js195 B
      packages/db/dist/esm/proxy.js3.51 kB
      packages/db/dist/esm/query/builder/clone-query.js849 B
      packages/db/dist/esm/query/builder/functions.js1.56 kB
      packages/db/dist/esm/query/builder/index.js7.48 kB
      packages/db/dist/esm/query/builder/query-ir.js312 B
      packages/db/dist/esm/query/builder/ref-proxy-identity.js292 B
      packages/db/dist/esm/query/builder/ref-proxy.js1.67 kB
      packages/db/dist/esm/query/builder/wrapper-identity.js221 B
      packages/db/dist/esm/query/compiler/evaluators.js2.51 kB
      packages/db/dist/esm/query/compiler/expressions.js603 B
      packages/db/dist/esm/query/compiler/group-by.js4.48 kB
      packages/db/dist/esm/query/compiler/index.js10.3 kB
      packages/db/dist/esm/query/compiler/joins.js3.42 kB
      packages/db/dist/esm/query/compiler/lazy-targets.js1.11 kB
      packages/db/dist/esm/query/compiler/order-by.js2.26 kB
      packages/db/dist/esm/query/compiler/parent-routes.js319 B
      packages/db/dist/esm/query/compiler/query-equivalence.js568 B
      packages/db/dist/esm/query/compiler/route-metadata.js1.24 kB
      packages/db/dist/esm/query/compiler/select.js1.5 kB
      packages/db/dist/esm/query/effect.js5.26 kB
      packages/db/dist/esm/query/equality-conjunct.js486 B
      packages/db/dist/esm/query/equality-value-identity.js735 B
      packages/db/dist/esm/query/expression-helpers.js1.61 kB
      packages/db/dist/esm/query/ir-stable-identity.js4.2 kB
      packages/db/dist/esm/query/ir.js2.2 kB
      packages/db/dist/esm/query/join-conditions.js257 B
      packages/db/dist/esm/query/live-query-collection.js391 B
      packages/db/dist/esm/query/live/bucket-facade-adapter.js3.17 kB
      packages/db/dist/esm/query/live/collection-config-builder.js6.84 kB
      packages/db/dist/esm/query/live/collection-registry.js264 B
      packages/db/dist/esm/query/live/collection-subscriber.js2.2 kB
      packages/db/dist/esm/query/live/graph-scheduler.js305 B
      packages/db/dist/esm/query/live/internal.js145 B
      packages/db/dist/esm/query/live/materialized-pipeline.js2.39 kB
      packages/db/dist/esm/query/live/subset-demand-controller.js1.73 kB
      packages/db/dist/esm/query/live/utils.js1.35 kB
      packages/db/dist/esm/query/optimizer.js2.95 kB
      packages/db/dist/esm/query/pooled-live-query.js4.13 kB
      packages/db/dist/esm/query/query-once.js359 B
      packages/db/dist/esm/query/runtime-reference-identity.js630 B
      packages/db/dist/esm/query/subset-dedupe.js493 B
      packages/db/dist/esm/scheduler.js1.23 kB
      packages/db/dist/esm/SortedMap.js1.6 kB
      packages/db/dist/esm/strategies/commit-completion.js156 B
      packages/db/dist/esm/strategies/debounceStrategy.js658 B
      packages/db/dist/esm/strategies/queueStrategy.js523 B
      packages/db/dist/esm/strategies/serial-pacer.js486 B
      packages/db/dist/esm/strategies/throttleStrategy.js738 B
      packages/db/dist/esm/sync-persistence.js626 B
      packages/db/dist/esm/sync-receipt.js211 B
      packages/db/dist/esm/transaction-commit-work.js351 B
      packages/db/dist/esm/transactions.js4.61 kB
      packages/db/dist/esm/utils.js1.67 kB
      packages/db/dist/esm/utils/array-utils.js270 B
      packages/db/dist/esm/utils/browser-polyfills.js304 B
      packages/db/dist/esm/utils/btree.js3.02 kB
      packages/db/dist/esm/utils/callbacks.js174 B
      packages/db/dist/esm/utils/comparison.js1.94 kB
      packages/db/dist/esm/utils/cursor.js753 B
      packages/db/dist/esm/utils/error.js262 B
      packages/db/dist/esm/utils/get-or-create.js155 B
      packages/db/dist/esm/utils/index-optimization.js2.43 kB
      packages/db/dist/esm/utils/source-record.js140 B
      packages/db/dist/esm/utils/type-guards.js230 B
      packages/db/dist/esm/utils/uuid.js530 B
      packages/db/dist/esm/virtual-props.js413 B
      packages/react-db/dist/esm/DbProvider.js317 B
      packages/react-db/dist/esm/development.js190 B
      packages/react-db/dist/esm/HydrationBoundary.js263 B
      packages/react-db/dist/esm/index.js330 B
      packages/react-db/dist/esm/live-query-internals.js282 B
      packages/react-db/dist/esm/source-id-bindings.js746 B
      packages/react-db/dist/esm/useLiveInfiniteQuery.js2.15 kB
      packages/react-db/dist/esm/useLiveQuery.js3.34 kB
      packages/react-db/dist/esm/useLiveQueryEffect.js504 B
      packages/react-db/dist/esm/useLiveSuspenseQuery.js1.33 kB
      packages/react-db/dist/esm/usePacedMutations.js401 B
      compressed-size-action::db-and-react-package-size
    6. 🔇 Additional comments: 1
      docs/contributing/oracle-coverage.md-490-490: 1

      490-490: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

      ⚠️ Unverified finding Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

      Hyphenate the compound modifier.

      Change “a second order term” to “a second-order term.”

      Source: Linters/SAST tools


      ℹ️ Review info
      ⚙️ Run configuration
      • Configuration used: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 5b544561-5ada-4ef0-a65e-c6d5ae5e213f
      📥 Commits

      Reviewing files that changed from the base of the PR and between 0c035b0da8c4647aa8cfca73c04316cdfe85863a and 6bc9439922b8c6d857ef072765bd0bbceebb7a51.

      📒 Files selected for processing: 3
      • docs/contributing/oracle-coverage.md
      • docs/contributing/oracle-reviews/issue-2152-initial-ordered-fallback.md
      • packages/db/tests/query/ordered-lifecycle-oracle.property.test.ts
      🚧 Files skipped from review as they are similar to previous changes: 1
      • docs/contributing/oracle-reviews/issue-2152-initial-ordered-fallback.md

      Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

    7. KyleAMathews merged thisa09ba67

    8. KyleAMathews closed this

    9. 🎉 This PR has been released!

      Thank you for your contribution!

Sign in to join this conversation.