test: add TDD bug-capture test for #967 — plan execute phase processing #1050
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
#977 TDD: Write failing test for #967 — plan execute only transitions state, no phase processing
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core!1050
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tdd/m3-plan-execute-phase-processing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR adds TDD bug-capture tests for bug #967 —
plan executeonly transitions state without running strategize or execute phase processing.Motivation
Bug #967 describes that the
plan executeCLI command originally only calledservice.execute_plan(plan_id), which is a state transition only (Strategize/COMPLETE → Execute/QUEUED). When a plan was in Strategize/QUEUED state (immediately afterplan use), the command failed becauseexecute_plan()requires Strategize/COMPLETE. The CLI should detect the plan's current phase and runPlanExecutor.run_strategize()before transitioning.Per the project's TDD Bug Fix Workflow (
CONTRIBUTING.md), the first step in fixing any bug is to write a test that captures the buggy behavior. Since the fix for #967 is already present in the codebase (the CLI handler already orchestrates properly), the@tdd_expected_failtags have been removed and these tests serve as permanent regression guards ensuring the fix is never reverted.Design Approach
All
@tdd_expected_failscenarios were rewritten to exercise the CLI orchestration layer — the actual code path affected by bug #967. This satisfies AC4: "The test is specific enough that it will pass normally (without the tag) only when the bug is genuinely fixed."@tdd_expected_fail): Use Typer'sCliRunnerwith mocked services to invoke theplan executeCLI command handler directly. This tests the orchestration logic inplan.py— the exact code that was buggy.PlanLifecycleService(in-memory) andPlanExecutor(stub actors) to demonstrate that proper service-level orchestration works.Changes
Behave Unit Tests
features/tdd_plan_execute_phase_processing.feature— 4 scenariosfeatures/steps/tdd_plan_execute_phase_processing_steps.py— Step definitions using CliRunner and mocked servicesScenarios:
plan executevia CliRunner on a QUEUED plan. Verifies the CLI succeeds and the plan reaches Execute phase.run_strategize()andrun_execute()are both called by the CLI handler.run_strategize()→execute_plan()works correctly at the service level. Always passes.plan executewith no plan_id. Verifies the auto-discovery filter includes QUEUED plans.Robot Integration Tests
robot/tdd_plan_execute_phase_processing.robot— 4 test cases matching the Behave scenariosrobot/helper_tdd_plan_execute_phase_processing.py— Helper script replicating CLI orchestration logicCHANGELOG
CHANGELOG.md— Added entry under "## Unreleased" describing the new tests.Quality Gates
nox -e lint: ✅ passednox -e typecheck: ✅ passed (0 errors)nox -e unit_tests: ✅ passed (391 features, 11177 scenarios, 0 failures)nox -e integration_tests: ✅ passed (1572 tests, 0 failures)nox -e e2e_tests: ✅ passed (16 tests, 0 failures)nox -e coverage_report: ✅ 97% coverageReview Cycle 2 Fixes
@tdd_expected_failscenarios to exercise the CLI orchestration layer via CliRunner instead of testing service/executor APIs that are correct by design. Removed@tdd_expected_failtags since the bug fix is already in the codebase.master.ProcessingState.QUEUEDassertion to positive control scenario.except Exceptiontoexcept (PlanError, PlanNotReadyError).Setup Test Environment With Database Isolation.on_timeout=killto all RobotRun Processcalls._fail()helper.Settings()instantiation.Known Limitations
@tdd_expected_failtags were removed because the bug fix for #967 is already in the codebase. If this PR is merged before the #967 fix PR, the tags would need to be re-added. However, the CHANGELOG and existing CLI code confirm the fix is already onmaster.Closes #977
49d403a00499d700448099d7004480a641dae5bfCode Review — PR #1050
test: TDD bug-capture test for #967 — plan execute phase processingComprehensive 4-scenario test suite. The correct removal of
@tdd_expected_failis well-justified since the bug fix for #967 is already on master — these serve as permanent regression guards. The step file is well-structured with helper functions for constructingPlandomain objects. Good documentation of 13 fixes from 2 review cycles.Approved. No issues found.