sillsdev / sillsdev/harmony

[claude] Snapshot rollback resumes from a stale snapshot and loses intermediate state

Open
#105 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Data bug
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.