Repository navigation
Commit 1cd1183
fix(compare): restore the plan in force's pre-clip copy after the tariff comparison
Plan selection scores the pre-clip version of each plan (#4403), keeping the plan in force's copy in plan_preclip
for the next re-plan to score as the previous plan. The tariff comparison runs calculate_plan() for every tariff,
each replacing plan_preclip with that tariff's 48-hour plan, and restored the windows and limits but not
plan_preclip. The first re-plan after the midnight comparison therefore scored the last tariff's plan as the plan
in force: on 9 Oct 2026 (Sigenergy, IOG) live scored its previous plan at 300.97p where the same plan scores 30.71p
without the comparison, and so switched plans regardless of metric_min_improvement_plan.
Found with the forward log replay (#5363): running the comparison inside the replay reproduced the inflated score,
and restoring each attribute the comparison changes, group by group, isolated plan_preclip. run_all() now saves and
restores it with the windows; a test runs run_all() with a tariff that replaces it and checks it comes back (it
fails without the fix).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 0dab350 commit 1cd1183
2 files changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
621 | 624 | | |
622 | 625 | | |
623 | 626 | | |
| |||
735 | 738 | | |
736 | 739 | | |
737 | 740 | | |
| 741 | + | |
738 | 742 | | |
739 | 743 | | |
740 | 744 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
71 | 114 | | |
72 | 115 | | |
73 | 116 | | |
74 | 117 | | |
| 118 | + | |
75 | 119 | | |
76 | 120 | | |
77 | 121 | | |
| |||
0 commit comments