EV-54 review r2: fails counts only refusals of the value now owed
checks / unit (pull_request) Successful in 45m48s
infra-pin / fresh (pull_request) Successful in 2s

Where a refused cut value stops being owed without a drop (the charger's return, another value written in its place), fails goes to 0; cut_fails is untouched. After a return under a capped quarter, Solar's own write gets its own 3 tries again instead of giving up after 1. New rows T40 (refused to 1430), T41 (to 1600, against the run without the away), T42 (replaced value).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-30 06:37:40 +01:00
co-authored by Claude
parent 095f773921
commit 7613468cf9
3 changed files with 106 additions and 2 deletions
+10 -2
View File
@@ -912,6 +912,14 @@ class SolarWriter(ManualWriter):
change)."""
return self.cut_a is not None and float(a) <= self.cut_a + TOL_A
def _forget_refused(self) -> None:
"""EV-54 (PM, review r2): a refused cut value is no longer owed and
is not dropped (the charger's return, another value written): its
refusals leave `fails` with it. `cut_fails`, the quarter's cap, stays."""
if self.refused_cut is not None:
self.refused_cut = None
self.fails = 0
def drop_ready(self, cur, stuck) -> bool:
"""EV-54 (drop rule): a cut value the charger did not take, no cut
stands any more (lifted, or a new quarter's cut waits), and a known
@@ -974,7 +982,7 @@ class SolarWriter(ManualWriter):
cut_try = self.sent_cut = self._cut_try(a)
if self.refused_cut is not None \
and abs(self.refused_cut - float(a)) > TOL_A:
self.refused_cut = None # EV-54: another value, not that one
self._forget_refused() # EV-54: another value, not that one
self.sent_a, self.taken = float(a), False
if prev is None or abs(prev - float(a)) > TOL_A:
# EV-21 (PM Q1, formal C15): the 2 s grace of a lowering on its
@@ -1447,7 +1455,7 @@ class SolarWriter(ManualWriter):
if self.fresh_start:
self.fresh_start = False
self.sent_a, self.taken = None, True # 0 A first (D2)
self.refused_cut = None
self._forget_refused()
if self.drop_ready(cur, stuck):
# EV-54 (drop rule): the refused cut value is not sent again.
self._drop(cur, now)