Cause: while the add-on holds the car at 0 A for its own phase change, the car is not charging, so CarTracker.corroborated is False, car_alarm_w() is None, nothing is explained and the floor alarm fires once (rig: EV-10 21:51:11, EV-10b 21:53:03).
Fix: for grading only, the car's fresh, not stuck figure stands in during our own sequence (ctl_car._car_own_pause): from the 0 A write until the current is set again (max 85 s), then at most one corroboration window (60 s). Ends at once on Off, Stop, shadow, unplug, another writer or a refused write. car_exclude (guard input), claim, floor, commands and charger writes unchanged.
Tests: new test_ev15.py (red on f66048b, green here; mutants red). Existing test_ev10/10b/04/03 green.
Cause: while the add-on holds the car at 0 A for its own phase change, the car is not charging, so `CarTracker.corroborated` is False, `car_alarm_w()` is None, nothing is explained and the floor alarm fires once (rig: EV-10 21:51:11, EV-10b 21:53:03).
Fix: for grading only, the car's fresh, not stuck figure stands in during our own sequence (`ctl_car._car_own_pause`): from the 0 A write until the current is set again (max 85 s), then at most one corroboration window (60 s). Ends at once on Off, Stop, shadow, unplug, another writer or a refused write. `car_exclude` (guard input), claim, floor, commands and charger writes unchanged.
Tests: new `test_ev15.py` (red on f66048b, green here; mutants red). Existing test_ev10/10b/04/03 green.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
While the add-on holds the car at 0 A for its own phase change, the car's
figure had no corroboration (not charging), so nothing was explained and the
peak-floor alarm fired once. For grading only, the car's fresh, not stuck
figure now stands in for that sequence (bounded: its own waits plus one
corroboration window), ending at once on Off, Stop, shadow, unplug, another
writer or a refused write. car_exclude, the claim, floor and writes unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
EV-15 review (full tier), head 07f703d — NOT merged: one safety/logic finding goes back to the dev.
F-1 (High, logic) — the grace starts only after the 0 A write RETURNS, but the alarm latch can fire before it.
app/carmode.py:300 creates seq (and with it _car_own_pause, app/ctl_car.py:216-233) only after _write(0) returns, i.e. after ChargerDriver._took has seen the read-back (app/chargers.py:518-527, up to TOOK_S 10 s, polling every 1 s).
The writer runs beside the cycle (car_kick, ctl_car.py:141-150). When the 0 A read-back and the car's state B reach HA in the same update (a polled wallbox: the car lets go within one poll), a cycle can read state B before the writer's next poll returns. In that cycle seq is None, car_alarm_w() is None, so _car_explains_alarm sets _car_need_excl (ctl_car.py:386-387, or w is None). The latch holds for the rest of the quarter; the grace that starts one cycle later cannot undo it.
Repro (unit harness, writer beside the cycle, its poll landing after the cycle's read; scratch/EV-15/review/probe_race.py): sim.lag_s=2, stop_delay_s=0 -> goodwe_peak_soc_floor at 602 s, car_explains False for every limited cycle to the quarter's end. Controls clean: lag 0/0, lag 2/stop 3, lag 5/stop 2. test_ev15 cannot see this: ev04_peak.drive awaits car_settle() every cycle, so the write always finishes before the next read.
Must change: the own-pause window has to start when our 0 A write is SENT (e.g. a writer marker set before _write(0.0) in _begin, cleared if the write is refused; still bounded by OWN_PAUSE_MAX_S from that moment), so no cycle between the send and the return can latch _car_need_excl. A refused 0 A write must still give no grace after its refusal.
Test that proves it: a test_ev15 case with the writer running beside the cycle (not awaited per cycle; its _took poll after the cycle's read) and sim.lag_s=2, stop_delay_s=0, rig shape 3 -> 1: no PEAK_GUARD_FLOOR_LIMITED, no goodwe_peak_soc_floor, car explains in every limited cycle. Red on 07f703d, green after. Plus: a 0 A write the charger does not take (read-back never follows) gives no grace after _took returns False.
Info (no change asked):
I-1: in the 60 s tail (seq None, phase_done_at set) _car_own_pause does not check car_writer.hold (another writer). The DECISIONS text says the grace ends on another writer; that is true during the sequence. In the tail the figure is still capped by the read-back, and once the car charges the existing first-minute corroboration rule trusts it anyway, so the effect is negligible. The dev may add not wr.hold while in there.
Other checks (all fine):
Cause (check 1): confirmed. chargers.py_corr_note clears on not-charging -> corroborated False -> car_w_trusted None -> _car_need_excl latches (ctl_car.py:386-387). Matches the rig lines (p1h 21:51:11 / 21:53:03).
Safety and bounds (check 2): the bound holds in code (OWN_PAUSE_MAX_S 85 s from t0, tail 60 s from phase_done_at); a hung write cannot extend it. Off/Stop/shadow/unplug/refused select/refused final write/outside raise all end it. While paused the read-back is 0 A (the 0 A write only counts once the read-back follows), so the cap makes the car 0 W: only the energy it already drew is credited to it. A frozen figure cannot add more. A house overload still fails without the car. Latches and ws_p reset per quarter. A refused 0 A write makes no seq, so repeated attempts cannot chain grace with the car still drawing power.
ws_p (check 3): only car_exclude_alarm reads it (graded=True). car_exclude, _car_bank, over, claim/floor/commands and the write paths are unchanged.
Tests (check 4), in goodwe-addon-checks:1 on 07f703d: test_ev15, ev10b, ev10, ev04, ev03, safety81/87/126/126b, modes_p3/p4, opt20, opt36, ux77, named_absence, bytecode, docs, version_gate all green. My mutants were red, then reverted: M1 drop r.state != "A" -> 2 checks fail. M2 skip stuck() for the paused figure -> 1 check fails.
Text (check 5): the DECISIONS paragraph and CHANGELOG line are plain. ### Not in a release yet sits above ## 0.24.0 (test_version_gate green), and 0.24.0 is untouched.
CI (check 6): checks / unit (pull_request) run 1730 is green on 07f703d.
**EV-15 review (full tier), head 07f703d — NOT merged: one safety/logic finding goes back to the dev.**
**F-1 (High, logic) — the grace starts only after the 0 A write RETURNS, but the alarm latch can fire before it.**
- `app/carmode.py:300` creates `seq` (and with it `_car_own_pause`, `app/ctl_car.py:216-233`) only after `_write(0)` returns, i.e. after `ChargerDriver._took` has seen the read-back (`app/chargers.py:518-527`, up to `TOOK_S` 10 s, polling every 1 s).
- The writer runs beside the cycle (`car_kick`, `ctl_car.py:141-150`). When the 0 A read-back and the car's state B reach HA in the same update (a polled wallbox: the car lets go within one poll), a cycle can read state B before the writer's next poll returns. In that cycle `seq` is None, `car_alarm_w()` is None, so `_car_explains_alarm` sets `_car_need_excl` (`ctl_car.py:386-387`, `or w is None`). The latch holds for the rest of the quarter; the grace that starts one cycle later cannot undo it.
- Repro (unit harness, writer beside the cycle, its poll landing after the cycle's read; `scratch/EV-15/review/probe_race.py`): `sim.lag_s=2, stop_delay_s=0` -> `goodwe_peak_soc_floor` at 602 s, `car_explains` False for every limited cycle to the quarter's end. Controls clean: `lag 0/0`, `lag 2/stop 3`, `lag 5/stop 2`. `test_ev15` cannot see this: `ev04_peak.drive` awaits `car_settle()` every cycle, so the write always finishes before the next read.
- **Must change:** the own-pause window has to start when our 0 A write is SENT (e.g. a writer marker set before `_write(0.0)` in `_begin`, cleared if the write is refused; still bounded by `OWN_PAUSE_MAX_S` from that moment), so no cycle between the send and the return can latch `_car_need_excl`. A refused 0 A write must still give no grace after its refusal.
- **Test that proves it:** a test_ev15 case with the writer running beside the cycle (not awaited per cycle; its `_took` poll after the cycle's read) and `sim.lag_s=2, stop_delay_s=0`, rig shape 3 -> 1: no PEAK_GUARD_FLOOR_LIMITED, no `goodwe_peak_soc_floor`, car explains in every limited cycle. Red on 07f703d, green after. Plus: a 0 A write the charger does not take (read-back never follows) gives no grace after `_took` returns False.
**Info (no change asked):**
- I-1: in the 60 s tail (`seq` None, `phase_done_at` set) `_car_own_pause` does not check `car_writer.hold` (another writer). The DECISIONS text says the grace ends on another writer; that is true during the sequence. In the tail the figure is still capped by the read-back, and once the car charges the existing first-minute corroboration rule trusts it anyway, so the effect is negligible. The dev may add `not wr.hold` while in there.
**Other checks (all fine):**
- Cause (check 1): confirmed. `chargers.py` `_corr_note` clears on not-charging -> `corroborated` False -> `car_w_trusted` None -> `_car_need_excl` latches (`ctl_car.py:386-387`). Matches the rig lines (p1h 21:51:11 / 21:53:03).
- Safety and bounds (check 2): the bound holds in code (`OWN_PAUSE_MAX_S` 85 s from `t0`, tail 60 s from `phase_done_at`); a hung write cannot extend it. Off/Stop/shadow/unplug/refused select/refused final write/outside raise all end it. While paused the read-back is 0 A (the 0 A write only counts once the read-back follows), so the cap makes the car 0 W: only the energy it already drew is credited to it. A frozen figure cannot add more. A house overload still fails without the car. Latches and `ws_p` reset per quarter. A refused 0 A write makes no `seq`, so repeated attempts cannot chain grace with the car still drawing power.
- `ws_p` (check 3): only `car_exclude_alarm` reads it (`graded=True`). `car_exclude`, `_car_bank`, `over`, claim/floor/commands and the write paths are unchanged.
- Tests (check 4), in goodwe-addon-checks:1 on 07f703d: test_ev15, ev10b, ev10, ev04, ev03, safety81/87/126/126b, modes_p3/p4, opt20, opt36, ux77, named_absence, bytecode, docs, version_gate all green. My mutants were red, then reverted: M1 drop `r.state != "A"` -> 2 checks fail. M2 skip `stuck()` for the paused figure -> 1 check fails.
- Text (check 5): the DECISIONS paragraph and CHANGELOG line are plain. `### Not in a release yet` sits above `## 0.24.0` (test_version_gate green), and 0.24.0 is untouched.
- CI (check 6): `checks / unit (pull_request)` run 1730 is green on 07f703d.
The writer runs beside the cycle and the car can stop before the write
returns, so no sequence existed yet and the latch set. Window now opens at
send (zero_sent_at), cleared on return; ends on another writer in the tail too.
Co-Authored-By: Claude <noreply@anthropic.com>
EV-15 re-review (round 2), full tier: head 6d7046f, plus my Low fix 7788543
F-1 (High): fixed. The grace now opens when the 0 A write is sent (zero_sent_at in ManualWriter._begin, cleared in finally). _car_own_pause counts the 85 s bound from the send.
probe_race, with the writer beside the cycle: lag 2/0 now gives no alarm, and the car explains every limited cycle. The controls 0/0, 2/3 and 5/2 are clean too.
0 A write that hangs forever: the grace lasts 601-685 s (85 s from the send) and stops there. The floor alarm then fires at 686. A 25 kW house overload at 606 alarms at 606, the same second as with no phase change.
Three refused retries (ignore): three windows of 10 s, 60 s apart (601-610, 661-670, 721-730). They do not chain, and the writer then gives up. With error: no window at all. A house overload alarms at 606 with or without the grace.
A refusal at the quarter boundary (send at 896): the windows match the case above, ws_p resets in the new quarter, and nothing is hidden.
Off, Stop or unplug while the 0 A write is still waiting (lag 8 s): the grace is off from the next cycle.
I-1: fixed.wr.hold now ends the grace in the 60 s tail too, and a test covers it. The writer's other changes are bookkeeping only: zero_sent_at, and phase_done_at is now reset before the write.
Round 1 still holds.
Tests pass in goodwe-addon-checks:1: test_ev15/ev10b/ev10/ev04/ev03, safety81/87/126/126b, modes_p3/p4, opt20/36, ux77, named_absence, bytecode, docs and version_gate.
The EV-10 repros match the earlier reports. break_twin 3075/3100/3200 alarms at 850 in both Manual and Off, and 3000 is clean. break_house 6000/7800/9000 alarms at 600.
The guard input, claim, floor and commands are unchanged.
Mutants (red, then reverted, run in copies):
M3, no zero_sent_at = now: 3 test_ev15 checks fail, among them the lag 2/0 case.
M4, no clear in finally: 2 checks fail.
Info (no action, not from this PR): a refused 0 A write leads to goodwe_peak_soc_floor about 59 s later. Base f66048b does the same at the same second.
Low, fixed by me:goodwe_controller/app/ctl_car.py:217-221, the _car_own_pause docstring had one 123-character line; I reflowed it (7788543).
**EV-15 re-review (round 2), full tier: head 6d7046f, plus my Low fix 7788543**
**F-1 (High): fixed.** The grace now opens when the 0 A write is sent (`zero_sent_at` in `ManualWriter._begin`, cleared in `finally`). `_car_own_pause` counts the 85 s bound from the send.
- probe_race, with the writer beside the cycle: lag 2/0 now gives no alarm, and the car explains every limited cycle. The controls 0/0, 2/3 and 5/2 are clean too.
- 0 A write that hangs forever: the grace lasts 601-685 s (85 s from the send) and stops there. The floor alarm then fires at 686. A 25 kW house overload at 606 alarms at 606, the same second as with no phase change.
- Three refused retries (`ignore`): three windows of 10 s, 60 s apart (601-610, 661-670, 721-730). They do not chain, and the writer then gives up. With `error`: no window at all. A house overload alarms at 606 with or without the grace.
- A refusal at the quarter boundary (send at 896): the windows match the case above, `ws_p` resets in the new quarter, and nothing is hidden.
- Off, Stop or unplug while the 0 A write is still waiting (lag 8 s): the grace is off from the next cycle.
**I-1: fixed.** `wr.hold` now ends the grace in the 60 s tail too, and a test covers it. The writer's other changes are bookkeeping only: `zero_sent_at`, and `phase_done_at` is now reset before the write.
**Round 1 still holds.**
- Tests pass in `goodwe-addon-checks:1`: test_ev15/ev10b/ev10/ev04/ev03, safety81/87/126/126b, modes_p3/p4, opt20/36, ux77, named_absence, bytecode, docs and version_gate.
- The EV-10 repros match the earlier reports. break_twin 3075/3100/3200 alarms at 850 in both Manual and Off, and 3000 is clean. break_house 6000/7800/9000 alarms at 600.
- The guard input, claim, floor and commands are unchanged.
**Mutants (red, then reverted, run in copies):**
- M3, no `zero_sent_at = now`: 3 test_ev15 checks fail, among them the lag 2/0 case.
- M4, no clear in `finally`: 2 checks fail.
**Info (no action, not from this PR):** a refused 0 A write leads to `goodwe_peak_soc_floor` about 59 s later. Base f66048b does the same at the same second.
**Low, fixed by me:** `goodwe_controller/app/ctl_car.py:217-221`, the `_car_own_pause` docstring had one 123-character line; I reflowed it (7788543).
admin
merged commit 9fdce023e9 into release/1.02026-11-17 17:15:52 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Cause: while the add-on holds the car at 0 A for its own phase change, the car is not charging, so
CarTracker.corroboratedis False,car_alarm_w()is None, nothing is explained and the floor alarm fires once (rig: EV-10 21:51:11, EV-10b 21:53:03).Fix: for grading only, the car's fresh, not stuck figure stands in during our own sequence (
ctl_car._car_own_pause): from the 0 A write until the current is set again (max 85 s), then at most one corroboration window (60 s). Ends at once on Off, Stop, shadow, unplug, another writer or a refused write.car_exclude(guard input), claim, floor, commands and charger writes unchanged.Tests: new
test_ev15.py(red onf66048b, green here; mutants red). Existing test_ev10/10b/04/03 green.🤖 Generated with Claude Code
https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
EV-15 review (full tier), head
07f703d— NOT merged: one safety/logic finding goes back to the dev.F-1 (High, logic) — the grace starts only after the 0 A write RETURNS, but the alarm latch can fire before it.
app/carmode.py:300createsseq(and with it_car_own_pause,app/ctl_car.py:216-233) only after_write(0)returns, i.e. afterChargerDriver._tookhas seen the read-back (app/chargers.py:518-527, up toTOOK_S10 s, polling every 1 s).car_kick,ctl_car.py:141-150). When the 0 A read-back and the car's state B reach HA in the same update (a polled wallbox: the car lets go within one poll), a cycle can read state B before the writer's next poll returns. In that cycleseqis None,car_alarm_w()is None, so_car_explains_alarmsets_car_need_excl(ctl_car.py:386-387,or w is None). The latch holds for the rest of the quarter; the grace that starts one cycle later cannot undo it.scratch/EV-15/review/probe_race.py):sim.lag_s=2, stop_delay_s=0->goodwe_peak_soc_floorat 602 s,car_explainsFalse for every limited cycle to the quarter's end. Controls clean:lag 0/0,lag 2/stop 3,lag 5/stop 2.test_ev15cannot see this:ev04_peak.driveawaitscar_settle()every cycle, so the write always finishes before the next read._write(0.0)in_begin, cleared if the write is refused; still bounded byOWN_PAUSE_MAX_Sfrom that moment), so no cycle between the send and the return can latch_car_need_excl. A refused 0 A write must still give no grace after its refusal._tookpoll after the cycle's read) andsim.lag_s=2, stop_delay_s=0, rig shape 3 -> 1: no PEAK_GUARD_FLOOR_LIMITED, nogoodwe_peak_soc_floor, car explains in every limited cycle. Red on07f703d, green after. Plus: a 0 A write the charger does not take (read-back never follows) gives no grace after_tookreturns False.Info (no change asked):
seqNone,phase_done_atset)_car_own_pausedoes not checkcar_writer.hold(another writer). The DECISIONS text says the grace ends on another writer; that is true during the sequence. In the tail the figure is still capped by the read-back, and once the car charges the existing first-minute corroboration rule trusts it anyway, so the effect is negligible. The dev may addnot wr.holdwhile in there.Other checks (all fine):
chargers.py_corr_noteclears on not-charging ->corroboratedFalse ->car_w_trustedNone ->_car_need_excllatches (ctl_car.py:386-387). Matches the rig lines (p1h 21:51:11 / 21:53:03).OWN_PAUSE_MAX_S85 s fromt0, tail 60 s fromphase_done_at); a hung write cannot extend it. Off/Stop/shadow/unplug/refused select/refused final write/outside raise all end it. While paused the read-back is 0 A (the 0 A write only counts once the read-back follows), so the cap makes the car 0 W: only the energy it already drew is credited to it. A frozen figure cannot add more. A house overload still fails without the car. Latches andws_preset per quarter. A refused 0 A write makes noseq, so repeated attempts cannot chain grace with the car still drawing power.ws_p(check 3): onlycar_exclude_alarmreads it (graded=True).car_exclude,_car_bank,over, claim/floor/commands and the write paths are unchanged.07f703d: test_ev15, ev10b, ev10, ev04, ev03, safety81/87/126/126b, modes_p3/p4, opt20, opt36, ux77, named_absence, bytecode, docs, version_gate all green. My mutants were red, then reverted: M1 dropr.state != "A"-> 2 checks fail. M2 skipstuck()for the paused figure -> 1 check fails.### Not in a release yetsits above## 0.24.0(test_version_gate green), and 0.24.0 is untouched.checks / unit (pull_request)run 1730 is green on07f703d.EV-15 re-review (round 2), full tier: head
6d7046f, plus my Low fix7788543F-1 (High): fixed. The grace now opens when the 0 A write is sent (
zero_sent_atinManualWriter._begin, cleared infinally)._car_own_pausecounts the 85 s bound from the send.ignore): three windows of 10 s, 60 s apart (601-610, 661-670, 721-730). They do not chain, and the writer then gives up. Witherror: no window at all. A house overload alarms at 606 with or without the grace.ws_presets in the new quarter, and nothing is hidden.I-1: fixed.
wr.holdnow ends the grace in the 60 s tail too, and a test covers it. The writer's other changes are bookkeeping only:zero_sent_at, andphase_done_atis now reset before the write.Round 1 still holds.
goodwe-addon-checks:1: test_ev15/ev10b/ev10/ev04/ev03, safety81/87/126/126b, modes_p3/p4, opt20/36, ux77, named_absence, bytecode, docs and version_gate.Mutants (red, then reverted, run in copies):
zero_sent_at = now: 3 test_ev15 checks fail, among them the lag 2/0 case.finally: 2 checks fail.Info (no action, not from this PR): a refused 0 A write leads to
goodwe_peak_soc_floorabout 59 s later. Basef66048bdoes the same at the same second.Low, fixed by me:
goodwe_controller/app/ctl_car.py:217-221, the_car_own_pausedocstring had one 123-character line; I reflowed it (7788543).