Skip to content

Conversation

@myieye
Copy link
Contributor

@myieye myieye commented Oct 24, 2025

Refactor to clean up some of #54

#54 introduced the possibility of a commit not generating any snapshots (by not generating a new snapshot if a change object was ignored, which happens in the edge case of a create-change being applied to an entity that already exists and is not deleted).

That change uncovered the fact, that we're relying on the call to DbContext.SaveChangesAsync() in CrdtRepository.AddSnapshots() to persist updates to commit hashes.
That's very subtle and is not a good separation of concerns.

This PR pulls that commit-hash-updating out of SnapshotWorker and does it immediately when commits are added to the db-context.

I also started making use of SortedSet<Commit>, so that collections of commits can be passed around without each method having to make sure they're sorted.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pull-updating-commit-hashes-out-of-snapshot-worker

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@myieye myieye changed the base branch from main to create-changes-override-delete October 24, 2025 13:39
@myieye myieye force-pushed the pull-updating-commit-hashes-out-of-snapshot-worker branch from 0dc12e5 to 5167ce8 Compare October 24, 2025 14:03
Base automatically changed from create-changes-override-delete to main October 28, 2025 14:13
@myieye myieye force-pushed the pull-updating-commit-hashes-out-of-snapshot-worker branch from 5167ce8 to ed8b11b Compare October 28, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant