[P1 data integrity] “Atomic” document batches can leave partially committed corpus state #136
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-review
quasar
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/quasar-ui#136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
commitDocumentBatch()labels operations as atomic, writes all documents throughbulkDocs(), and attempts a compensating rollback when some individual writes fail.PouchDB/CouchDB bulk writes are not a cross-document transaction. Each document can succeed or fail independently. The rollback is another independent revision-sensitive bulk write and can itself conflict or fail. The function explicitly returns surviving writes when this happens.
That means an operation requested as
atomic: truecan still leave a partially modified corpus. This affects imports, actor output, queue ingestion, and any other path using the shared batch layer. It also contradicts the architecture claim that batches are atomic and undone as one transaction.Impact
Required fix
Do not claim storage-level atomicity where the backend cannot provide it. Implement logical atomicity with an explicit batch journal and visibility boundary.
Transaction envelope
Write candidate document revisions tagged with the batch ID:
Application projections must ignore staged revisions until one small commit record becomes visible:
The document source/view layer should expose a staged document only when its referenced batch journal is committed. Failed or interrupted batches can then be recovered deterministically without pretending rollback was atomic.
Alternative designs are acceptable, including a backend transaction service, but the invariant must be observable logical all-or-nothing behavior.
Immediate correction
Until logical transactions exist:
atomictorollbackOnErrororbestEffortAtomic.Acceptance criteria
atomicbatch is never visible partially to normal corpus queries.