TEST-10: pin max_w beside the meter_freeze_s key TEST-06 already pinned
checks / unit (pull_request) Successful in 3m43s
checks / unit (pull_request) Successful in 3m43s
max_w and the LIVE_MAX_W literal beside it were the two survivors left
after TEST-06 pinned meter_freeze_s: changing max_w 2000 -> 4500 in
config.yaml passed every check in test_freeze.py and test_tariff.py
GREEN, and LIVE_MAX_W = 5000.0 was a bare literal that silently
disagreed with the shipped max_w (2000) with nothing in the file
saying so. For contrast, deadband_w 15 -> 5 already went RED 2 + 1,
so the pinning technique was known to work - it just was not applied
to the key either side of it.
Three changes, each measured:
1. test_freeze.py gains a check comparing Tuning()'s code default
(control.py, 2000.0) against SHIPPED_MAX_W, read from config.yaml
by extending the file's existing _cfg_default() regex reader
rather than reimplementing test_arbitrage.py's _shipped. Broken
and confirmed red: max_w: 2000 -> 4500 in config.yaml now fails
exactly "the code default and the shipped default agree on max_w
too" and nothing else in either file; reverting returns both files
to all-green. (AC 1, AC 4)
2. LIVE_MAX_W is renamed LIVE_INSTALL_MAX_W in both test_freeze.py
and test_tariff.py, each with a comment stating plainly that 5000
is the live install's own override, not config.yaml's shipped
max_w (2000) - the defect was a literal that could be misread as
the shipped default, not the number itself. (AC 2)
3. test_freeze.py states PINNED_KEYS = ("meter_freeze_s", "deadband_w",
"max_w") in one place as the complete set of config keys this
suite pins. Deliberately excludes maintenance_* - CFG-03 (merged
into release/1.0 since this branch started, merged in here) gave
those keys a separate single source of truth in app/maintenance.py
and this ticket has no reason to duplicate that pin. Not every key
in config.yaml is pinned here on purpose: meter_freeze_s,
deadband_w and max_w are the three this file's mutual-exclusion
arithmetic (section 2b) actually reasons about together. (AC 3)
Full 17-file suite run green under goodwe-addon-ci after the merge
with release/1.0 (f630ed9, CFG-03). CHANGELOG.md updated under
Unreleased.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f630ed949b
commit
d0b053b150
@@ -2,6 +2,28 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
**`max_w` and the `LIVE_MAX_W` literal beside it were unpinned in test_freeze.py
|
||||
and test_tariff.py, the same gap TEST-06 closed one key over for
|
||||
`meter_freeze_s` (TEST-10).** Measured before the fix: `max_w: 2000 -> 4500`
|
||||
in `config.yaml` left every check in both files GREEN, and `LIVE_MAX_W = 5000.0`
|
||||
was a bare literal that silently disagreed with the shipped default (2000) with
|
||||
nothing saying so — for contrast, `deadband_w: 15 -> 5` already went RED 2 + 1,
|
||||
so the pinning technique itself was known to work, just not applied here.
|
||||
Fixed three ways. First, `test_freeze.py` gained a check comparing `Tuning()`'s
|
||||
code default (`control.py`, 2000.0) against `SHIPPED_MAX_W`, read from
|
||||
`config.yaml` by extending the file's existing `_cfg_default()` regex reader
|
||||
rather than reimplementing test_arbitrage.py's `_shipped`. Second, the literal
|
||||
itself is renamed `LIVE_INSTALL_MAX_W` in both files, with a comment stating
|
||||
plainly that 5000 is the live install's own override and not config.yaml's
|
||||
shipped `max_w` — the defect was the silent literal, not the number. Third,
|
||||
`test_freeze.py` now states `PINNED_KEYS = ("meter_freeze_s", "deadband_w",
|
||||
"max_w")` in one place as the complete set of config keys this suite pins,
|
||||
deliberately excluding `maintenance_*` (CFG-03 gave those a separate source of
|
||||
truth in `app/maintenance.py`). Verified by breaking what the new check
|
||||
watches: `max_w: 2000 -> 4500` in `config.yaml` now fails exactly
|
||||
`"the code default and the shipped default agree on max_w too"` and nothing
|
||||
else, and reverting returns the file to all-green.
|
||||
|
||||
**Maintenance option defaults lived in three places that had already disagreed,
|
||||
and MAINT-04's tripwire was holding them apart rather than closing them
|
||||
(CFG-03).** `config.yaml` shipped `maintenance_charge_w: 2000`, `main.py` carried
|
||||
|
||||
Reference in New Issue
Block a user