[claude] Snapshot rollback resumes from a stale snapshot and loses intermediate state
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 14
- Forks
- 4
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
[Claude, autonomous]
When an out-of-order commit arrives, DataModel.UpdateSnapshots deletes the snapshots after it and replays only the commits after it, assuming each entity's newest surviving snapshot is its state at that point. That's false once GenerateSnapshotForEntity has pruned intermediates in an earlier batch (it keeps only every second one): edits between the surviving snapshot and the rollback point are silently lost, and a cascade delete, which only ever existed as a snapshot, is undone.
Hit in production FwHeadless: a sense whose entry had been deleted came back alive when a late commit landed between the delete and later edits to that sense, and every sync since fails with FOREIGN KEY constraint failed in CrdtRepository.AddSnapshots. The replay probably needs to start from the oldest surviving snapshot of the affected entities rather than the oldest new commit. Reproducible in DataModelTestBase with WriteChangeBefore and two synced clients.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in DataModel.UpdateSnapshots and GenerateSnapshotForEntity, then inspect how snapshots reach CrdtRepository.AddSnapshots. Build the reproduction in DataModelTestBase using WriteChangeBefore and two synced clients, checking the out-of-order commit after snapshot pruning. Done means intermediate edits and snapshot-only cascade deletes survive rollback, without the reported foreign-key failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100