Hot fix/documents being soft deleted - #641
Open
tsubik wants to merge 2 commits into
Open
Conversation
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.
This is already on production, backfilling to develop branch.
Fix documents being soft-deleted instead of reset
RequiredOperatorDocumentFmu#applies_to_forest_type?comparedforest_types(Strings, since
ForestType::TYPESis aHashWithIndifferentAccess) againstforest_type.to_sym, so it was always false for forest-type-scoped requireddocuments. That made condition 5 in
OperatorDocument#destroyalways fire, sodocuments were soft-deleted instead of reset to
doc_not_provided.Shipped 2026-07-30. Affected exactly 2 documents (19045, 19349), both already
restored by hand — verified point-in-time against all 401 destroy events since
the release; the other 399 were legitimate.
Changes
check:docs_forest_type_mismatchapplies_to_forest_type?and for destroying an FMU document(the existing
#destroyspec used a country document, which has nofmu_idand so never reached that condition — the gap that let this through)
rake fix:erroneous_document_deletionto clean up what the deletion leftbehind: born-deleted history rows, PaperTrail destroy events, the score row
it created, and document
updated_at. Dry run by default (FOR_REAL=trueto apply,
SKIP_STATISTICS=trueto leave statistics for a later backfill).