fix: wire DI persistence and plan execute/apply for M1 lifecycle #957
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 milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cleveragents/cleveragents-core!957
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/m1-e2e-plan-execute-apply"
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
Fixes 5 bugs preventing the M1 E2E acceptance test (PR #789) from passing, plus updates all existing test mocks to work with the new
execute_plan()CLI behavior.Root Causes & Fixes
1. DI container bypass in
_get_lifecycle_service()(action.py + plan.py)Both
action.pyandplan.pycreatedPlanLifecycleService(settings=settings)directly, bypassing the container'sUnitOfWork. Data was in-memory only and lost between subprocess invocations. Fix: usecontainer.plan_lifecycle_service().2.
plan executeCLI did not process phasesCalled
service.execute_plan()which is a pure state transition — never invokedPlanExecutor.run_strategize()orrun_execute(). Fix: rewrote to detect the plan's phase/state and dispatch synchronously through the executor.3.
plan applyCLI missingplan_idargumentSignature was
apply(yes=False)with no positional. The test callsplan apply --yes ${plan_id}. Fix: added optionalplan_idpositional argument with_lifecycle_apply_with_id()driving through Apply/queued → Apply/processing → Apply/applied.4. Preflight guardrail action lookup was in-memory only
start_strategize()builtaction_registryfromself._actionsdict (empty in a new subprocess). Fix: addedself.get_action(plan.action_name)to load the action from DB into the in-memory cache before the guardrail check.5. Robot Framework
Create Filesyntax bug + branch nameContinuation lines (
...) withCreate Filecreated 9 arguments instead of 1. Fixed to useCatenate SEPARATOR=\n+Create File. Also fixed--branch main→--branch master.6. Test mock updates for new
execute_plan()behaviorThe new
execute_plan()calls_get_plan_executor()andservice.get_plan(plan_id)for phase/state detection. Updated mocks in 8 Behave step files and 5 Robot helper files to:_get_plan_executorin all test setupsservice.get_plan.return_valueto real Plan objects with correct phase/stateFiles Changed
Source code:
src/cleveragents/cli/commands/plan.py—_get_lifecycle_service(),_get_plan_executor(),execute_plan(),apply(), message text fixsrc/cleveragents/cli/commands/action.py—_get_lifecycle_service()container fixsrc/cleveragents/application/services/plan_lifecycle_service.py— action DB preload instart_strategize()robot/e2e/m1_acceptance.robot—Create Filesyntax, branch nameTest mocks (Behave):
features/steps/cli_lifecycle_coverage_steps.pyfeatures/steps/cli_lifecycle_robot_alignment_steps.pyfeatures/steps/m1_sourcecode_smoke_steps.pyfeatures/steps/plan_cli_commands_r2_steps.pyfeatures/steps/plan_cli_coverage_boost_steps.pyfeatures/steps/plan_cli_coverage_r2_steps.pyfeatures/steps/plan_lifecycle_cli_steps.pyfeatures/steps/plan_lifecycle_commands_coverage_steps.pyTest mocks (Robot helpers):
robot/helper_cli_lifecycle.pyrobot/helper_cli_lifecycle_e2e.pyrobot/helper_m1_sourcecode_smoke.pyrobot/helper_m4_e2e_cli.pyrobot/helper_m4_e2e_cli_errors.pyTest Results
Behave unit tests: 254 scenarios passed across 9 affected feature files, 0 failed.
ISSUES CLOSED: #789
9a652b9d47to03031375c7ea1bc12acff95feb6a20f95feb6a205f07316641