Skip to content
Source
Sign inSign up
TanStack/db

fix(db): preserve observer row sharing and freshness #2346

MergedKyleAMathewsmerged 13 commits intomain fromrefs/pull/2346/headmerged by KyleAMathews

KyleAMathewscommented

🎯 Changes

Status and health updates replace the observer's row containers even when no rows change. Consumers that compare those containers by reference can repeat row work after each metadata update.

Capture each row revision once and share its data array and lazy state Map across metadata snapshots. Metadata changes still produce a fresh full snapshot with current status and health. Value writes replace the row containers, and retained snapshots keep their captured rows. Membership and ordering changes remain visible through layoutRevision. Actions that change no public fact retain the full snapshot identity.

The cache trusts Collection's row and layout clocks. Equal-content writes can create fresh virtual wrappers without changing those clocks, so snapshots keep their existing capture. This PR also fixes three freshness hazards at that boundary:

  • Discarding deferred delivery keeps committed row revisions monotonic. Restoring a discarded layout clock also advances row invalidation, so a detached observer cannot retain an obsolete capture when clock numbers repeat.
  • Replacing a nested plain record with a class or null-prototype record publishes an update, even when its enumerable fields match. This follows the maintainer's approved prototype policy. Draft reconstruction keeps its separate class/plain equivalence.
  • Replacing an array hole with a defined value publishes the update. Previously, a hole-skipping comparison could change Collection reads without advancing its clock, leaving observers stale. A hole still compares equal to undefined.

Supported inputs are Collections and pooled views from this DB instance. Reject absent or non-finite revision clocks before client binding, row reads, or sync activation. Pooled views use their ordinary change stream for layout updates, so the separate layout channel stays optional. Remove the unsupported clockless compatibility branch and check clocks before enumerating unchanged rows. Apply client hydration captures once through the publication queue. The cache keeps references to the live capture and last materialized visible capture, which can differ between publication and a read.

Review also found factorial Set comparison and a quadratic common-case regression in its first fix. First compare corresponding members, which establishes equality in linear work for paired equal inputs. Otherwise, build candidates and find a one-to-one assignment, preferring free candidates before reassignment. The utility oracle checks large equal inputs, multiplicity deficits, and a case that requires reassignment. Generic deepEquals retains its established keyed-class/plain/null/cross-realm record policy. Only Collection row equality gains the approved prototype distinction.

This preserves @benjavicente's original commit from #2328 and adds the oracle, freshness, and size improvements. The source PR disables maintainer edits, so this PR contains the follow-up changes. Production changes affect the shared observer, Collection invalidation, and equality utility in @tanstack/db. Framework adapter sources stay unchanged. The Angular adapter's separate row-state projection belongs to #2327. The latest combined tree with that PR remains unverified.

The size comparison uses current main 1443dc92e, identical production defines, and identical compression:

MeasurementDelta
Observer module, minified−408 bytes
Collection changes, minified−7 bytes
Equality utility, minified+186 bytes
Net production, minified−229 bytes
DB export bundle, gzip−97 bytes
DB export bundle, brotli+50 bytes

All eight app scenarios shrink by 49–83 gzip bytes. Brotli changes range from −161 to +55 bytes. The DB export and group-by scenario grow under brotli compression. A deterministic unchanged granular-attachment probe reduces row enumerations from two to one. The remaining enumeration is Collection subscription bootstrap. A real hydration handoff applies the observer cache once instead of twice. The prototype check adds no traversal and uses prototypes the comparison already reads.

🔬 Oracle Coverage

The primary snapshot owner is packages/db/tests/live-query-observer-snapshot-oracle.property.test.ts. Its sharing, capture-path, and record-shape properties check independent row/rank and shape/number models.

  • Law: Metadata changes preserve row containers, writes and layout changes remain visible, retained snapshots keep their rows, and no-op actions preserve snapshot identity. Collection invalidation stays monotonic across discarded delivery. Record prototypes publish under the 2026-11-03 maintainer decision. The observer and Collection contracts supply the other laws.
  • Reach: Sharing runs 24 examples plus 40 generated histories per campaign, with 17 states. Capture paths run 16 examples plus 40 generated histories, with 27 states. Record shape runs 16 examples plus 40 generated histories, with 12 states. Every shape history exercises direct Collection and projected-query receivers. Both fixed and random campaigns meet all declared minima. No run budget decreases.
  • RED: The merge-base observer fails metadata sharing. Head e02e09c70 fails equal-refresh attachment sharing. Unchanged 71bb4c659 fails eight intended assertions in the extended five-owner gate. These include discarded value/layout captures and prototype replacements through both receivers. Clock seed 2346, path 0, retains version 2 instead of 3. Shape seed 234602, path 0:1:0:2:2, retains plain shape after a class replacement.
  • GREEN: The final audit gate passes 508 tests in eleven focused suites. These cover utilities, snapshots, observer delivery, pooled views, draft tracking, production errors, and generated docs. Angular ordinary and conformance tests also pass: 109 tests plus one todo, with no type errors. TypeScript, ESLint, changed-file lint, minified API, error erasure, and mangle checks pass. The earlier merged-main gate passed 1,868 tests in 16 suites. The gate includes the Effect metadata/callback owner. Focused TypeScript, ESLint, changed-file oracle lint, mangle validation, minified build, and public API checks pass. The merged gate repeats all three hostile mutants and guarded replays. Guarded direct replay passes each requested clock and shape witness.
  • Mutant: Restoring row-clock rollback fails value freshness. Omitting only the discarded-layout fence fails ordering after the value case passes. Restoring class/plain equality fails both shape receivers. Earlier wrapper-comparison, no-op identity, layout, cardinality, and health mutants remain documented.
  • Set work and pooled views: The small utility lane runs 100 fixed and 100 random histories with thirteen states, each reached 200 times. Independent counts and capacity judge each comparison domain. The large paired lane adds ten histories per campaign and eight states, each reached 20 times. Its widths span 1,024–3,072. Scalar-read and scoped native-operation ceilings are linear for this paired family. The original matcher and precheck-only mutant exceed the cubic scalar-read ceiling. Candidate reuse fails equality. The pooled owner compares wholesale, granular and detached readers in all 160 generated histories. Before the fix, subscription throws on the absent channel. A silent fallback fails the granular mirror assertion. The final source gate passes 190 tests, the built-dist gate passes 357, Preact conformance passes 136, and pooled GC passes 21.
  • CI counter overhead: Both Set campaigns exceeded the five-second timeout in the database shard. The scalar-read counter now allocates diagnostics only when its unchanged ceiling fails. All 87 utility tests and the combined 100-test utility/pooled gate pass locally. Every Set reach still records 200 histories. The original matcher still fails at read 2,049 against ceiling 2,048. Inputs, run counts, work limits, and timeouts remain unchanged.
  • Third review calibration: Before fix, paired Set work exceeds 4,096 reads and generic equal-record comparison fails. Ten invalid-clock witnesses also fail before the constructor fix. Removing the paired fast path, restoring strict generic prototypes, using greedy-only matching, and restoring factorial search each fail intended direct-replay observations. Paired Set linearity does not extend to arbitrary unordered inputs or nested-value traversal.
  • Four-agent audit: The sparse-array grammar now distinguishes holes from defined neighbors through both equality APIs, records, and singleton Sets. Seven utility states each reach 200 histories. Fourteen real publication states each reach 20 histories per campaign, including each direct/projected, mode, and attachment path. Unchanged production fails both owners before the indexed fix. Restoring hole skipping fails both guarded replays. Scoped native Map/Set counters reject a cached factorial matcher that scalar reads accepted. The draft model now preserves signed zero and rejects lost writes through root, nested, and Float64 paths. The observer checker comment now states value/order agreement without an unsupported row-reference identity promise. The fixes address all four audit findings. Existing budgets remain unchanged.
  • Limits: These comparisons observe direct core actions and queued query reads. They establish no framework scheduling, provider timing, arbitrary concurrency, cleanup/reset sharing, caller-mutation isolation, or infinite-page-array identity promise. The shape grammar covers sync replacements with keyed record prototypes through records, arrays, Map values, and Set members. Exotic built-in subclasses, descriptors, cycles, and optimistic assignment policy remain outside that grammar.

From packages/db, run the snapshot owner with:

pnpm exec vitest run tests/live-query-observer-snapshot-oracle.property.test.ts --coverage.enabled=false --maxWorkers=2

The versioned evidence record contains the laws, reach counts, replay inputs, mutants, measurements, and the external and four-agent review audits. The first review records five fixed findings, three refutations, and two accepted design choices. The second records seven fixed findings, one refutation, and one accepted design choice. The supplement records both CodeRabbit reviews, the Set work fix, and CI corrections. The third external review records five fixes, one accepted readonly-sharing design, and the explicitly separate draft bug #2349. Editing a nested sibling can temporarily strip an untouched class/null-prototype leaf. The maintainer identified that bug and kept its fix outside this PR. No known counterexample remains in the metadata-sharing and discarded-publication scope. The separate cleanup/restart issue #2334 remains open. Its shared-model trace also fails after readiness in both modes on 162eebf39. The coverage map records its owner and next witness. This PR does not establish general observer lifecycle correctness. The coverage map records the owners and their limits.

✅ Checklist

  • I have tested this code locally with pnpm test.

The full workspace suite did not run locally. The focused gates above pass. CI for 22da3b06e completed with 25 successful checks and one skipped CodeRabbit check. CI for 779466c62 found the missing generated error page and an Angular test mock without a layout clock. The fixes address both mechanical omissions. CI for 5911d5e00 found five source-type errors in the new sparse-array driver and a separate ordered-loader oracle failure. The driver correction passes both sparse campaigns, the full DB TypeScript source check, ESLint, and changed-file lint. The original sparse-array mutant still fails all receiving paths. The loader failure reproduces identically on exact main 1443dc92e; its seed, shrink path, full trace, owner, and next experiment are preserved in the coverage map. Its repair location remains unresolved. The independently replayed trace is tracked in #2296. The maintainer approved merging this scoped observer fix with that investigation tracked separately. No test, budget, or seed was changed to bypass it. CI for corrected head acdfb6f14 completed successfully: 25 successful checks and one skipped CodeRabbit check. Production remains at ba336f4b2. CodeRabbit is paused and its latest covered production commit remains 162eebf39; it has not reviewed the later semantic changes. This green random campaign does not close the recorded loader counterexample, the separate #2334 cleanup/restart defect, or the unverified combined #2327 integration. General readiness remains unproven. The separate Electric sampling reach issue remains tracked in #2347.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset (observer-row-container-sharing.md, preserved from #2328).
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes
    • Live-query snapshots preserve row data and state containers when only status or health metadata changes. Row value and ordering changes appear in new snapshots, while earlier snapshots retain their point-in-time data.
    • Discarded publication deferrals now invalidate detached observer snapshots when needed, ensuring subsequent reads reflect current collection data.
    • Record comparisons now distinguish plain, class, and null-prototype records, while same-shape equal writes remain equal.
  • Documentation
    • Clarified snapshot-sharing behavior, record-shape equality, and the limits of observer coverage.
    1. changeset-bot[bot](GitHub profile, opens in a new tab)commented

      🦋 Changeset detected

      Latest commit: acdfb6f14a8aebd83824ea88c717c821da3ce685

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

      This PR includes changesets to release 25 packages
      NameType
      @tanstack/dbPatch
      @tanstack/angular-dbPatch
      @tanstack/capacitor-db-sqlite-persistence-e2e-appPatch
      @tanstack/convex-db-collectionPatch
      @tanstack/db-adapter-conformancePatch
      @tanstack/db-sqlite-persistence-corePatch
      @tanstack/electric-db-collectionPatch
      @tanstack/expo-db-sqlite-persistence-e2e-appPatch
      @tanstack/powersync-db-collectionPatch
      @tanstack/preact-dbPatch
      @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. 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: 162eebf398616c0c561b7472557b251ed1cc3a8d
      • Latest commit, not reviewed: acdfb6f14a8aebd83824ea88c717c821da3ce685

      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.

      Walkthrough

      Live-query observers retain captured data and state containers across metadata-only updates and refresh captures from collection revisions. Discarded layout publications advance the state revision. Deep equality distinguishes record prototypes and uses bounded matching for object-valued Sets.

      Changes: Observer capture and revision tracking

      Layer / File(s)Summary
      Revision tracking and observer capture
      packages/db/src/collection/changes.ts, packages/db/src/collection/index.ts, packages/db/src/live-query-observer.ts, packages/db/tests/live-query-observer-snapshot-oracle.property.test.ts, packages/db/tests/live-query-observer.test.ts, packages/db/tests/query/bucket-facade-adapter.test.ts, packages/db/tests/query/pooled-live-query-oracle.property.test.ts, packages/db/tests/oracle-config.ts, packages/db/tests/oracle-replay-manifest.ts, packages/db/mangle-cache.json, .changeset/observer-row-container-sharing.md, docs/contributing/oracle-coverage.md, docs/contributing/oracle-reviews/2026-11-01-observer-row-containers.md
      Discarded layout epochs advance the state revision without rewinding it. The observer refreshes captures when either collection revision changes and reuses data and state containers when row contents remain unchanged. Tests cover metadata updates, capture paths, publication deferrals, and retained snapshots.
      Record shape and Set equality
      packages/db/src/utils.ts, packages/db/tests/utils-oracle.property.test.ts, packages/db/tests/utils.test.ts, packages/db/tests/live-query-observer-snapshot-oracle.property.test.ts, docs/contributing/glossary.md, docs/contributing/oracle-coverage.md, docs/contributing/oracle-reviews/2026-11-01-observer-row-containers.md
      Deep equality distinguishes plain, class, and null-prototype records, with a draft-comparison exception when prototypes differ and at least one is plain. Object-valued Sets use candidate matching with augmenting paths. Tests cover record prototypes, nested payloads, and bounded Set comparisons.

      Estimated code review effort: 4 (Complex) | ~45 minutes

      Change: Bug fix

      Sequence Diagram(s)

      sequenceDiagram
        participant Collection
        participant LiveQueryObserver
        participant Snapshot
        Collection->>LiveQueryObserver: state and layout revisions
        LiveQueryObserver->>Collection: read entries when either revision changes
        LiveQueryObserver->>Snapshot: provide captured data and state containers

      Possibly related issues

      • TanStack/db#2334: The issue concerns observer rows after cleanup and restart. This PR changes capture and revision handling on cleanup paths, but does not claim to fix the reported behavior.
      Merge Risk: Minimal · up to 162ee

      No concrete issue requiring a fix before merge was identified. Normal validation and pending CI should still complete.

      Pre-merge checks: Passed 4 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…Write docstrings for the functions missing them to satisfy the coverage threshold.
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Title checkPassedThe title clearly identifies the main change: preserving observer row sharing and freshness in the database package.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Description checkPassedThe description follows the repository template and provides substantive content. It has a detailed Changes section covering the row-container sharing, the freshness fixes, the Set matching change, an…
      Full details: Description check

      Explanation

      The description follows the repository template and provides substantive content. It has a detailed Changes section covering the row-container sharing, the freshness fixes, the Set matching change, and the size measurements. It also has an Oracle Coverage section naming the owner file, laws, reach counts, RED/GREEN results, mutants, and limits. The checklist and release impact sections are present. The release impact box is checked for a changeset, which matches the raw summary. The description is very long and dense, and the Oracle Coverage section is hard to parse in places. It also contains unresolved items: a known loader counterexample tracked in #2296, a separate draft bug #2349, cleanup/restart issue #2334, and an unverified combined #2327 integration. These are disclosed, not hidden. The checklist item for local tests is unchecked, but the author states focused gates pass and the full workspace suite did not run. The template asks for RED/GREEN evidence for bug fixes, which the description provides. The description is mostly complete and satisfies the template's required information.

      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 9 functions across 12 files. (3 skipped: 3 unsupported.)

      Resolution

      Write docstrings for the functions missing them to satisfy the coverage threshold.

      Finishing Touches
      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

      CodeRabbit Verify

      • Run CodeRabbit Verify to test the changes in this pull request.
      Recent review info
      Run configuration
      • Source mode: Auto
      • Repository: Unavailable
      • Branch: Unavailable
      • File: No configuration file from this repository applied
      • Commit: Unavailable
      • Layers: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: f7be63ef-51ec-4f50-98e5-6d025a4bb292
      Commits

      Reviewing files that changed from the base of the PR and between f66d68490e827393d18d67ba8e3f6ce9e003138a and 162eebf398616c0c561b7472557b251ed1cc3a8d.

      Files selected for processing: 9
      • .changeset/observer-row-container-sharing.md
      • docs/contributing/oracle-coverage.md
      • docs/contributing/oracle-reviews/2026-11-01-observer-row-containers.md
      • packages/db/src/live-query-observer.ts
      • packages/db/src/utils.ts
      • packages/db/tests/oracle-config.ts
      • packages/db/tests/query/bucket-facade-adapter.test.ts
      • packages/db/tests/query/pooled-live-query-oracle.property.test.ts
      • packages/db/tests/utils-oracle.property.test.ts
      Files skipped from review as they are similar to previous changes: 2
      • .changeset/observer-row-container-sharing.md
      • docs/contributing/oracle-reviews/2026-11-01-observer-row-containers.md

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

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

      Incremental update benchmark

      Comparing 65c6d2b5d (this PR) against 1443dc92e (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.96× · cold hydrate time: 1.03× (geometric mean of per-case ratios; lower is faster).

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

      Cold hydrate: 3 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+0.2%-40.2%+49.5%—
      list + author+2.1%-10.7%+49.2%—
      list + comment count-3.6%-39.2%+14.2%1 🟢
      list + 3 recent comments-7.1%-56.3%+33.8%1 🟢
      issue detail + comments-14.1%-60.4%+10.7%1 🟢

      Cold hydrate

      QueryΔ cold hydrate time (geomean)Best caseWorst caseFlags
      list: newest 50 open-2.3%-46.8%+40.5%—
      list + author+8.9%-20.9%+256.1%1 🔴
      list + comment count-10.3%-63.7%+41.5%1 🟢
      list + 3 recent comments+7.5%-44.8%+115.1%1 🔴
      issue detail + comments+20.2%-5.3%+193.2%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 1.05×, cold 1.10×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.109ms0.130ms+19.2%0.226ms0.264ms+16.9%10.811ms9.179ms-15.1%
      list: newest 50 open0.288ms0.295ms+2.6%0.629ms0.529ms-16.0%2.773ms3.896ms+40.5%
      list + author0.100ms0.110ms+10.2%0.206ms0.225ms+8.9%8.745ms9.160ms+4.7%
      list + comment count0.235ms0.267ms+13.8%0.368ms0.426ms+15.5%9.007ms8.203ms-8.9%
      list + 3 recent comments0.136ms0.118ms-13.3%0.233ms0.244ms+4.7%8.610ms7.080ms-17.8%
      issue detail + comments0.067ms0.067ms+0.2%0.138ms0.153ms+10.8%1.512ms2.893ms+91.4%
      100 rows/collection | source indexes: none | optimistic writes — geomean 0.98×, cold 1.07×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.066ms0.079ms+18.9%0.132ms0.149ms+12.9%1.952ms2.088ms+7.0%
      list: newest 50 open0.041ms0.042ms+2.8%0.068ms0.098ms+43.8%1.461ms1.620ms+10.9%
      list + author0.075ms0.071ms-4.8%0.172ms0.164ms-4.8%5.597ms6.924ms+23.7%
      list + comment count0.119ms0.111ms-7.1%0.261ms0.226ms-13.4%3.716ms4.291ms+15.5%
      list + 3 recent comments0.057ms0.059ms+3.5%0.125ms0.131ms+4.9%7.297ms5.942ms-18.6%
      issue detail + comments0.085ms0.066ms-22.3%0.183ms0.155ms-15.6%1.059ms1.133ms+7.0%
      100 rows/collection | source indexes: manual | synced writes — geomean 1.06×, cold 0.99×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.090ms0.087ms-3.9%0.163ms0.140ms-14.4%2.590ms2.937ms+13.4%
      list: newest 50 open0.204ms0.188ms-8.1%0.392ms0.373ms-4.8%1.777ms1.697ms-4.5%
      list + author0.067ms0.099ms+49.2%0.129ms0.145ms+12.8%4.282ms3.443ms-19.6%
      list + comment count0.116ms0.133ms+14.2%0.216ms0.256ms+18.8%3.082ms3.225ms+4.6%
      list + 3 recent comments0.074ms0.071ms-3.3%0.170ms0.154ms-9.0%3.951ms4.297ms+8.8%
      issue detail + comments0.052ms0.052ms-1.2%0.121ms0.104ms-14.1%0.599ms0.572ms-4.5%
      100 rows/collection | source indexes: manual | optimistic writes — geomean 1.04×, cold 1.09×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.048ms0.059ms+22.6%0.107ms0.108ms+0.4%1.198ms1.168ms-2.4%
      list: newest 50 open0.040ms0.042ms+5.3%0.100ms0.099ms-1.3%0.975ms1.127ms+15.5%
      list + author0.063ms0.061ms-2.5%0.127ms0.134ms+5.7%4.399ms3.480ms-20.9%
      list + comment count0.088ms0.088ms+0.1%0.200ms0.192ms-3.9%3.124ms4.421ms+41.5%
      list + 3 recent comments0.052ms0.052ms+0.4%0.104ms0.102ms-2.4%3.693ms4.961ms+34.3%
      issue detail + comments0.043ms0.043ms-1.5%0.094ms0.061ms-35.6%0.472ms0.463ms-1.9%
      1,000 rows/collection | source indexes: none | synced writes — geomean 0.75×, cold 0.99×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.067ms0.041ms-38.8%0.085ms0.073ms-14.3%6.916ms4.720ms-31.7%
      list: newest 50 open0.506ms0.562ms+11.0%1.015ms1.096ms+8.0%9.228ms8.357ms-9.4%
      list + author0.057ms0.051ms-10.7%0.148ms0.117ms-20.8%22.781ms21.813ms-4.2%
      list + comment count0.153ms0.162ms+5.7%0.220ms0.311ms+40.9%10.863ms8.283ms-23.7%
      list + 3 recent comments0.168ms0.073ms-56.3%0.196ms0.215ms+9.8%🟢7.186ms14.115ms+96.4%🔴
      issue detail + comments0.088ms0.056ms-36.5%0.170ms0.117ms-31.6%1.281ms1.364ms+6.5%
      1,000 rows/collection | source indexes: none | optimistic writes — geomean 1.05×, cold 0.92×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.074ms0.110ms+49.5%0.136ms0.154ms+13.3%12.531ms6.664ms-46.8%
      list: newest 50 open0.033ms0.034ms+2.5%0.074ms0.051ms-31.8%4.737ms4.996ms+5.5%
      list + author0.056ms0.055ms-1.2%0.101ms0.085ms-15.2%25.524ms28.495ms+11.6%
      list + comment count0.078ms0.075ms-3.5%0.117ms0.116ms-1.4%8.971ms6.906ms-23.0%
      list + 3 recent comments0.047ms0.044ms-6.6%0.096ms0.055ms-42.7%6.710ms7.737ms+15.3%
      issue detail + comments0.040ms0.039ms-2.4%0.055ms0.054ms-1.0%0.904ms0.968ms+7.1%
      1,000 rows/collection | source indexes: manual | synced writes — geomean 0.98×, cold 0.96×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.038ms0.039ms+3.2%0.044ms0.050ms+13.2%0.980ms1.327ms+35.4%
      list: newest 50 open0.154ms0.167ms+8.4%0.318ms0.332ms+4.4%0.895ms0.958ms+7.0%
      list + author0.051ms0.051ms+1.4%0.093ms0.097ms+4.5%2.550ms2.630ms+3.1%
      list + comment count0.103ms0.096ms-7.1%0.160ms0.177ms+10.9%2.954ms2.772ms-6.2%
      list + 3 recent comments0.064ms0.061ms-4.5%0.075ms0.097ms+29.6%8.083ms4.458ms-44.8%
      issue detail + comments0.051ms0.045ms-11.9%0.059ms0.065ms+11.3%0.466ms0.482ms+3.4%
      1,000 rows/collection | source indexes: manual | optimistic writes — geomean 0.91×, cold 1.24×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.042ms0.042ms-0.9%0.088ms0.082ms-7.0%0.853ms0.950ms+11.4%
      list: newest 50 open0.036ms0.036ms-1.2%0.052ms0.058ms+11.8%0.980ms1.005ms+2.6%
      list + author0.055ms0.053ms-3.6%0.096ms0.098ms+3.1%2.629ms2.610ms-0.7%
      list + comment count0.144ms0.088ms-39.2%0.185ms0.172ms-7.1%🟢2.842ms3.231ms+13.7%
      list + 3 recent comments0.051ms0.047ms-7.6%0.085ms0.058ms-32.1%3.595ms7.735ms+115.1%
      issue detail + comments0.042ms0.047ms+10.7%0.071ms0.094ms+31.9%0.385ms0.509ms+32.0%
      10,000 rows/collection | source indexes: none | synced writes — geomean 1.04×, cold 1.07×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.038ms0.039ms+0.4%0.070ms0.045ms-35.4%46.299ms49.781ms+7.5%
      list: newest 50 open4.695ms4.987ms+6.2%5.314ms5.835ms+9.8%36.831ms46.710ms+26.8%
      list + author0.092ms0.090ms-2.5%0.119ms0.115ms-2.8%202.603ms205.800ms+1.6%
      list + comment count0.085ms0.087ms+2.9%0.112ms0.122ms+8.8%47.857ms42.949ms-10.3%
      list + 3 recent comments0.063ms0.084ms+33.8%0.086ms0.149ms+73.7%51.400ms58.410ms+13.6%
      issue detail + comments0.046ms0.041ms-9.8%0.061ms0.052ms-13.7%5.230ms5.473ms+4.6%
      10,000 rows/collection | source indexes: none | optimistic writes — geomean 0.76×, cold 1.15×, 1 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.073ms0.044ms-40.2%0.112ms0.084ms-25.4%46.627ms46.742ms+0.2%
      list: newest 50 open0.033ms0.033ms-1.8%0.064ms0.047ms-26.4%46.144ms42.369ms-8.2%
      list + author0.056ms0.055ms-2.1%0.082ms0.069ms-16.3%192.835ms194.142ms+0.7%
      list + comment count0.105ms0.094ms-10.8%0.207ms0.137ms-33.5%55.556ms44.989ms-19.0%
      list + 3 recent comments0.046ms0.044ms-5.3%0.062ms0.064ms+3.7%47.846ms50.121ms+4.8%
      issue detail + comments0.099ms0.039ms-60.4%0.144ms0.053ms-62.8%🟢4.295ms12.594ms+193.2%🔴
      10,000 rows/collection | source indexes: manual | synced writes — geomean 1.04×, cold 1.07×, 2 change(s)
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.038ms0.037ms-2.2%0.048ms0.044ms-8.5%2.088ms1.720ms-17.6%
      list: newest 50 open0.579ms0.589ms+1.7%0.958ms0.695ms-27.5%1.706ms1.940ms+13.7%
      list + author0.049ms0.054ms+9.6%0.083ms0.102ms+23.5%3.238ms11.528ms+256.1%🔴
      list + comment count0.097ms0.106ms+9.6%0.133ms0.208ms+56.5%10.957ms3.981ms-63.7%🟢
      list + 3 recent comments0.066ms0.064ms-1.7%0.076ms0.128ms+69.2%4.180ms4.931ms+18.0%
      issue detail + comments0.045ms0.048ms+7.0%0.060ms0.088ms+46.2%0.660ms0.693ms+5.0%
      10,000 rows/collection | source indexes: manual | optimistic writes — geomean 0.95×, cold 0.80×
      QueryBase medianPR medianΔ medianBase p95PR p95Δ p95Base coldPR coldΔ cold
      list: newest 50 open0.045ms0.043ms-4.6%0.066ms0.072ms+9.7%2.712ms1.468ms-45.9%
      list: newest 50 open0.039ms0.035ms-8.7%0.049ms0.044ms-10.4%1.721ms1.545ms-10.2%
      list + author0.058ms0.054ms-7.3%0.095ms0.142ms+49.7%5.058ms4.273ms-15.5%
      list + comment count0.122ms0.113ms-7.8%0.239ms0.164ms-31.4%3.650ms3.843ms+5.3%
      list + 3 recent comments0.056ms0.059ms+5.7%0.113ms0.116ms+2.3%6.243ms4.013ms-35.7%
      issue detail + comments0.047ms0.044ms-8.2%0.064ms0.050ms-21.1%0.704ms0.666ms-5.3%
      Runner: node v24.8.0, linux 7.0.0-1017-azure, AMD EPYC 9V45 96-Core Processor. Timings on shared CI runners are noisy; treat small deltas as indicative only.
    4. github-actions[bot](GitHub profile, opens in a new tab)commented

      Size Change: +42 B (+0.02%)

      Total Size: 239 kB

      📦 View Changed
      FilenameSizeChange
      packages/db/dist/esm/collection/changes.js3.06 kB-4 B (-0.13%)
      packages/db/dist/esm/collection/index.js6.28 kB+51 B (+0.82%)
      packages/db/dist/esm/live-query-observer.js3.21 kB-91 B (-2.76%)
      packages/db/dist/esm/utils.js1.81 kB+86 B (+4.98%)🔍
      ℹ️ View Unchanged
      FilenameSize
      packages/db/dist/esm/client.js5.51 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/cleanup-queue.js828 B
      packages/db/dist/esm/collection/config-errors.js547 B
      packages/db/dist/esm/collection/events.js504 B
      packages/db/dist/esm/collection/health-tree.js698 B
      packages/db/dist/esm/collection/indexes.js2.3 kB
      packages/db/dist/esm/collection/lifecycle.js5.59 kB
      packages/db/dist/esm/collection/mutations.js2.94 kB
      packages/db/dist/esm/collection/state.js7.69 kB
      packages/db/dist/esm/collection/subscription.js9.86 kB
      packages/db/dist/esm/collection/sync.js6.51 kB
      packages/db/dist/esm/collection/validate-config.js1.17 kB
      packages/db/dist/esm/collection/validate-indexing.js366 B
      packages/db/dist/esm/deferred.js207 B
      packages/db/dist/esm/error-message.js642 B
      packages/db/dist/esm/errors.js7.15 kB
      packages/db/dist/esm/event-emitter.js1.06 kB
      packages/db/dist/esm/index.js4.75 kB
      packages/db/dist/esm/indexed-db-wrapper.js1.91 kB
      packages/db/dist/esm/indexed-db.js3.8 kB
      packages/db/dist/esm/indexes/auto-index.js924 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.js845 B
      packages/db/dist/esm/live-query-observer-client.js2.21 kB
      packages/db/dist/esm/live-query-options.js2.65 kB
      packages/db/dist/esm/live-query-primitives.js406 B
      packages/db/dist/esm/live-query-window-binding.js1.56 kB
      packages/db/dist/esm/live-query-window-controller.js4.02 kB
      packages/db/dist/esm/local-only.js1 kB
      packages/db/dist/esm/local-storage.js4.58 kB
      packages/db/dist/esm/optimistic-action.js359 B
      packages/db/dist/esm/paced-mutations.js1.11 kB
      packages/db/dist/esm/proxy.js3.51 kB
      packages/db/dist/esm/query/builder/clone-query.js854 B
      packages/db/dist/esm/query/builder/functions.js1.61 kB
      packages/db/dist/esm/query/builder/group-keys.js157 B
      packages/db/dist/esm/query/builder/include-functions.js229 B
      packages/db/dist/esm/query/builder/index.js7.67 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/find-aggregate.js328 B
      packages/db/dist/esm/query/compiler/group-by.js4.38 kB
      packages/db/dist/esm/query/compiler/grouping.js161 B
      packages/db/dist/esm/query/compiler/index.js10.3 kB
      packages/db/dist/esm/query/compiler/joins.js3.29 kB
      packages/db/dist/esm/query/compiler/lazy-targets.js1.11 kB
      packages/db/dist/esm/query/compiler/order-by.js2.87 kB
      packages/db/dist/esm/query/compiler/parent-routes.js325 B
      packages/db/dist/esm/query/compiler/query-equivalence.js568 B
      packages/db/dist/esm/query/compiler/route-metadata.js1.45 kB
      packages/db/dist/esm/query/compiler/select.js1.66 kB
      packages/db/dist/esm/query/effect.js5.81 kB
      packages/db/dist/esm/query/equality-conjunct.js486 B
      packages/db/dist/esm/query/equality-value-identity.js736 B
      packages/db/dist/esm/query/expression-helpers.js1.61 kB
      packages/db/dist/esm/query/ir-stable-identity.js4.29 kB
      packages/db/dist/esm/query/ir.js2.26 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.js8.57 kB
      packages/db/dist/esm/query/live/collection-registry.js264 B
      packages/db/dist/esm/query/live/collection-subscriber.js2.69 kB
      packages/db/dist/esm/query/live/graph-scheduler.js305 B
      packages/db/dist/esm/query/live/includes-runtime.js212 B
      packages/db/dist/esm/query/live/internal.js145 B
      packages/db/dist/esm/query/live/materialized-pipeline.js1.94 kB
      packages/db/dist/esm/query/live/ordered-source-loader.js6.61 kB
      packages/db/dist/esm/query/live/public-key-reduction.js970 B
      packages/db/dist/esm/query/live/subset-demand-controller.js2.44 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.js5.14 kB
      packages/db/dist/esm/query/pooled-source.js219 B
      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/query/validate-limit.js247 B
      packages/db/dist/esm/scheduler.js1.23 kB
      packages/db/dist/esm/SortedMap.js1.77 kB
      packages/db/dist/esm/strategies/commit-completion.js154 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.js669 B
      packages/db/dist/esm/sync-receipt.js211 B
      packages/db/dist/esm/transaction-commit-work.js351 B
      packages/db/dist/esm/transactions.js4.66 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.js219 B
      packages/db/dist/esm/utils/comparison.js1.95 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.58 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.js400 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/source-id-bindings.js339 B
      packages/react-db/dist/esm/useLiveInfiniteQuery.js1.45 kB
      packages/react-db/dist/esm/useLiveQuery.js3.08 kB
      packages/react-db/dist/esm/useLiveQueryEffect.js504 B
      packages/react-db/dist/esm/useLiveSuspenseQuery.js1.27 kB
      packages/react-db/dist/esm/usePacedMutations.js429 B
      compressed-size-action::db-and-react-package-size
    5. 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@2346

      @tanstack/browser-db-sqlite-persistence

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

      @tanstack/capacitor-db-sqlite-persistence

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

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

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

      @tanstack/convex-db-collection

      npm i https://pkg.pr.new/@tanstack/convex-db-collection@2346

      @tanstack/db

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

      @tanstack/db-ivm

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

      @tanstack/db-sqlite-persistence-core

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

      @tanstack/electric-db-collection

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

      @tanstack/electron-db-sqlite-persistence

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

      @tanstack/expo-db-sqlite-persistence

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

      @tanstack/node-db-sqlite-persistence

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

      @tanstack/offline-transactions

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

      @tanstack/powersync-db-collection

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

      @tanstack/preact-db

      npm i https://pkg.pr.new/@tanstack/preact-db@2346

      @tanstack/query-db-collection

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

      @tanstack/react-db

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

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

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

      @tanstack/react-router-with-db

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

      @tanstack/rxdb-db-collection

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

      @tanstack/solid-db

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

      @tanstack/svelte-db

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

      @tanstack/tauri-db-sqlite-persistence

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

      @tanstack/trailbase-db-collection

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

      @tanstack/vue-db

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

      commit: acdfb6f

    6. KyleAMathews changed the title

      • Fix comments: Fix CodeRabbit comments on this PR
      • Fix comments: Fix CodeRabbit comments on this PR
    7. KyleAMathews merged this70a744b

    8. KyleAMathews closed this

    9. 🎉 This PR has been released!

      Backfilled notification for published release candidates.

Sign in to join this conversation.