Repository navigation
Closed
Labels
tech-debtInternal quality work with no direct user-facing story
Description
Summary
@tanstack/db 0.8.7 carries a bug where a new update on a key that starts while a sync commit for that key is deferred behind an earlier in-flight mutation flips the row to synced without publishing a change event. The next update's previousValue is then a row the live query graph never received, the retraction misses, and the congruence check throws Query contributors with the same row key are not congruent on every later write to that key.
We carry TanStack/db PR #1794 as a local patch. This issue tracks removing it once an upstream release contains the fix.
Current state
patches/@[email protected], wired throughpatchedDependenciesin the rootpackage.json.- The patch is pinned to 0.8.7, so the next
@tanstack/dbbump must either drop it or re-create it against the new version. A bump that silently fails to apply will bring the bug back. - The 250ms e2e click pacing that worked around it is gone; nothing in the suite compensates for the bug any more.
Done
- Symptom: rapid checklist answer writes (~60ms apart) threw from the query compiler's reduce step, so the Mark Complete dialog never closed. Acknowledging the reconciliation finalize transaction threw the same error during render and the route error boundary turned it into the generic "Something went wrong" card.
- Cause traced to upstream, not cf-sync. Minimal sequence on bare TanStack DB, no adapters:
m1 m2 c1 m3 c2 c3 m4(m =collection.update, c = server confirmation). - Fixed by Patch TanStack DB live query retraction to stop the congruence race #680.
To close this issue
- A
@tanstack/dbrelease includes fix(db): preserve exact D2 rows during sync reconciliation TanStack/db#1794 (the maintainer's plan on Calling writeInsert inside a createOptimisticAction throws error TanStack/db#1783 routes it through their RFC #1657 hardening) - Bump to it and delete
patches/@[email protected]and itspatchedDependenciesentry - Run the AMSTAR2 dual-reviewer e2e against staging to confirm the race stays fixed without the patch
References
- Upstream repro: fix(db): preserve exact D2 rows during sync reconciliation TanStack/db#1794 (comment)
- Original report and root-cause analysis: the first two comments on this issue
Metadata
Metadata
Assignees
Labels
tech-debtInternal quality work with no direct user-facing story
Activity
Patch TanStack DB live query retraction to stop the congruence race (#…
InfinityBowman commentedon Sep 6, 2026
Root cause and stopgap (2026-09-06)
This is an upstream TanStack DB 0.8.7 bug, not cf-sync. A new update on a key that starts while a sync commit for that key is deferred behind an earlier in-flight mutation makes the collection flip the row to synced without publishing a change event. The next update's
previousValueis then a row the live query graph never received, the retraction misses, and the congruence check throws on every later write to that key. Minimal sequence on bare TanStack DB, no adapters:m1 m2 c1 m3 c2 c3 m4(m =collection.update, c = server confirmation).pnpm patch(patches/@[email protected]) and removes the 250ms e2e click pacing.Keeping this open to track removing the patch once a TanStack DB release includes the fix. The patch is pinned to 0.8.7, so the next
@tanstack/dbbump will need to either drop it or re-create it.InfinityBowman commentedon Sep 7, 2026
Triage 2026-09-07: the described bug is fixed, only the patch removal is left
Confirming the state on main so the title stops advertising a live bug:
patches/@[email protected]is present and wired throughpatchedDependencies.shared-steps.tsis an unrelated 500ms.Everything in the Summary, Cause, Current state and Repro sections is now historical. The whole remaining scope is the last paragraph of the root-cause comment: drop or re-create the patch on the next
@tanstack/dbbump, once a release carries TanStack/db#1794.Suggested retitle: Drop the @tanstack/db 0.8.7 congruence patch once upstream ships the fix, with the original report kept as background.
[-]Sync engine: congruence error on rapid checklist answer writes[/-][+]Drop the @tanstack/db 0.8.7 congruence patch once upstream ships the fix[/+]