Files
cleveragents-core/features/plan_dod_gating.feature
HAL9000 419775b0d1 fix(plan-lifecycle): correct DoD gating test assertions
The test scenario 'validation_summary is populated after DoD evaluation'
was expecting 'total' and 'required_passed' keys which are not added by
the DoD evaluation. These keys are only present when the plan goes through
the Execute phase validation gate. The DoD evaluation only adds
'dod_evaluated', 'dod_all_passed', and 'dod' keys.

Updated the test to check for the 'dod' key instead, which correctly
reflects the structure of the validation_summary after DoD evaluation.

ISSUES CLOSED: #7927
2026-06-02 05:14:43 -04:00

85 lines
4.1 KiB
Gherkin

Feature: Definition-of-Done Gating in Apply Phase
As a developer
I want the Apply phase to evaluate Definition-of-Done criteria
So that plans cannot be applied until all required DoD criteria pass
Background:
Given I have a plan lifecycle service for DoD gating
# --- DoD evaluation is skipped when no DoD text is set ---
Scenario: Apply succeeds when plan has no definition of done
Given I have a plan with no definition of done in execute complete state
When I apply the plan with DoD gating
Then the plan should transition to apply phase
And the plan validation summary should be empty
Scenario: Apply succeeds when definition of done is empty string
Given I have a plan with empty definition of done in execute complete state
When I apply the plan with DoD gating
Then the plan should transition to apply phase
And the plan validation summary should be empty
# --- DoD evaluation runs and passes ---
Scenario: Apply succeeds when all DoD criteria pass via context match
Given I have a plan with definition of done "tests_passed" and argument "tests_passed" equal to "true"
When I apply the plan with DoD gating
Then the plan should transition to apply phase
And the plan validation summary should record dod_evaluated as true
And the plan validation summary should record dod_all_passed as true
Scenario: Apply succeeds when DoD criteria are skipped due to empty context
Given I have a plan with definition of done "all tests pass" and no arguments
When I apply the plan with DoD gating
Then the plan should transition to apply phase
And the plan validation summary should record dod_evaluated as true
# --- DoD evaluation blocks apply when criteria fail ---
Scenario: Apply is blocked when DoD criteria fail
Given I have a plan with definition of done "coverage_above_97" and argument "status" equal to "incomplete"
When I try to apply the plan with DoD gating
Then a DoD gating error should be raised
And the plan should remain in execute phase
And the plan validation summary should record dod_evaluated as true
And the plan validation summary should record dod_all_passed as false
Scenario: DoDGatingError contains correct failure counts
Given I have a plan with definition of done "criterion_alpha" and argument "status" equal to "incomplete"
When I try to apply the plan with DoD gating
Then a DoD gating error should be raised
And the DoD gating error should report 1 failed criteria out of 1 total
# --- DoD evaluation with template rendering ---
Scenario: DoD template placeholders are rendered with plan arguments
Given I have a plan with definition of done "{status}" and argument "status" equal to "complete"
When I apply the plan with DoD gating
Then the plan should transition to apply phase
# --- validation_summary is populated ---
Scenario: validation_summary is populated after DoD evaluation
Given I have a plan with definition of done "tests_passed" and argument "tests_passed" equal to "true"
When I apply the plan with DoD gating
Then the plan validation summary should contain key "dod_evaluated" with value true
And the plan validation summary should contain key "dod_all_passed" with value true
And the plan validation summary should contain key "dod"
# --- DoD gating integrates with full lifecycle ---
Scenario: Plan with passing DoD can complete full apply lifecycle
Given I have a plan with definition of done "tests_passed" and argument "tests_passed" equal to "true"
When I apply the plan with DoD gating
And I start the apply phase
And I complete the apply phase
Then the dod plan processing state should be "applied"
Scenario: Plan with failing DoD stays in execute phase after blocked apply
Given I have a plan with definition of done "coverage_above_97" and argument "status" equal to "incomplete"
When I try to apply the plan with DoD gating
Then a DoD gating error should be raised
And the dod plan phase should be "execute"
And the dod plan processing state should be "complete"