Skip to content

[FIX] base_tier_validation_correction: honest revert via snapshot#45

Open
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-fix-base_tier_validation_correction-revert-snapshot
Open

[FIX] base_tier_validation_correction: honest revert via snapshot#45
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-fix-base_tier_validation_correction-revert-snapshot

Conversation

@bosd
Copy link
Copy Markdown
Contributor

@bosd bosd commented May 14, 2026

Problem

tier.correction.do_revert recomputed reviewers from the current
tier.definition state by calling review._get_reviewers(). Any edit to
the definition between correct and revert — reviewer reassignment, a
group membership change, a different reviewer field — would silently
leak into the reverted state. That is not what "revert" means: the user
expects to get back exactly the reviewers that were in place before the
correction.

Fix

Snapshot each affected review's reviewer_ids on
tier.correction.item.original_reviewer_data (a fields.Json mapping
review_id → list of user_ids) at correct() time, and restore from
that snapshot at revert() time. Items written by older versions of
the module have an empty snapshot and fall back to the previous
_get_reviewers() recompute, so existing in-flight corrections keep
working.

Tests

Two new tests in test_tier_validation.py:

  • test_revert_restores_snapshot_not_current_definition — repoints the
    underlying definition between correct and revert; asserts the
    originally-snapshotted user is restored, not the definition's new one.
  • test_revert_legacy_item_without_snapshot — clears the snapshot field
    to simulate a pre-fix item; asserts the fallback recompute still works.

revert() recomputed reviewers from the current tier.definition state via
_get_reviewers(), so any edit to the definition between correct and
revert (reviewer change, group membership change, field reassignment)
would silently leak into the reverted state -- not what "revert" means.

Snapshot each affected review's reviewer_ids on the tier.correction.item
at correct() time and restore from that snapshot at revert() time. Legacy
items without a snapshot fall back to the previous behaviour.
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @kittiu,
some modules you are maintaining are being modified, check this out!

@OCA-git-bot OCA-git-bot added series:19.0 mod:base_tier_validation_correction Module base_tier_validation_correction labels May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:base_tier_validation_correction Module base_tier_validation_correction series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants