Repository navigation
Add data integrity check for investigation - #4216
Open
stacktraceghost wants to merge 6 commits into
Open
stacktraceghost wants to merge 6 commits into
stacktraceghost wants to merge 6 commits into
Conversation
stacktraceghost
changed the base branch from
main
to
4172-investigation-delete-readd
October 30, 2026 12:16
oliver3
previously approved these changes
Oct 30, 2026
praseodym
reviewed
Nov 2, 2026
| // No investigation, there must not be a data entry ID | ||
| (None, None) => None, | ||
| // All other situations, panic | ||
| _ => panic!("Unexpected data entry ID for investigation status"), |
Contributor
There was a problem hiding this comment.
I think this should return a DataIntegrityError instead of panicking
Contributor
Author
There was a problem hiding this comment.
Rebased due to change of base branch.
Went through a puzzle with the errors, split the steps in 3 commits:
- Rename/move CreateDataEntryError
- Renamed
CreateDataEntryErrortoDatabaseError, since it contained thesqlx:Error+ a data integrity error - Moved it to common, since it was used in two repo's
- Renamed
- Simplify investigation service test function
- Removed several error types which were only aliasing the
DatabaseError
- Removed several error types which were only aliasing the
- Return error instead of panic
- Added the error which replaces the panic
... and some clippy fixes (ref log)
stacktraceghost
force-pushed
the
check-investigation-state
branch
from
November 2, 2026 15:53
628aa8b to
5b91351
Compare
This branch was successfully deployed
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.
What & why
Related to #4172
After investigating several scenarios, it showed that
are_results_complete_for_committee_sessionpassed a definitive result which was still linked to a polling station in a next session, while not having an investigation.The suggestion was made to add a data integrity check to that function. However, we found that extending two existing match arms would cover these cases during the entire process instead of only at the end.
How to test
Since this fix is based upon #4190 which contains the initial bugfix, you can only trigger the panic by locally:
corrected_results=yes(this also creates and links a data entry)investigation_statefor that polling station toNULLin the databaseResult: a panic will occur when you try to access that election through the frontend. Other invalid combinations should do this too.
Reviewer notes
switch_to_without_new_results, the polling station cannot be retrieved after deleting the data entry but not yet updating the investigation to the correct state.link_data_entry: return was removed during one of our iterations. We do not use the returned value anywhere.