Files
cleveragents-core/features/plan_commands_new_coverage.feature
freemo 41ca082022
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Failing after 13s
CI / quality (pull_request) Successful in 17s
CI / build (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 34s
CI / security (pull_request) Successful in 33s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 2m31s
CI / unit_tests (pull_request) Successful in 6m43s
CI / docker (pull_request) Has been skipped
Tests: Improved coverage to get us back above 97%
2026-02-22 15:29:41 -05:00

83 lines
3.8 KiB
Gherkin

Feature: Plan CLI commands new coverage
As a developer
I want to cover the remaining uncovered lines in plan.py
So that plan diff (with/without correction), plan artifacts, and _get_apply_service are fully tested
# ---------- plan diff with --correction flag (lines 1856-1867) ----------
Scenario: Plan diff with correction flag shows correction panel
Given new_cov no service mocks are needed
When new_cov I run plan diff for "plan-100" with correction "corr-42"
Then new_cov the exit code should be 0
And new_cov the output should contain "Correction Diff"
And new_cov the output should contain "corr-42"
And new_cov the output should contain "plan-100"
# ---------- plan diff without correction (lines 1869-1871) ----------
Scenario: Plan diff without correction calls service diff
Given new_cov the apply service diff returns "--- a/app.py\n+++ b/app.py\n@@ -1 +1 @@"
When new_cov I run plan diff for "plan-200"
Then new_cov the exit code should be 0
And new_cov the output should contain "app.py"
Scenario: Plan diff without correction with json format
Given new_cov the apply service diff returns '{"entries": [], "summary": {}}'
When new_cov I run plan diff for "plan-201" with format "json"
Then new_cov the exit code should be 0
And new_cov the output should contain "entries"
# ---------- plan diff error paths ----------
Scenario: Plan diff raises PlanError
Given new_cov the apply service diff raises PlanError "changeset missing"
When new_cov I run plan diff for "plan-bad"
Then new_cov the exit code should be nonzero
And new_cov the output should contain "Diff Error"
And new_cov the output should contain "changeset missing"
Scenario: Plan diff raises CleverAgentsError
Given new_cov the apply service diff raises CleverAgentsError "backend down"
When new_cov I run plan diff for "plan-err"
Then new_cov the exit code should be nonzero
And new_cov the output should contain "Error"
And new_cov the output should contain "backend down"
# ---------- plan artifacts (lines 1901-1904) ----------
Scenario: Plan artifacts calls service artifacts
Given new_cov the apply service artifacts returns "changeset_id: cs-999\nfiles: 3"
When new_cov I run plan artifacts for "plan-300"
Then new_cov the exit code should be 0
And new_cov the output should contain "cs-999"
Scenario: Plan artifacts with json format
Given new_cov the apply service artifacts returns '{"changeset_id": "cs-abc", "files": 5}'
When new_cov I run plan artifacts for "plan-301" with format "json"
Then new_cov the exit code should be 0
And new_cov the output should contain "cs-abc"
# ---------- plan artifacts error paths ----------
Scenario: Plan artifacts raises PlanError
Given new_cov the apply service artifacts raises PlanError "plan not found"
When new_cov I run plan artifacts for "plan-missing"
Then new_cov the exit code should be nonzero
And new_cov the output should contain "Artifacts Error"
And new_cov the output should contain "plan not found"
Scenario: Plan artifacts raises CleverAgentsError
Given new_cov the apply service artifacts raises CleverAgentsError "timeout"
When new_cov I run plan artifacts for "plan-timeout"
Then new_cov the exit code should be nonzero
And new_cov the output should contain "Error"
And new_cov the output should contain "timeout"
# ---------- _get_apply_service real body (lines 1817-1822) ----------
Scenario: _get_apply_service imports PlanApplyService and creates it
Given new_cov a mocked lifecycle service for apply service creation
When new_cov I call _get_apply_service directly
Then new_cov the returned object should be a PlanApplyService instance
And new_cov PlanApplyService was constructed with the lifecycle service