Skip to content

Conversation

@liudger
Copy link
Owner

@liudger liudger commented Jan 10, 2026

This pull request enhances the parameter validation logic for hot water groups in src/bsblan/bsblan.py, allowing for more granular control over which parameters are validated. The main improvement is the addition of an include filter to selectively validate only specified parameters, which can improve performance and flexibility when accessing hot water data.

Hot water group validation improvements:

  • Added an optional include parameter to the _ensure_hot_water_group_validated method, enabling validation of only specified parameter names within a group. [1] [2]
  • Updated the validation logic to filter parameters by the include list if provided, ensuring that only requested parameters are processed.
  • Modified the _fetch_hot_water_data method to pass the include filter to _ensure_hot_water_group_validated, supporting granular lazy loading of hot water parameters.

Copilot AI review requested due to automatic review settings January 10, 2026 20:54
@liudger liudger added the bugfix Inconsistencies or issues which will cause a problem for users or implementers. label Jan 10, 2026
@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.88%. Comparing base (795cf8f) to head (496040f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1312   +/-   ##
=======================================
  Coverage   99.88%   99.88%           
=======================================
  Files           6        6           
  Lines         890      892    +2     
  Branches      123      124    +1     
=======================================
+ Hits          889      891    +2     
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds an optional include parameter to the hot water group validation logic, aiming to enable more granular control over parameter validation for performance optimization. The change allows callers to validate only specific parameters within a hot water group rather than the entire group.

Changes:

  • Added optional include parameter to _ensure_hot_water_group_validated method
  • Updated validation logic to filter parameters by the include list when provided
  • Modified _fetch_hot_water_data to pass the include filter through to the validation method
Comments suppressed due to low confidence (1)

src/bsblan/bsblan.py:279

  • When include is provided and filters the parameters during validation, the entire group is still marked as validated at line 315. This creates a critical bug: if a first call uses include=["param1"], only param1 is validated and added to the cache, but the entire group is marked as validated. A subsequent call with include=["param2"] will take the fast path (line 238-239) and skip validation, then fail because param2 was never validated.

The validation state tracking needs to account for partial validation when include is used. Consider either:

  1. Not marking the group as validated when include is provided (forcing re-validation each time), or
  2. Tracking which specific parameters have been validated per group, not just whether the entire group is validated
            # Apply include filter if specified - only validate requested params
            if include is not None:
                group_params = {
                    param_id: name
                    for param_id, name in group_params.items()
                    if name in include
                }

            if not group_params:
                logger.debug("No parameters to validate for group %s", group_name)
                self._validated_hot_water_groups.add(group_name)
                return

@sonarqubecloud
Copy link

@liudger liudger merged commit f3179b3 into main Jan 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Inconsistencies or issues which will cause a problem for users or implementers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants