EV-28 review: pin the restore step in T17a and the counted failure in T15
checks / unit (pull_request) Successful in 28m34s
infra-pin / fresh (pull_request) Successful in 1s

Review fixes, no logic change:
- T17a now asserts the restore is the first write once the charger is back
  (it was only checked to happen at some point); mutant M3 (restore after
  SETTLE_S) now turns T17a red.
- T15 now asserts the refused restore is counted once (`fails == 1`);
  a mutant without `_failed` there now turns T15 red.
- DECISIONS "The phase sequence" and the carmode docstring reflowed to 79
  columns; DECISIONS says D counts as drawing too, as the code does.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude (review agent)
2026-11-21 22:58:56 +01:00
parent 83f114fe08
commit 4b4a4c1053
3 changed files with 18 additions and 15 deletions
@@ -30,14 +30,14 @@ code had to decide that the design left open.
## The phase sequence
0 A, wait until the charger reports under 100 W (mode3 leaving C counts only
when there is no power reading; 20 s at most), select the phases, wait 10 s, write the current. One switch per 10 minutes. A
charger that does not take the 0 A never gets the phases select. A car still
drawing after 20 s gets no select: its current comes back and it counts as a
failed try (EV-28). A sequence that
has begun is finished whatever the mode, because it leaves the car at 0 A
otherwise; a stop of the add-on in the middle gives the car its current back
(`car_shutdown`).
0 A, wait until the charger reports under 100 W (mode3 leaving C and D counts
only when there is no power reading; 20 s at most), select the phases, wait
10 s, write the current. One switch per 10 minutes. A charger that does not
take the 0 A never gets the phases select. A car still drawing after 20 s gets
no select: its current comes back and it counts as a failed try (EV-28). A
sequence that has begun is finished whatever the mode, because it leaves the
car at 0 A otherwise; a stop of the add-on in the middle gives the car its
current back (`car_shutdown`).
## Another writer
+3 -3
View File
@@ -17,9 +17,9 @@ THE RULES, each tested in test_ev04.py:
* Phases change only through the SAFE SEQUENCE: 0 A, wait until the charger
reports under `QUIET_W` (mode3 leaving C only without a power reading; at
most `ZERO_WAIT_S`, then the current comes back and it counts as a failed
try), select the phases, wait `SETTLE_S`, write the current again. At most one switch per
`PHASE_GAP_S`. A sequence that has begun is always finished, because it
leaves the car at 0 A otherwise.
try), select the phases, wait `SETTLE_S`, write the current again. At most
one switch per `PHASE_GAP_S`. A sequence that has begun is always finished,
because it leaves the car at 0 A otherwise.
* A read-back that differs from the add-on's own last write for `WRITER_S` is
ANOTHER WRITER: an info row, and no write over it until the user changes the
mode or a value again.
+7 -4
View File
@@ -518,9 +518,11 @@ async def t17(ramp):
w, during, first = run(t17(50.0))
check(f"T17a: back after 30 s at ~800 W: no write while unavailable, no "
f"select, then the restore ({[x[1:3] for x in first]})",
f"select, the restore on the first available step "
f"({[x[1:3] for x in first]})",
during == 0 and not w.writes("phases") and w.sim.readback_a == 10
and w.wr.phase_fails == 1)
and w.wr.phase_fails == 1
and [x[1:3] for x in first][:1] == [("current", 10.0)])
w, during, first = run(t17(200.0))
ph = w.writes("phases")
check(f"T17b: back at 0 W: the select at the first available step "
@@ -698,7 +700,8 @@ async def t15():
await w.step(19)
w.sim.refuse = "error"
await w.step(40)
mid = (list(calls), w.wr.seq is None, bool(w.writes("phases")))
mid = (list(calls), w.wr.seq is None and w.wr.fails == 1,
bool(w.writes("phases")))
w.sim.refuse = None
await w.step(int(carmode.RETRY_S) + 10)
return w, mid
@@ -708,7 +711,7 @@ w, (calls, over, anyph) = run(t15())
tries = [c for c in calls if c[1] == 16.0]
gaps = [round(b[0] - a[0]) for a, b in zip(tries, tries[1:])]
check(f"T15: the restore is refused: tried {len(tries)} times ~5 s apart "
f"({gaps}), no select, sequence ends",
f"({gaps}), no select, sequence ends, one failed write counted",
len(tries) == MAX_TRIES and all(4 <= g <= 6 for g in gaps) and over
and not anyph and not w.writes("phases"))
check("T15: after the refusal ends the current is back at 16 A, never a "