From 0774d1efd5c800a27518edce9f4dcbb9e3132051 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 06:54:30 +0100 Subject: [PATCH] EV-13 router round 3: N2 names P1/P2; P4 live window dated the send; kills R1 Co-Authored-By: Claude --- goodwe_controller/test_ev13.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/goodwe_controller/test_ev13.py b/goodwe_controller/test_ev13.py index d89aa70..b0c57d6 100644 --- a/goodwe_controller/test_ev13.py +++ b/goodwe_controller/test_ev13.py @@ -1033,6 +1033,28 @@ check(f"P4 [live]: no life, the read-back moves at +5, after the refusal was " f"noted: armed dated the send and disarmed by the move, never stuck, " f"as on the base ({tr.armed_at}, {first})", first is None and tr.armed_at is None and not tr.stuck_now and pend(tr) is None) +# The live case, looked at second by second: between the send and the move the +# refusal is a window dated the send (not yet armed, as nothing is decided); +# it arms dated TS when it runs out, with the sig AT THE SEND, so the moved +# read-back disarms it at once (kills the reviewer's R1: arm with the current sig). +_dates = [] +_tr = CH.CarTracker() +for _i in range(-20, 1): + _tr.observe(rd(**zero), TS + _i, UTC, DAY) +_orig = _tr._pend_arm +_tr._pend_arm = lambda: (_dates.append((_tr._pend or {}).get("t")), _orig()) +_tr.note_write(TS, 16.0, 10.0, False) +_mid = [] +for _s, _r in steady({5: dict(a=10.0)}, end=14, **zero): + _tr.observe(_r, _s, UTC, DAY) + _mid.append((_s - TS, (pend(_tr) or {}).get("t"), _tr.armed_at)) +check("P4 [live]: from the send to the move the refusal is an open window " + "dated TS (armed_at still None)", all(w == TS and a is None + for s, w, a in _mid if s < 11)) +check(f"P4 [live]: the window arms dated TS when it runs out, and the moved " + f"read-back disarms it in the same sample ({_dates}, {_mid[-1]})", + _dates == [TS] and _tr.armed_at is None and not _tr.stuck_now + and pend(_tr) is None) tr, first, ever = play(steady({5: dict(a=10.0)}, **zero), "ring", pre=zero) check(f"P4 [ring]: the read-back moved inside the window BEFORE the refusal " f"was noted (the write waited): it still arms, dated the send, and is " @@ -1056,6 +1078,12 @@ check(f"N1: no stuck after refusals that all showed life (T1-T5, T9 edges, " check(f"N2: every refusal with no life is stuck within 61 s of its send " f"(T6-T11, T12b, T16, T20: {len(N2)} runs)", len(N2) >= 20 and all(d is not None and d <= 61 for _n, d in N2)) +for _p in ("P1 L1 present before", "P2 L1 absent before", + "P1 per phase", "P2 per phase"): + _runs = [d for n, d in N2 if n.startswith(_p)] + check(f"N2 includes {_p!r} in all three modes: {len(_runs)} runs, each " + f"stuck within 61 s of its send", len(_runs) == 3 + and all(d is not None and d <= 61 for d in _runs)) check("N5: no house-caused alarm later than the no-write twin or Off (T22 " "equals its twin; T23 within a second of both)", alarm_list(r_ref) == alarm_list(r_twin)