Found during review of #1519 (behavior-preserving refactor — this is pre-existing behavior moved verbatim into SectionValidator, not a regression introduced by that PR).
Problem
Lazy validation uses a single boolean "done" predicate that ignores which parameters were actually validated:
ensure_section_validated() → APIValidator.is_section_validated(section)
ensure_hot_water_group_validated() → group_name in self._validated_hot_water_groups
Because validate_section() marks the entire section/group as validated even when called with include=[subset], a first call with an include filter makes later calls (a different include, or include=None) skip validation entirely. Consequences:
- The hot-water cache can stay permanently incomplete for that group.
- Skipped sections can later request unsupported params; combined with
zip(..., strict=True) in _request_named_params(), missing keys in the device response can raise ValueError at fetch time.
Affected code (src/bsblan/_validation.py)
ensure_section_validated() — is_section_validated(section) used as the sole "done" predicate.
ensure_hot_water_group_validated() — when an include filter removes all of a group's params, the empty group is still added to _validated_hot_water_groups.
ensure_hot_water_group_validated() — group marked validated after only a subset of params were checked/cached.
Possible directions
- Track the validated parameter set per section/group, or
- Do not persist the "validated" flag when an
include filter was applied, or
- Re-validate when requested params are absent from the cache.
References
Copilot review on #1519 — 3 inline comments (_validation.py lines ~206, ~263, ~299).
Found during review of #1519 (behavior-preserving refactor — this is pre-existing behavior moved verbatim into
SectionValidator, not a regression introduced by that PR).Problem
Lazy validation uses a single boolean "done" predicate that ignores which parameters were actually validated:
ensure_section_validated()→APIValidator.is_section_validated(section)ensure_hot_water_group_validated()→group_name in self._validated_hot_water_groupsBecause
validate_section()marks the entire section/group as validated even when called withinclude=[subset], a first call with anincludefilter makes later calls (a differentinclude, orinclude=None) skip validation entirely. Consequences:zip(..., strict=True)in_request_named_params(), missing keys in the device response can raiseValueErrorat fetch time.Affected code (
src/bsblan/_validation.py)ensure_section_validated()—is_section_validated(section)used as the sole "done" predicate.ensure_hot_water_group_validated()— when anincludefilter removes all of a group's params, the empty group is still added to_validated_hot_water_groups.ensure_hot_water_group_validated()— group marked validated after only a subset of params were checked/cached.Possible directions
includefilter was applied, orReferences
Copilot review on #1519 — 3 inline comments (
_validation.pylines ~206, ~263, ~299).