Skip to content

Refactor validation logic and remove post-edit validation scripts#1561

Merged
liudger merged 4 commits into
mainfrom
refactor-section-validator
Jul 16, 2026
Merged

Refactor validation logic and remove post-edit validation scripts#1561
liudger merged 4 commits into
mainfrom
refactor-section-validator

Conversation

@liudger

@liudger liudger commented Jul 16, 2026

Copy link
Copy Markdown
Owner

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:

  • Validation coverage is now tracked per parameter ID for both sections and hot-water groups, replacing the previous coarse-grained (whole-section/group) tracking. This ensures that only parameters actually validated are considered covered, and any new parameters requested in subsequent reads are validated before use. (src/bsblan/_validation.py) [1] [2] [3] [4]
  • Empty include filters (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:

  • Added a new specification, 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]
  • Design documentation updated to explain the motivation, goals, and decisions behind parameter-level validation coverage, including trade-offs and alternatives considered. (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:

  • Regression tests and validation tasks have been added and updated to cover filtered-then-unfiltered access, differently filtered reads, and correct handling of unsupported or empty-include parameters. (openspec/changes/archive/2026-07-16-fix-partial-validation-state/tasks.md)

Spec Metadata:

  • Added spec-driven metadata for the new change. (openspec/changes/archive/2026-07-16-fix-partial-validation-state/.openspec.yaml)

Cleanup:

  • Removed the obsolete GitHub validation hook and its associated shell script, which are no longer needed with the new validation approach. (.github/hooks/run-validation-after-edits.json, .github/hooks/run_validation_after_edits.sh) [1] [2]

liudger added 3 commits July 16, 2026 15:03
…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.
@liudger liudger self-assigned this Jul 16, 2026
Copilot AI review requested due to automatic review settings July 16, 2026 13:08
@liudger liudger added the bugfix Inconsistencies or issues which will cause a problem for users or implementers. label Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (718cdd1) to head (31f681e).

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.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 include matches 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.

@sonarqubecloud

Copy link
Copy Markdown

@liudger
liudger merged commit d008ff7 into main Jul 16, 2026
16 checks passed
@liudger
liudger deleted the refactor-section-validator branch July 16, 2026 13:19
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

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

2 participants