EV-60: Solar never passes the cut cap of 3 refused tries per quarter key
checks / unit (pull_request) Successful in 57m13s
infra-pin / fresh (pull_request) Successful in 2s

Solar's phase change 0 A and its capped close are cut tries. They now pass
the same gates as `_put`: none at cut_fails >= MAX_TRIES, none within RETRY_S
of the last refused cut try (the sequence's first cut close waits at 0 A, the
rest keep the 5 s spacing). A gated 0 A waits for the next quarter key and
never gives up; a capped close with no tries left ends the change at 0 A
(end_switch(False), reapply, no write). Solar's close end adds no extra
_failed (EV-56 F1 on the cut path, EV-59 finding 2 on the non-cut path), so
a press during the close retries gives the value MAX_TRIES tries.

Solar only (override in SolarWriter); Manual is byte for byte as before.
Edited tests as ruled (Q3, Q4): test_ev59 T25/T14, T25 press, T14c and the
N11 digest list; test_ev56 T19b [a]/[b], T12 and golden "T20 T12 [R]".

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-12-02 05:48:20 +01:00
parent 2e09622fe1
commit 5bd2b1ec97
4 changed files with 969 additions and 23 deletions
+19 -8
View File
@@ -58,7 +58,10 @@ GOLDEN = {
"T20 T5 [A]": "369069be9187ab3c", "T20 T5 [R]": "78ffe9cf72c5e214", # EV-59
"T20 T8 [A]": "2cd78dee7ee93aaa", "T20 T8 [R]": "f0adb058a5bbefba",
"T20 T11 [A]": "6d7bcb747d1dc5a3", "T20 T11 [R]": "2be1a760b699b28c",
"T20 T12 [A]": "a5888e4557b4ee8f", "T20 T12 [R]": "2fd24ddbb18f14cc",
"T20 T12 [A]": "a5888e4557b4ee8f",
# EV-60 (Q4): re-taken; the only change from 2fd24ddbb18f14cc is Solar's
# `fails` 4 -> 3 in cycles 323-372 (after the 3rd close: no extra _failed).
"T20 T12 [R]": "25a205989dc44204",
"T20 T13 [A]": "1ad97e089468d71b", "T20 T13 [R]": "7baf8981ab382e05",
"T20 T15 [A]": "54701b140ec6f30b", "T20 T15 [R]": "0cfd3ccd334f378d",
"T20 T15d [A]": "1d85595302dc032a", "T20 T15d [R]": "5fc65dbdc730e539",
@@ -889,12 +892,13 @@ e12 = row_at(x12, t12)
check(f"T12: the change's close raises: writer equal to R ({eq12[:1]})",
not eq12)
check(f"T12: 3 close tries 5 s apart ({ts(c12)[:3]}); then seq None, the "
f"change ended ({e12 and e12[2]['plan']}), fails 4 as with R "
f"change ended ({e12 and e12[2]['plan']}), fails MAX_TRIES as with R "
f"(EV-60: no extra _failed at Solar's close end) "
f"({e12 and e12[2]['fails']}); the car at 0 A; one select only "
f"({sel12})",
len(c12) >= 3 and gaps(ts(c12)[:3]) == [5.0, 5.0]
and e12 is not None and e12[2]["seq"] is None
and e12[2]["fails"] == 4 and e12[2]["plan"][2] is False
and e12[2]["fails"] == CM.MAX_TRIES and e12[2]["plan"][2] is False
and x12["sim"].setpoint_a == 0.0 and len(sel12) == 1)
never("T12", x12, close_ok=True)
@@ -1036,6 +1040,12 @@ def c4b(kind):
return r
drv = Drv(8.0, answer)
w, trk, run = solar_writer(8.0), Trk(), Runner()
# EV-60: the capped change ends and the plan is back at 8 A; the real
# plan lowers it to the cap again at its next step (SolarPlan.step), so
# nothing above the cap is written.
w._plan_step = lambda *a, **k: (
w.plan._cut(w.cut_a) if w.cut_a is not None and w.cut_a >= CH.MIN_A
and w.plan.a > w.cut_a else None)
w.cut_a, w.cut_on = 0.0, True
w.plan.a = 0.0
t = 0
@@ -1055,12 +1065,13 @@ def c4b(kind):
return tries, w.cut_fails, run
for route, fn, want, cf in (("a", c4c, [0, 60, 120, 180], 4),
("b", c4b, [0, 60, 120, 192, 197, 202], 7)):
for route, fn, want, cf in (("a", c4c, [0, 60, 120], 3),
("b", c4b, [0, 60, 120], 3)):
res = {k: fn(k) for k in "RX"}
check(f"T19b [{route}] (H4, not worse than base): refused cut tries per "
f"key R {res['R'][0]} cut_fails {res['R'][1]}, X {res['X'][0]} "
f"cut_fails {res['X'][1]} = base {want} / {cf}; no record",
check(f"T19b [{route}] (H4, EV-60: never past the cap of MAX_TRIES): "
f"refused cut tries per key R {res['R'][0]} cut_fails "
f"{res['R'][1]}, X {res['X'][0]} cut_fails {res['X'][1]} = "
f"{want} / {cf} (base had 4 / 7 tries); no record",
res["R"][0] == res["X"][0] == want
and res["R"][1] == res["X"][1] == cf
and not res["X"][2].recs() and not res["R"][2].recs())