fix(db): scope truncate origin and test refused persisted inserts #2078
Merged
KyleAMathewsmerged 16 commits into
main fromrefs/pull/2078/head·merged by KyleAMathews Showing 19 changed files with 121 additions and 0 deletions (loading 17).
x
@@ -0,0 +1,5 @@
+---
+'@tanstack/db': patch
+---
+
+Clarify that `$origin` reflects local key attribution during sync, rather than the causal writer of a source row. Fix attribution leaking from a truncate to a later source transaction in the same drain. Cover pending and overlapping mutations, ordered same-key source writes, and refused persisted inserts.
116 additions and 0 deletions+116-0docs/contributing/oracle-reviews/issue-2071-refused-insert.mdAddedView file
@@ -0,0 +1,116 @@
+# Issue #2071: refused insert in a persisted Collection
+
+Source: [TanStack/db issue #2071](https://github.com/TanStack/db/issues/2071), including its closure comment, reread 2026-10-07. The report names `@tanstack/db` 0.12.1 and `@tanstack/db-sqlite-persistence-core` 0.4.5. The release probe used `3825ac3cb1db1fb145cafcc202dc05424b74dc56`, whose package versions match. This review began from `origin/main` at `ea51b67b06f2ef86d3a891a577dcc74e558454d7`, then merged `origin/main` at `2c98b4992`. Its executable tests and contract corrections are commits `14fc66d99c852dff9e0046c3ed32e92c4da6f51f` and `3e33fec8d073811e0c4c08e10cfd5db14268e596`. At those commits, the checkout had no production behavior change. The later [PR #2078 review](pr-2078-origin-attribution.md) records subsequent oracle and production changes.
+
+The reporter's bridge test and callback/write sequence are unavailable. The direct probes below reproduce the stated public setup, but they cannot establish that the private bridge reaches the same scheduling path. The issue is closed; the author's comment says it is probably a real problem, and does not retract the technical claim.
+
+## Reviewer assessment
+
+The report identifies the wrapper, real SQLite adapter, rejected outbound insert, transaction state, durable-versus-live divergence, and same-key source delete. Those are useful signals and a plausible high-impact failure if reproduced. It gives no minimal bridge fixture or exact sync callback and mutation-handler order, so its root-cause theory and proposed repairs cannot be verified. The scope is focused and the signal-to-noise ratio is good; the proposed overlay/reconciliation alternatives are outcomes to test, not approved mechanisms. **Hire recommendation:** insufficient evidence to recommend hiring as a reviewer from this single report.
+
+## Lossless finding ledger
+
+The issue supplied no file/line or severity labels. “High if true” below reflects the live/durable divergence, not a confirmed defect. Dispositions apply to the reviewed commit.
+
+| ID | Original claim or proposal | Technical verdict and evidence | Disposition / PR action | Durable value and destination |
+| --- | --- | --- | --- | --- |
+| R01 | A failed local insert remains visible until restart. | Unverified on the private bridge; no ghost at refusal settlement or fresh-adapter reopen in the controlled current and release probes. High if true. | **confirmed-open**; obtain the bridge schedule before a production fix. | Refusal and reopen law in the persisted wrapper and real SQLite owners; bridge gap in the coverage map. |