refactor(correction): eliminate redundant fields in CorrectionDryRunReport #1278

Merged
freemo merged 1 commits from refactor/m4-dry-run-report-fields into master 2026-04-02 16:59:41 +00:00

1 Commits

Author SHA1 Message Date
freemo 002c103123 refactor(correction): eliminate redundant fields in CorrectionDryRunReport
CI / security (pull_request) Failing after 2s
CI / quality (pull_request) Failing after 1s
CI / unit_tests (pull_request) Failing after 1s
CI / integration_tests (pull_request) Failing after 1s
CI / e2e_tests (pull_request) Failing after 1s
CI / build (pull_request) Failing after 2s
CI / helm (pull_request) Failing after 1s
CI / lint (pull_request) Successful in 3m20s
CI / typecheck (pull_request) Successful in 3m56s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 12m38s
CI / status-check (pull_request) Failing after 2s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 54m53s
Remove three top-level fields from CorrectionDryRunReport that duplicated
data already present in the embedded CorrectionImpact object:

- excluded_decisions  → now accessed via report.impact.excluded_decisions
- rollback_tier_depth → now accessed via report.impact.rollback_tier_depth
- child_plans_to_rollback → now accessed via report.impact.affected_child_plans

The redundant fields created a divergence risk: both models are frozen=True
Pydantic models, so post-construction mutation is impossible, but nothing
prevented constructing an instance where the top-level copies disagreed with
the impact sub-object. Removing the fields eliminates that ambiguity and
establishes CorrectionImpact as the single authoritative source for impact
data.

Approach: Option B (nest-only) — remove the duplicated top-level fields and
update all consumers to use the impact object's fields instead.

Updated consumers:
- CorrectionService.generate_dry_run_report(): removed child_plans_to_rollback,
  excluded_decisions, and rollback_tier_depth from the CorrectionDryRunReport
  constructor call
- features/steps/correction_subtree_isolation_steps.py: updated three step
  definitions to access report.impact.excluded_decisions and
  report.impact.rollback_tier_depth
- robot/helper_correction_subtree_isolation.py: updated _dry_run_report_enhanced
  and _dry_run_tier_zero_warning to use report.impact.*
- robot/helper_m6_e2e_verification.py: removed child_plans_to_rollback from
  CorrectionDryRunReport constructor in correction_affected_subtree()

A rationale docstring was added to CorrectionDryRunReport explaining the
design decision and directing consumers to the correct access paths.

Closes #1087
2026-04-02 08:41:37 +00:00