Files
cleveragents-core/features/plan_cli_cancel_revert_coverage.feature
T
freemo 55aee7cf22 fix(test): commit after each add_skill to prevent session GC rollback, and improved coverage.
The step_register_skills_table step called add_skill in a loop but only
committed once at the end. Because SkillRepository.create() obtains a
new session per call and only flushes (never commits), the intermediate
sessions could be garbage-collected before the final commit, rolling
back their transactions on the shared SQLite :memory: connection. Moving
_commit_pending inside the loop ensures each skill is durably committed
before the next session is created.

ISSUES CLOSED: #418
2026-02-24 12:19:04 -05:00

92 lines
4.7 KiB
Gherkin

Feature: Plan CLI cancel, revert, and lifecycle-list rich coverage
As a developer
I want to exercise the uncovered cancel_plan, revert_plan,
and lifecycle_list_plans rich table rendering paths
So that coverage for plan.py lines 1817, 1821-1822, 1845-1855, 1878-1888 is achieved
Background:
Given a CLI runner for cancel-revert coverage
And a mocked lifecycle service for cancel-revert coverage
# ---------- lifecycle-list rich table rendering (lines 1817, 1820-1822) ----------
Scenario: lifecycle-list in rich format renders created_at timestamp
Given the service returns plans with project links and timestamps for rich list
When I invoke lifecycle-list in rich format for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Lifecycle Plans"
Scenario: lifecycle-list in rich format renders automation profile column
Given the service returns plans with an automation profile for rich list
When I invoke lifecycle-list in rich format for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Lifecycle Plans"
Scenario: lifecycle-list in rich format renders multiple project links
Given the service returns a plan with three project links for rich list
When I invoke lifecycle-list in rich format for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "more"
Scenario: lifecycle-list in rich format renders invariant count
Given the service returns plans with invariants for rich list
When I invoke lifecycle-list in rich format for cancel-revert coverage
Then the cancel-revert command should succeed
# ---------- cancel_plan (lines 1845-1855) ----------
Scenario: cancel_plan succeeds in rich format without reason
Given the service can cancel a plan for cancel-revert coverage
When I invoke cancel in rich format without reason for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Plan cancelled"
Scenario: cancel_plan succeeds in rich format with reason
Given the service can cancel a plan for cancel-revert coverage
When I invoke cancel in rich format with reason "no longer needed" for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Plan cancelled"
And the cancel-revert output should contain "no longer needed"
Scenario: cancel_plan succeeds in JSON format without reason
Given the service can cancel a plan for cancel-revert coverage
When I invoke cancel with format "json" and no reason for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "plan_id"
And the cancel-revert output should not contain "cancel_reason"
Scenario: cancel_plan succeeds in JSON format with reason
Given the service can cancel a plan for cancel-revert coverage
When I invoke cancel with format "json" and reason "obsolete" for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "cancel_reason"
And the cancel-revert output should contain "obsolete"
# ---------- revert_plan (lines 1878-1888) ----------
Scenario: revert_plan succeeds in rich format with default phase
Given the service can revert a plan for cancel-revert coverage
When I invoke revert in rich format with default phase for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Plan Reverted"
And the cancel-revert output should contain "Reversion count"
Scenario: revert_plan succeeds in rich format with reason
Given the service can revert a plan for cancel-revert coverage
When I invoke revert in rich format with reason "constraints too strict" for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Plan Reverted"
Scenario: revert_plan succeeds in JSON format
Given the service can revert a plan for cancel-revert coverage
When I invoke revert with format "json" for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "plan_id"
And the cancel-revert output should contain "reversion_reason"
Scenario: revert_plan rejects invalid phase
Given the service can revert a plan for cancel-revert coverage
When I invoke revert with invalid phase "bogus" for cancel-revert coverage
Then the cancel-revert command should abort
And the cancel-revert output should contain "Invalid phase"