Merge pull request 'fix(data-integrity): guard validation gate for empty runs' (#7786) from fix/issue-7508-validation-apply-required-fields into master
CI / benchmark-publish (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / quality (push) Has been cancelled
CI / integration_tests (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / coverage (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
CI / build (push) Has been cancelled
CI / docker (push) Has been cancelled
CI / push-validation (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / security (push) Has been cancelled
CI / unit_tests (push) Has been cancelled
CI / helm (push) Has been cancelled

This commit was merged in pull request #7786.
This commit is contained in:
2026-04-12 08:16:06 +00:00
committed by Forgejo
4 changed files with 19 additions and 5 deletions
+7
View File
@@ -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.
+1
View File
@@ -2,6 +2,7 @@
* Aditya Chhabra <aditya.chhabra@cleverthis.com>
* Brent E. Edwards <brent.edwards@cleverthis.com>
* HAL 9000 <hal9000@cleverthis.com>
* Hamza Khyari <hamza.khyari@cleverthis.com>
* Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com>
* Luis Mendes <luis.p.mendes@gmail.com>
+4 -5
View File
@@ -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
@@ -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