Repository navigation
fix(persistence): delete force_unit_edits on save - #279
Merged
Merged
Conversation
Contributor
Author
|
@claude review |
|
Claude finished @DeepDiver1975's task in 2m 1s —— View job Review of #279 — fix(persistence): delete force_unit_edits on save
Summary: This is a clean, well-scoped fix. The root cause ( Correctness checks I traced through:
Minor, non-blocking observations:
No blocking issues found. Nice catch, and the regression test approach (asserting row count and loaded aggregate state, not just one) directly closes the gap that let the original bug slip through |
Save's DELETE list omitted force_unit_edits, so every save re-inserted a unit's whole Wert-Historie on top of what was already on disk. A file saved N times ended up with N copies of every Stärke correction, and Load read them all back, so the in-memory history and the PDF Wert-Historie showed duplicates. Add force_unit_edits to the DELETE list, and add migration V21 to heal existing files by keeping one row per (unit_id, ordinal). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PXhXSh2pae9WnaACYUUe3V Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
DeepDiver1975
force-pushed
the
fix/review-force-unit-edits
branch
from
September 11, 2026 08:46
4520111 to
59e1f2a
Compare
16 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
IncidentRepository.Saverewrites the whole aggregate by deleting 15 tables and re-inserting everything, but the DELETE list omittedforce_unit_edits. Every save re-inserted a unit's whole Stärke history with fresh GUID ids on top of what was already on disk. A file saved N times ended up with N copies of every Stärke correction;Loadread them all back, so the in-memory history and the PDF Wert-Historie showed duplicates and the file grew with every save.The existing
Save_is_idempotent_overwrite_not_appendtest saves twice but only asserts onincident_meta, which is why this slipped through.Fix
force_unit_editsto the DELETE list inIncidentRepository.Save..fwincidentfiles by keeping one row per(unit_id, ordinal)(duplicates are content-identical, earliest rowid wins).Edits.Count.Load.Found during a code review of
main; part of a series of review follow-up PRs.Test plan
dotnet test LageBuch.Desktop.slnfgreen (1101 passed, 1 pre-existing skip)🤖 Generated with Claude Code
https://claude.ai/code/session_01PXhXSh2pae9WnaACYUUe3V