Files
goodwe-addon/goodwe_controller/DECISIONS/EV-56-raising-write.md
T
ems-agentandClaude 3682b0754b
checks / unit (pull_request) Successful in 57m33s
infra-pin / fresh (pull_request) Successful in 2s
EV-56: a charger write that raises counts as a not-taken try
ManualWriter._write catches an Exception from drv.write_current (not CancelledError) and returns False, so every caller in Manual and Solar counts it as a refused try: RETRY_S spacing, MAX_TRIES, CHARGER_REFUSED. The tracker is not told (Q2). One ERROR record per raised value, armed again by another value, a taken write, a user change or the charger's return (Q1, G2). Shutdown writes (abandon, release) pass strict and keep base's behaviour (F3, H1, G3); the peak cut path keeps EV-54's (G1). test_ev13 T13: fails is 1 now (Q2). New test_ev56.py.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-30 18:52:11 +01:00

38 lines
2.0 KiB
Markdown

# EV-56 — a charger write that raises is a not-taken try
`drv.write_current` raising (an HA call error, a binding or setup error, a bug)
left `ManualWriter._write` before any bookkeeping, so no caller counted it and
Manual and Solar sent the same write every cycle. The rules below are the PM
rulings Q1-Q4, F1, F3, G1-G3, H1, H3 and H4 (brief v6); the formal check is
reports/EV-56-formal-report.md.
## The rule, in plain words
- **A raise is a try the charger did not take**, on every path that writes a
current (the normal write, a phase change's 0 A and closing current, the
Off or shadow undo): the same RETRY_S spacing, MAX_TRIES cap, give-up and
CHARGER_REFUSED as a refusal, and the same writer state (`log` row,
`attempted_a`, a late accept). `ManualWriter._write` catches it and returns
False; the callers count it as before. Solar counts it in its own `_write`.
- **The tracker is not told** (Q2): no `note_write`, so no refusal window and
no stuck arming. The write's `end_write` (the mute) still runs.
- **One ERROR record per raised value** (Q1): "The car charger step failed",
with the traceback, at the first raise of a value; DEBUG on its retries. It
is armed again by another value written, a taken write, a user change and
the charger's return (G2), in `_rec_a`.
- **A peak cut try that raises** keeps EV-54's path: one DEBUG line, no record
(G1).
- **Shutdown is as before** (F3, H1, G3): `abandon` and `release` pass
`strict`, so a raise still leaves the write. Manual's give-back keeps its
CHARGER_RESTORE; Solar's release stops after 1 try with no cut standing and
keeps the cut path's 3 tries with one. No record at shutdown.
- **Cancel is not a raise**: only `Exception` is caught, never
`CancelledError`.
## Left as they were
The phase select (`write_phases`, Q4, EV-58), Solar's 4 fails for a refused
close (F1), Manual's up to 5 tries of a close value (H3, EV-59) and the cut
tries through a phase change (H4, EV-60). test_ev56.py T5b and T19b pin the
last two at base.