Skip to content
Source
Sign inSign up
TanStack/db

fix(query-db): compose accepted ownership before publication #2198

MergedKyleAMathews(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/2198/headmerged by KyleAMathews(GitHub profile, opens in a new tab)

Showing 5 changed files with 81 additions and 59 deletions (loading 2).

x
0 of 5 viewed, 5 left
5 additions and 0 deletions.changeset/fix-refetch-query-ownership.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/query-db-collection': patch
+---
+​
+Fix query ownership cleanup across overlapping refetch and observer lifecycles so removed rows do not remain visible because of stale persisted metadata.
23 additions and 0 deletionsdocs/contributing/oracle-coverage.mdModified
View file
@@ -1055,6 +1055,29 @@
writers, larger overlapping-fetch schedules, and direct-patch provenance after
Query cache dehydration outside their proven scope.
+A fixed accepted-ownership history acquires three exact subset claims for one
+row, then accepts two complete empty results while an unrelated optimistic
+mutation delays publication. Its independent model stores the latest complete
+result per active Query and exposes their union: the third result keeps the row
+public until its own release, after which the union is empty. The ordered
+refetch owner's held-delete replay is the killing witness for trusting stale
+published owners over accepted ownership. A release/reacquisition history also
+holds publication, reacquires the same cached Query, then proves the older
+release cannot erase the new claim by releasing it and observing an empty
+public row set. Larger overlap schedules, window ownership outside the ordered
+replay, and durable-adapter ordering remain open under the owners named above.
+​
+A controlled cold persisted scan gives one Query two rows in both scan orders,