From 84022795962cea99cec2b6bea2cf950321a5fbba Mon Sep 17 00:00:00 2001 From: CleverThis Date: Sun, 12 Apr 2026 03:34:15 +0000 Subject: [PATCH 1/2] fix(data-integrity): fix validation_apply.py all_required_ fields #7508 ISSUES CLOSED: #7508 --- features/consolidated_validation.feature | 9 ++++----- .../application/services/validation_apply.py | 7 +++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/features/consolidated_validation.feature b/features/consolidated_validation.feature index e79874615..3895a8e37 100644 --- a/features/consolidated_validation.feature +++ b/features/consolidated_validation.feature @@ -84,11 +84,11 @@ Feature: Consolidated Validation And the apply summary informational failed count should be 1 - Scenario: Empty summary reports all required passed + Scenario: Empty summary blocks apply Given a validation apply test environment Given an empty apply validation summary Then the apply summary should be empty - And the apply summary should report all required passed + And the apply summary should not report all required passed Scenario: Summary to_plan_metadata has expected fields @@ -183,10 +183,10 @@ Feature: Consolidated Validation Then the gate failure reasons should mention "error:" - Scenario: Gate with no attachments allows apply + Scenario: Gate with no attachments blocks apply Given a validation apply test environment When I run the apply validation gate for plan "01PLAN0001" with no attachments - Then the gate should allow apply + Then the gate should block apply And the apply summary should be empty @@ -467,4 +467,3 @@ Feature: Consolidated Validation Given a thread-local stream wrapping a mock original stream When capture is stopped on the thread-local stream Then the captured text should be empty - diff --git a/src/cleveragents/application/services/validation_apply.py b/src/cleveragents/application/services/validation_apply.py index 68bf5c614..32eaba6af 100644 --- a/src/cleveragents/application/services/validation_apply.py +++ b/src/cleveragents/application/services/validation_apply.py @@ -140,6 +140,11 @@ class ApplyValidationSummary(BaseModel): 1 for r in self.results if r.mode == ValidationMode.REQUIRED and r.passed ) + @property + def required_total(self) -> int: + """Total number of required validations that were evaluated.""" + return sum(1 for r in self.results if r.mode == ValidationMode.REQUIRED) + @property def required_failed(self) -> int: """Number of required validations that failed.""" @@ -170,6 +175,8 @@ class ApplyValidationSummary(BaseModel): @property def all_required_passed(self) -> bool: """Whether all required validations passed.""" + if self.is_empty: + return False return self.required_failed == 0 @property From 251759c9b17f7c8e5b3727f627d3d1d7ffbcf402 Mon Sep 17 00:00:00 2001 From: CleverThis Date: Sun, 12 Apr 2026 08:09:33 +0000 Subject: [PATCH 2/2] chore: add changelog entry and contributor for #7508 validation gate fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add CHANGELOG.md entry under [Unreleased] ### Fixed for the empty-run guard added to ApplyValidationSummary.all_required_passed - Add HAL 9000 to CONTRIBUTORS.md per CONTRIBUTING.md §PR Process Rule 8 --- CHANGELOG.md | 7 +++++++ CONTRIBUTORS.md | 1 + 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81a54b269..6c1a7dca9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -136,6 +136,13 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Fixed +- **Validation Gate Empty-Run Guard** (#7508): Fixed `ApplyValidationSummary.all_required_passed` + returning `True` when zero validations were run, silently bypassing the apply gate. The property + now returns `False` when the validation result set is empty (`is_empty` is `True`), ensuring + that apply is blocked unless at least one validation was actually executed. Also added + `required_total` property for completeness. Updated `consolidated_validation.feature` scenarios + to reflect the corrected blocking behavior for empty summaries and no-attachment runs. + - **Robot Framework TDD Listener Guards** (#5436): Added three guard conditions to the `tdd_expected_fail_listener` `end_test()` function to prevent blindly inverting ALL test failures to passes, which was masking infrastructure errors and causing flaky CI behavior. diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f5091deaa..0b43e1538 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,6 +2,7 @@ * Aditya Chhabra * Brent E. Edwards +* HAL 9000 * Hamza Khyari * Jeffrey Phillips Freeman * Luis Mendes