[claude] Add an endpoint to request a CRDT snapshot rebuild - #2630
[claude] Add an endpoint to request a CRDT snapshot rebuild#2630myieye wants to merge 9 commits into
Conversation
The interceptor threw 'Sequence contains no elements', which says nothing about which entry is missing. It fires when a sense is saved whose entry is no longer in the projected table. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds an empty commit dated before the project's oldest, so every client rolls its snapshots back past the start of history and replays the whole thing in one batch. Recovers a project whose sync fails repeatedly with a foreign key violation from AddSnapshots (sillsdev/harmony#105). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The search table error message is unrelated to this endpoint. The rebuild is a general mechanism, so its comments no longer describe one specific failure. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
It belongs next to the other sync maintenance endpoints rather than in a controller of its own. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
It adds a commit; the rebuild happens on each client's next sync, so calling it rebuilds nothing by itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Covers the three things the endpoint claims: the commit predates every other commit in the project, it carries no changes, and a client with nothing left to sync is still sent it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deriving the date from the oldest commit could race with an older commit arriving, and threw if the project started within a day of DateTimeOffset.MinValue; the floor can't be beaten and needs no query. The SignalR notify meant a broadcast failure returned an error for a commit that was already saved, and a retry would make every client replay twice; clients pick the commit up on their next sync anyway. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Now that the commit is dated at the floor, asserting it is strictly older than everything else fails whenever another test in the class has already added one, and xUnit does not fix method order. What matters is that no commit sorts before it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe service now creates empty CRDT snapshot-rebuild commits with replay metadata. An admin-only controller endpoint requests these commits. Tests cover commit ordering, replay counts, empty changes, and delivery to synchronized clients. ChangesCRDT snapshot rebuild
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This adds an admin-only request that causes syncing clients to replay project history from an empty marker commit. The marker behavior and delivery path are covered, with no remaining concrete merge-blocking risk. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
[Claude, autonomous]
POST /api/fw-lite/sync/request-crdt-snapshot-rebuild/{projectId}adds an empty commit dated before every other commit in the project. A client that receives a commit predating its history rolls its snapshots all the way back and replays everything, so each one rebuilds its snapshots the next time it syncs. Nothing is rebuilt server-side, and a client that never syncs never rebuilds. Admin only. An optionalnotegoes into the commit metadata, and the response says how many commits clients will replay.Tests cover what it promises: no commit sorts before the marker and it carries no changes, and a client with nothing left to sync is still sent it (which is what the fresh client id buys).
The mechanism was also checked outside the tests, by replaying a captured sync payload plus such a commit against a copy of a wedged production project's database: the resulting projected state came out byte-identical to a from-scratch rebuild.