fix: prevent data loss when tombstoning/retrying existing DB records#27
Merged
fix: prevent data loss when tombstoning/retrying existing DB records#27
Conversation
Replace session.merge() with load-and-update pattern in mark_niet_leverbaar() and mark_retry_after() for BasisProfielWriter and VestigingsProfielWriter. Adds regression tests asserting existing fields (naam, registratie_datum_einde, etc.) are preserved after tombstone/retry operations. Also adds code-reviewer skill and CLAUDE.md instruction to run it before PRs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
session.merge()with load-and-update pattern inmark_niet_leverbaar()andmark_retry_after()forBasisProfielWriterandVestigingsProfielWriterregistratie_datum_einde, address fields) withNoneKvKVestigingenWriteris unaffected — its ORM has no business data fields andmerge()is intentionally correct thereTest plan
test_mark_niet_leverbaar_preserves_existing_data— asserts naam, rechtsvorm, registratie_datum_einde survive tombstonetest_mark_retry_after_preserves_existing_data— asserts same fields survive retry-after updateVestigingsProfielWriterjust check-allpasses cleanProduction data recovery
If records were already affected, see recovery SQL in the plan (identify records where error flags are set but business fields are NULL, then un-tombstone or delete to trigger re-fetch).
🤖 Generated with Claude Code