Refactor validation logic and remove post-edit validation scripts#1561
Conversation
…ation logic - Improved tracking of validated hot water parameters in SectionValidator. - Updated validation methods to ensure uncovered parameters are validated correctly. - Enhanced APIValidator to manage parameter validation states more effectively. - Added tests to verify validation behavior for uncovered parameters and include filters.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1561 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 14 14
Lines 1338 1379 +41
Branches 143 150 +7
=========================================
+ Hits 1338 1379 +41 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request fixes a correctness bug in lazy validation where filtered reads (include) could incorrectly mark entire sections or hot-water groups as validated, causing later reads to skip required validation and potentially leave configuration/caches incomplete.
Changes:
- Introduces parameter-ID–level validation coverage for sections and hot-water groups, ensuring subsequent requests validate any newly requested IDs.
- Updates section/group completion semantics so empty
includematches do not create “validated” state. - Adds/updates regression tests and captures the new behavior in an OpenSpec specification; removes an obsolete post-edit validation hook.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/bsblan/utility.py |
Adds per-section parameter coverage tracking (validated_parameters) and APIs to query/reset it. |
src/bsblan/_validation.py |
Updates lazy section + hot-water group validation gates to be parameter-ID–aware and only validate uncovered IDs. |
tests/test_include_parameter.py |
Adjusts expectations to assert parameter coverage rather than coarse “section validated” state after include. |
tests/test_api_validation.py |
Adds regression tests for filtered-then-unfiltered / differently-filtered section validation behavior. |
tests/test_hot_water_additional.py |
Updates and extends hot-water regression tests for include/no-match include/coverage behavior and concurrency serialization. |
tests/test_reset_validation.py |
Adds coverage ensuring reset_validation() clears per-parameter coverage. |
openspec/specs/lazy-validation-completeness/spec.md |
New spec formalizing the completeness requirement for lazy validation. |
openspec/changes/archive/2026-07-16-fix-partial-validation-state/* |
Archives proposal/design/tasks/spec delta for the change. |
.github/hooks/run-validation-after-edits.json |
Removes obsolete post-edit hook configuration. |
.github/hooks/run_validation_after_edits.sh |
Removes obsolete post-edit hook script. |
|



This pull request addresses a critical flaw in how lazy validation tracks which parameters have been validated in section and hot-water group reads. Previously, a filtered read (using
include) would mark an entire section or group as validated, allowing later requests to skip necessary validation for parameters not previously checked. This could result in incomplete or incorrect configuration and cache state. The changes introduce parameter-level tracking for validation coverage, ensuring that only parameters actually validated are considered covered, and that subsequent requests validate any newly requested parameters. Regression tests and requirements have been updated to reflect and enforce the new behavior.#1520
The most important changes are:
Validation Logic Improvements:
src/bsblan/_validation.py) [1] [2] [3] [4]includefilters (that match no parameters) no longer mark a section or group as validated or add to coverage, preventing false positives in validation state. (src/bsblan/_validation.py)Specification and Design Documentation:
lazy-validation-completeness, which formalizes the requirement that every requested parameter must be individually validated, and describes expected behavior for filtered and unfiltered reads. (openspec/specs/lazy-validation-completeness/spec.md,openspec/changes/archive/2026-07-16-fix-partial-validation-state/specs/lazy-validation-completeness/spec.md) [1] [2]openspec/changes/archive/2026-07-16-fix-partial-validation-state/design.md,openspec/changes/archive/2026-07-16-fix-partial-validation-state/proposal.md) [1] [2]Testing and Validation:
openspec/changes/archive/2026-07-16-fix-partial-validation-state/tasks.md)Spec Metadata:
openspec/changes/archive/2026-07-16-fix-partial-validation-state/.openspec.yaml)Cleanup:
.github/hooks/run-validation-after-edits.json,.github/hooks/run_validation_after_edits.sh) [1] [2]