Skip to content

Partial include filter marks section/hot-water group as fully validated #1520

@liudger

Description

@liudger

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:

  1. The hot-water cache can stay permanently incomplete for that group.
  2. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions