Skip to content
Source
Sign inSign up
TanStack/db

fix: settle paced queue overflow and trailing throttle #1930

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

Showing 15 changed files with 153 additions and 0 deletions (loading 12).

x
0 of 15 viewed, 15 left
5 additions and 0 deletions.changeset/fix-paced-mutation-admission.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/db': patch
+---
+​
+Reject queue overflow and post-cleanup calls with accurate errors and optimistic rollback. Drain pending queue, debounce, and throttle work on cleanup, and preserve caller-owned strategy options. Settle debounce and throttle calls across supported edge options, including throttle epoch zero, and reject calls intentionally dropped by disabled trailing execution.
146 additions and 0 deletionsdocs/contributing/oracle-reviews/gap-04-paced-mutations.mdAdded
View file
@@ -0,0 +1,146 @@
+# GAP-04 paced-mutation oracle review
+​
+## Reviewed state and authority
+​
+- Starting head: `33a194941c8d51f8f98babb999fef2987dd6ff8b`.
+- Initial implementation commit: `1b844588bc18e96a4c18c0de6bb1edadcad85332`.
+- Reviewed implementation commit: `ccdeaa5ba61f94e7cf81930987d728769266a1cd`.
+- Maintainer-decision implementation commit: `baf6cf27`.
+- Owner: `packages/db/tests/paced-mutations-oracle.test.ts`.
+- Public authority: strategy option types, `createPacedMutations` reference, and `docs/guides/mutations.md`.
+​
+The owner uses finite virtual-clock histories over public `createPacedMutations` and the three real strategy factories. Its independent models use an appointment time, pending mutation IDs, and a plain ordered list. The tests compare immediate public Collection rows, mutation callback times and payloads, returned transaction identity, final transaction state, and `isPersisted.promise` fulfillment with the returned transaction object. A held-write history crosses the queue timer and two pending persistence promises to check serialization.
+​
+The maintainer chose the documented pacing behavior: factories preserve caller-owned options, `maxSize` overflow fails the returned transaction and rolls back its optimistic state, and explicit non-leading throttle waits for its first trailing edge. The baseline `maxSize:1` witness returned two completed and two permanently pending transactions after four calls. The baseline explicit non-leading throttle witness started at t=0 rather than the trailing edge. The follow-up oracle encoded both laws and failed on the unchanged production implementation. Omitted leading/trailing defaults remain outside the finite domain.
+​
+## Verification on the reviewed commit
+​