UX-13 P2: test_settings reads fields through named_absence
checks / unit (pull_request) Successful in 10m15s
infra-pin / fresh (pull_request) Successful in 2s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LyR88rXETvwhTgx6yHE39p
This commit is contained in:
Claude
2026-09-28 03:02:43 +02:00
parent 0a28f71872
commit 1752adf6e6
+8 -6
View File
@@ -31,6 +31,7 @@ import translations_lint as TL # noqa: E402
import ux13_demo as D # noqa: E402
from app import selfconfig, uilayout as L, uimodel as U, uipage, web # noqa: E402
from app.validate import validate_startup_config # noqa: E402
from named_absence import field # noqa: E402
fails = []
@@ -78,6 +79,7 @@ for _g in LAYOUT["groups"]:
_flat.append((_g["id"], _f))
_flat += [(_g["id"], _s) for _s in _f.get("fields", [])]
_keys = [f["key"] for _g, f in _flat]
FIELD = {f["key"]: f for _g, f in _flat}
check("the six groups, in the design's order",
[g["id"] for g in LAYOUT["groups"]]
== ["meter", "inverters", "tariff", "safety", "maintenance", "tuning"]
@@ -93,7 +95,7 @@ print(f" fields per group: {_counts}")
check("every field has a label, and every option field's label is its "
"translation without the group prefix",
all(f["label"] and " · " not in f["label"] for _g, f in _flat)
and next(f for _g, f in _flat if f["key"] == "meter_source")["label"]
and field(FIELD, "meter_source")["label"]
== "Where the meter reading comes from")
_ranged = [(f["key"], f.get("min"), f.get("max")) for _g, f in _flat
if f["control"] in (L.SLIDER, L.LOCKED)]
@@ -102,16 +104,16 @@ check(f"every slider and locked value has its range from the schema "
for _k, lo, hi in _ranged)
and ("peak_cap_w", 500.0, 15000.0) in _ranged)
check("the peak limit is a kW slider over a value stored in W",
next(f for _g, f in _flat if f["key"] == "peak_cap_w")["scale"] == 1000)
field(FIELD, "peak_cap_w")["scale"] == 1000)
_choice = [f for _g, f in _flat
if f["control"] in (L.SEGMENTED, L.SELECT, L.CHOICE)]
check("every choice control has choices with words",
all(f["choices"] and all(c[1] for c in f["choices"]) for f in _choice))
_ms = next(f for _g, f in _flat if f["key"] == "meter_source")
_ms = field(FIELD, "meter_source")
check("the meter source is radio cards with a line of help on each",
_ms["control"] == L.CHOICE and set(_ms["hints"]) == {c[0] for c in
_ms["choices"]})
_reg = next(f for _g, f in _flat if f["key"] == "ui.region")
_reg = field(FIELD, "ui.region")
check("the region shows its preset year beside the choice (P0 review)",
["flanders", "Flanders, Fluvius Antwerpen, 2026 figures", False]
in _reg["choices"] and _reg["presets"]["flanders"]["year"] == 2026)
@@ -129,14 +131,14 @@ check(f"measured and derived values are locked behind 'Change' "
check("each group says when its settings apply",
all(g["applies"] == [UI_TEXT["applies"]["restart"]["name"]]
for g in LAYOUT["groups"]))
_inv = next(f for _g, f in _flat if f["key"] == "inverters")
_inv = field(FIELD, "inverters")
check("the inverter cards carry their count, and adding one makes a list",
_inv["count"] == U.COUNT and _inv["grow"] == U.GROWN
and [s["key"] for s in _inv["fields"]]
== [f.key for f in L.ROSTER_FIELDS])
check("a page-only field names the option keys it writes, for the grey key "
"line", _reg["writes"] == ["price_taxes_profile"]
and next(f for _g, f in _flat if f["key"] == "ui.solar")["writes"]
and field(FIELD, "ui.solar")["writes"]
== ["pv_entities", "pv_entity", "pv_invert_entities"])
check("without a Supervisor schema the page still draws, with no ranges",
len(uipage.layout([], {})["groups"]) == 6)