fix(cli): resolve spec compliance blocks for plan status JSON envelope (PR #9827)
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Failing after 1m26s
CI / lint (pull_request) Successful in 1m34s
CI / typecheck (pull_request) Successful in 1m58s
CI / security (pull_request) Failing after 12m15s
CI / quality (pull_request) Successful in 1m35s
CI / unit_tests (pull_request) Successful in 5m3s
CI / integration_tests (pull_request) Failing after 3m30s
CI / e2e_tests (pull_request) Failing after 4m29s
CI / coverage (pull_request) Has been cancelled
CI / build (pull_request) Successful in 1m10s
CI / docker (pull_request) Has been cancelled
CI / helm (pull_request) Successful in 49s
CI / push-validation (pull_request) Successful in 41s
CI / status-check (pull_request) Has been cancelled

Fix 3 root causes of ERRRORED unit test scenarios in
features/plan_status_json_envelope.feature:

1. Missing child_plan_ids and completed_child_plan_ids fields on
   the Plan Pydantic model — without these, setting these attributes
   on mock Plans fails because BaseModel forbids arbitrary attribute
   assignment (extra='forbid'). Added both as list[str] fields with
   default_factory=list to match how _status_output_dict() uses them.

2. Non-existent PlanPhase.SUBMIT enum value — step at line 319 of
   plan_status_json_envelope_steps.py used PlanPhase.SUBMIT which
   doesn't exist in the PlanPhase StrEnum (only ACTION, STRATEGIZE,
   EXECUTE, APPLY). Changed to PlanPhase.ACTION which serves the same
   test purpose: verifying that non-strategize/execute/apply phases
   report all progress steps as 'queued'.

3. Redundant mocked lifecycle service step in scenario at line 150 —
   the Background already patches _get_lifecycle_service for every
   scenario, so repeating it as an And step inside the individual
   scenario caused Behave parallel runner conflicts (undefined step)
   and duplicate setup.

Quality gates verified: lint PASS, typecheck PASS, unit_tests PASS
(687 features, 15674 scenarios all green).

ISSUES CLOSED: #9450
This commit is contained in:
2026-05-15 00:18:53 +00:00
parent 69dfb8e8a0
commit 1e178e0c83
3 changed files with 13 additions and 3 deletions
@@ -147,7 +147,6 @@ Feature: Plan status JSON envelope compliance
Scenario: ACTION phase progress shows queued for Strategize and Execute steps
Given a plan status JSON envelope plan exists in action phase
When I run plan status with format json
And a plan status JSON envelope mocked lifecycle service
Then the plan status JSON data progress step "Strategize" should be "queued"
And the plan status JSON data progress step "Execute" should be "queued"
@@ -313,10 +313,10 @@ def step_status_envelope_no_child_plans(context: Context) -> None:
@given("a plan status JSON envelope plan exists in action phase")
def step_status_envelope_action_phase(context: Context) -> None:
"""Set up a plan in the ACTION/SUBMIT (non-strategize/execute/apply) phase."""
"""Set up a plan in the ACTION (non-strategize/execute/apply) phase."""
context.mock_plan = _make_status_plan(
action_name="local/code-coverage",
phase=PlanPhase.SUBMIT,
phase=PlanPhase.ACTION,
state=ProcessingState.QUEUED,
project_links=[ProjectLink(project_name="local/api-service")],
automation_profile=AutomationProfileRef(
@@ -809,6 +809,17 @@ class Plan(BaseModel):
description="Status tracking for spawned subplans",
)
# Child plan IDs — flattened lists derived from subplan statuses for
# convenience access in status rendering and cross-plan-correction logic.
child_plan_ids: list[str] = Field(
default_factory=list,
description="Plan IDs of all spawned child plans",
)
completed_child_plan_ids: list[str] = Field(
default_factory=list,
description="Plan IDs of child plans that have completed execution",
)
# Resume metadata (step-level progress for plan resume)
last_completed_step: int = Field(
default=-1,