test: add TDD bug-capture test for #967 — plan execute phase processing #1050

Merged
hurui200320 merged 2 commits from tdd/m3-plan-execute-phase-processing into master 2026-03-19 06:41:27 +00:00

2 Commits

Author SHA1 Message Date
hurui200320 468c84ec16 Merge branch 'master' into tdd/m3-plan-execute-phase-processing
CI / lint (pull_request) Successful in 22s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 32s
CI / build (pull_request) Successful in 25s
CI / security (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 1m4s
CI / unit_tests (pull_request) Successful in 3m42s
CI / docker (pull_request) Successful in 9s
CI / e2e_tests (pull_request) Successful in 3m53s
CI / integration_tests (pull_request) Successful in 5m10s
CI / coverage (pull_request) Successful in 7m12s
CI / benchmark-regression (pull_request) Successful in 40m6s
2026-03-19 06:33:04 +00:00
hurui200320 a641dae5bf test: add TDD bug-capture test for #967 — plan execute phase processing
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 17s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 30s
CI / security (pull_request) Successful in 1m1s
CI / typecheck (pull_request) Successful in 1m2s
CI / unit_tests (pull_request) Successful in 2m56s
CI / integration_tests (pull_request) Successful in 3m41s
CI / docker (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 4m19s
CI / coverage (pull_request) Successful in 6m33s
CI / benchmark-regression (pull_request) Successful in 37m27s
Rewrote Behave unit tests and Robot integration tests to exercise the
CLI orchestration layer — the actual code path affected by bug #967.
Tests use CliRunner (Behave) and replicated CLI logic (Robot) to verify
that the plan execute command correctly handles plans in Strategize/QUEUED
state by running PlanExecutor.run_strategize() before transitioning.

Bug #967: The plan execute CLI command originally only called
service.execute_plan(plan_id), which is a state transition only
(Strategize/COMPLETE → Execute/QUEUED).  It did not construct a
PlanExecutor or call run_strategize() / run_execute().  The fix added
phase-aware orchestration to the CLI handler.  Since the fix is already
in the codebase, the @tdd_expected_fail tags have been removed and
these tests serve as permanent regression guards.

Four Behave scenarios:
- CLI execute command handles plan in Strategize/QUEUED state
- CLI execute command orchestrates full lifecycle for QUEUED plan
- Positive control: proper service-level orchestration works
- CLI auto-discovery finds plans in Strategize/QUEUED state

Four Robot integration tests mirror the Behave scenarios via a helper
script that replicates the CLI orchestration logic using real
PlanLifecycleService (in-memory) and PlanExecutor (stub actors).

Key changes from review cycle 2:
- Critical: Rewrote @tdd_expected_fail scenarios to test CLI orchestration
  layer via CliRunner, not service/executor APIs (review finding #1)
- Critical: Removed @tdd_expected_fail tags since bug fix is already in
  codebase — tests now serve as regression guards
- Major: Added CHANGELOG.md entry (review finding #2)
- Major: Rebased onto current master (review finding #3)
- Minor: Added state assertion (ProcessingState.QUEUED) to positive control
  scenario (review finding #4)
- Minor: Narrowed exception handler from bare Exception to
  (PlanError, PlanNotReadyError) (review finding #5)
- Minor: Robot suite uses Setup Test Environment With Database Isolation
  (review finding #7)
- Minor: Added on_timeout=kill to all Robot Run Process calls (review #8)
- Minor: Added docstring to _fail() helper (review finding #12)
- Minor: Removed redundant Settings() instantiation (review finding #13)
- Nit: Removed @mock_only tag concern by keeping it only on the feature
  level where it belongs

ISSUES CLOSED: #977
2026-03-18 13:43:10 +00:00