SAFETY-25: say what peak_soc_floor bounds, and measure what it does not
checks / unit (pull_request) Successful in 3m41s
checks / unit (pull_request) Successful in 3m41s
peak_soc_floor reads like a pack-wide reserve and is not one. The
grid-following loop has no SoC guard of any kind, so on a sustained-load
evening it discharges straight past that number and keeps going until the
pack's own BMS cut-out stops it.
The gap has now been written down four times without being filed -
SAFETY-18's finding (freeze.py:18), SAFETY-24's module note, its PR body,
and its honestly-uncaught 13th mutation - and never once measured. It is
measured here, on the committed 2026-08-20 capture, driving the SHIPPED
control.compute(), peakguard.decide(), peakguard.claim() and the real
arbiter.resolve() in main.py's order:
19:00-22:00 UTC, 830 W mean, minimum 701 W, zero export in the window
reference pack (300 Ah x 51.2 V x DoD 90) started at 21 %, one point
above peak_soc_floor
ends at 10.0 % - the bms_soc_floor cut-out
1525 Wh delivered by the LOOP over 587 cycles
549 cycles below peak_soc_floor, 343 of them still discharging
0 cycles on which the peak guard filed any floor at all
AND IT IS A BEHAVIOUR, NOT A CONFIG VALUE. The same evening ends at
9.9715 % at peak_soc_floor = 5, 11, 20 and 60 - the shipped value and both
ends of the schema range - identical to four decimal places. The option an
operator would reach for cannot move the number by any amount at all. On
the same day's high-load block the two states coexist: 49 cycles reporting
PEAK GUARD FLOOR-LIMITED and, on all 49 of them, the arbiter simultaneously
granting the loop up to 2000 W of discharge.
WHY SAFETY-24 COULD NOT CLOSE IT. The peak guard files a `lo` limit - a
LOWER bound on the setpoint. That asymmetry is exactly what makes it
trustworthy: a reviewer proved across 19,800 combinations that it can never
lower a target, cap a discharge or contradict the arbiter. The same property
makes it structurally incapable of stopping a discharge the loop itself
wants. A floor on the guard cannot become a floor on the pack by being
raised, and the sweep above is that sentence measured.
WHAT THIS COMMIT CHANGES IS THE HONESTY, on the four surfaces an operator
actually reads. That half is required whichever way the open question is
answered, and it is the real misstatement on the live system today:
* config.yaml, beside the option itself - it BOUNDS THE PEAK GUARD ONLY
and is NOT A PACK-WIDE RESERVE, with the replayed evening and the sweep;
* DOCS.md, in the options table and in a new section carrying the figures;
* the STATUS-PAGE ROW for a floor-limited guard. This is the one line a
human reads at the moment the guard stops discharging, and read alone it
says "the battery is being held at peak_soc_floor" - which the replay
shows is false in every cycle that row is rendered;
* the PERSISTENT NOTIFICATION, which outlives the page. It now names what
has stopped (the guard buying a lower bill) and what has not (the pack
being spent).
peakguard.py and freeze.py carry the measurement beside the findings they
already recorded, so the next reader does not have to take the caveat on
trust.
THE PRODUCT DECISION IS NOT TAKEN HERE, and must not be. Whether the loop
gets a reserve floor of its own decides whether this house's battery may
discharge to the BMS floor on a heavy evening; that moves real energy and it
is the owner's call. DECISIONS/SAFETY-25-loop-soc-floor.md is the memo AC 1
asks for: the options, what each costs, what each protects, weighed against
MAINT-01 (a pack repeatedly at the BMS floor is the SoC-drift condition the
maintenance cycle exists to correct, and an over-tight reserve fights it from
the other side) and against the fact that this would be the FIFTH SoC key -
OPT-04's arbitrage_soc_floor fired SAFETY-24's "revisit if a third floor
appears" trigger unremarked, so SAFETY-27's naming decision should land
first. It carries a recommendation and says plainly that it is not a
decision.
It also records a trap found while writing it, and now CHECKED through the
real arbiter rather than described: the obvious shape of a loop-side floor
is a `hi` limit at P_LOOP, and filed while the peak guard is asking for a
positive floor that is `lo > hi` - which arbiter.py resolves to a
CONTRADICTION at 0 W, the battery PARKED in the one quarter of the month
that sets the bill. It is the same crossing-limits hazard
shaping_suspended() already exists to avoid. The ordering
`bms_soc_floor < loop_soc_floor <= peak_soc_floor` removes it provably,
because wherever the reserve binds the guard is already floor-limited and
files lo = 0; both halves are run in part 10d.
test_peakguard.py part 10 is a TRIPWIRE, not a guarantee. It records a
defect and goes RED the day somebody builds a loop-side floor, so the
exposure cannot change size under a green suite and closing it has to be
deliberate. Part 11's mutation 13 stays honestly NOT CAUGHT - nothing
prevents the loop discharging past this floor - but it now reports a number
instead of a sentence.
Verified: 16/16 suites green in the CI image. Eight mutations, each against
a tree copied fresh with __pycache__ excluded and mounted :ro, so no .pyc
existed to go stale (MUTATION.md's structural immunity, the same one it
records for CI); byte deltas +61, -8, -465, -430, -1088, -46, file deleted,
and -95; none is +0 B. All eight go red on the named check:
M1 peakguard.claim() also files hi=floor_w -> 7 red, incl. 10c
M2 control.compute() gain forced to 0 -> 6 red, incl. 10a/10b
M3 scope sentence removed from the status row -> 10e red
M4 scope sentence removed from the notification -> 10e red
M5 scope paragraph removed from config.yaml -> 10e red
M6 scope bullet weakened in DOCS.md -> 10e red
M7 the decision memo deleted -> 10e red
M8 arbiter clamps crossing limits instead of
reporting a contradiction -> 5 red, incl. 10d
AC 2 is left explicitly OPEN, pending the owner's answer.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,73 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
**`peak_soc_floor` reads like a pack-wide reserve and is not one, and on a
|
||||
sustained-load evening the grid-following loop discharges straight past it to
|
||||
the BMS cut-out (SAFETY-25).** The gap has been written down four times without
|
||||
being filed — SAFETY-18's finding (`freeze.py`), SAFETY-24's module note, its PR
|
||||
body, and its honestly-uncaught 13th mutation — and never once measured. It is
|
||||
measured now, on the committed 2026-08-20 capture, driving the shipped
|
||||
`control.compute()`, `peakguard.decide()`, `peakguard.claim()` and the real
|
||||
`arbiter.resolve()`:
|
||||
|
||||
19:00-22:00 UTC, 830 W mean, minimum 701 W, not one watt of export
|
||||
reference pack (300 Ah x 51.2 V x DoD 90) started at 21 %, one point
|
||||
above peak_soc_floor
|
||||
|
||||
ends at 10.0 % - the bms_soc_floor cut-out
|
||||
1525 Wh delivered by the LOOP over 587 cycles
|
||||
549 cycles below peak_soc_floor, 343 of them still discharging
|
||||
0 cycles on which the peak guard filed any floor at all
|
||||
|
||||
**And it is a behaviour, not a config value.** The same evening ends at
|
||||
`9.9715 %` at `peak_soc_floor` = 5, 11, 20 **and** 60 — the shipped value and
|
||||
both ends of the schema range — identical to four decimal places. The option an
|
||||
operator would reach for cannot move the number by any amount. On the same day's
|
||||
high-load block the two states coexist: 49 cycles reporting `PEAK GUARD
|
||||
FLOOR-LIMITED` and, on **all 49**, the arbiter simultaneously granting the loop
|
||||
up to 2000 W of discharge.
|
||||
|
||||
**Why SAFETY-24 could not close it.** The peak guard files a `lo` limit — a
|
||||
*lower* bound. That asymmetry is what makes it provably unable to lower a target,
|
||||
cap a discharge or contradict the arbiter, and it is therefore equally unable to
|
||||
stop a discharge the loop itself wants. A floor on the guard cannot become a
|
||||
floor on the pack by being raised.
|
||||
|
||||
**What changed is the honesty, on four operator-facing surfaces**, because that
|
||||
half is required whichever way the open question is answered and it is the actual
|
||||
misstatement on the live system today:
|
||||
|
||||
- `config.yaml` says next to the option that it **bounds the peak guard only** and
|
||||
is **not a pack-wide reserve**, with the replayed evening and the sweep;
|
||||
- `DOCS.md` says it in the options table and in a new section carrying the
|
||||
figures above;
|
||||
- the **status-page row** for a floor-limited guard carries the scope sentence —
|
||||
it is the one line a human reads at the moment the guard stops, and read alone
|
||||
it implies a reserve the replay shows does not exist;
|
||||
- the **persistent notification** says what has stopped (the guard buying a lower
|
||||
bill) and what has not (the pack being spent).
|
||||
|
||||
`peakguard.py` and `freeze.py` carry the measurement beside the findings they
|
||||
already recorded.
|
||||
|
||||
**The product decision is NOT taken here.** Whether the loop gets a reserve floor
|
||||
of its own moves real energy on this house and belongs to the owner.
|
||||
`DECISIONS/SAFETY-25-loop-soc-floor.md` records the options, what each costs and
|
||||
protects, weighed against MAINT-01 and against the fact that this would be the
|
||||
**fifth** SoC key (OPT-04's `arbitrage_soc_floor` fired SAFETY-24's "revisit if a
|
||||
third floor appears" trigger unremarked), and a recommendation. It also records a
|
||||
trap found while writing it and now checked through the real arbiter: the obvious
|
||||
shape — a `hi` limit on the loop — crosses the peak guard's `lo` and resolves to a
|
||||
**CONTRADICTION at 0 W**, the battery parked in the quarter that sets the bill,
|
||||
unless `bms_soc_floor < loop_soc_floor <= peak_soc_floor` is enforced at startup.
|
||||
|
||||
**`test_peakguard.py` part 10 is a tripwire, not a guarantee.** It records the
|
||||
defect and goes **red** the day a loop-side floor is built, so the exposure cannot
|
||||
change size under a green suite. Eight mutations were run against it, each
|
||||
against a freshly copied tree with no `__pycache__` present at all, mounted
|
||||
`:ro` — the same structural immunity `MUTATION.md` records for CI. All eight go
|
||||
red on the named check.
|
||||
|
||||
**A setpoint device smaller than `max_w` silently disarmed the frozen-meter
|
||||
detector, and the status page reported it as armed (SAFETY-20).** SAFETY-18's
|
||||
conjunction needs `abs(commanded_w) >= 0.95 * max_w`, but the emitted command is
|
||||
|
||||
Reference in New Issue
Block a user