PRICE-01 review: spaced-token check passes the length rule; F3 default pinned
checks / unit (pull_request) Successful in 39m51s
infra-pin / fresh (pull_request) Successful in 1s

The spaced-token check used a 5-character token, which the new 16-character
rule refuses on its own, so a validator that stopped checking spaces passed
(reviewer mutation R06). It now uses a long token and checks the reason.

Also pin F3 with no maintenance_enabled key: the default (off) holds and no
no-price words show (reviewer mutation S04). Tests only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
This commit is contained in:
glenn schrooyen
2026-10-14 19:58:50 +02:00
co-authored by Claude Opus 5.5
parent 0801776645
commit 2f261f8ba4
+23 -3
View File
@@ -1224,9 +1224,12 @@ check("...without a token it is refused, naming both settings by label and key "
f"({_e})", len(_e) == 1 and "“Dynamic price source” (price_provider)"
in _e[0] and "“Price service token” (price_service_token)" in _e[0]
and TOKEN not in _e[0])
check("...a token with a space in it is refused, and the token is not echoed",
len(problems(price_service_token="ab cd")) == 1
and "ab cd" not in problems(price_service_token="ab cd")[0])
# Long enough to pass the length rule, so only the space can refuse it.
_SPACED = "tk-0123456789 abcdefgh"
_e = problems(price_service_token=_SPACED)
check("...a token with a space in it is refused for the space, and the token "
"is not echoed",
len(_e) == 1 and "space" in _e[0] and _SPACED not in _e[0])
_e = problems(price_now_entity="sensor.a", price_avg_entity="sensor.b")
check(f"the existing conflict refusal stands: the Home Assistant pair beside "
f"this provider is refused ({len(_e)} problem)",
@@ -1430,6 +1433,23 @@ check("a notification raised while the cycle was on is cleared, once, when "
len(_r) == 1 and [x[0] for x in _n] == ["create", "dismiss"]
and _g is False)
async def _scenario_key_missing():
"""No `maintenance_enabled` key at all: its shipped default (off) holds."""
with Wired(NOW) as W:
c = W.ctl
c.o.pop("maintenance_enabled", None)
W.net.down()
await W.refresh()
for k in range(3):
await W.tick(NOW + timedelta(seconds=30 * k))
return c.price_gap, list(W.notes())
_g2, _n2 = run(_scenario_key_missing())
check("with no maintenance_enabled key its default (off) holds: no no-price "
"words, no notification", _g2 is False and _n2 == [])
async def _modes_no_price():
"""Battery modes on, maintenance off, no price anywhere: what happens."""
from app import packmode, homeview