Files
cleveragents-core/features/acms_context_cli_coverage.feature
HAL9000 7e4fa26373
CI / push-validation (pull_request) Successful in 45s
CI / build (pull_request) Successful in 59s
CI / lint (pull_request) Successful in 1m10s
CI / quality (pull_request) Successful in 1m21s
CI / helm (pull_request) Successful in 1m19s
CI / typecheck (pull_request) Successful in 1m26s
CI / security (pull_request) Successful in 1m48s
CI / unit_tests (pull_request) Failing after 6m28s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Failing after 10m18s
CI / status-check (pull_request) Failing after 3s
test(acms): add CLI coverage BDD scenarios for acms show and acms clear commands
Add features/acms_context_cli_coverage.feature and
features/steps/acms_context_cli_coverage_steps.py to exercise the
acms_show and acms_clear typer CLI command functions via CliRunner,
covering all code paths (invalid view, empty service, rich table,
JSON output, truncated flag, invalid tier, no-filter, path/tag/tier
filters, confirmation prompt) that the existing unit-level BDD tests
do not reach. Fixes coverage gate failure.
2026-06-06 11:39:34 -04:00

98 lines
5.1 KiB
Gherkin

Feature: ACMS context CLI command coverage
As a developer maintaining the CleverAgents codebase
I want the acms_show and acms_clear CLI commands to be fully covered
So that the coverage gate passes at 97%
# acms show CLI
Scenario: acms show with invalid view name exits with error
When I invoke acms show CLI with invalid view "badview"
Then the acms CLI exit code should be 1
Scenario: acms show with empty service renders no-entries panel
Given a mocked ACMS tier service with no fragments
When I invoke acms show CLI with view "default" only
Then the acms CLI exit code should be 0
And the acms CLI output should contain "No context entries found"
Scenario: acms show with fragments renders rich table
Given a mocked ACMS tier service with one hot fragment "f1" path "src/a.py" size 100
When I invoke acms show CLI with view "default" only
Then the acms CLI exit code should be 0
And the acms CLI output should contain "src/a.py"
Scenario: acms show with JSON format outputs JSON
Given a mocked ACMS tier service with one hot fragment "f2" path "src/b.py" size 50
When I invoke acms show CLI with view "default" and output format "json"
Then the acms CLI exit code should be 0
And the acms CLI output should contain "entries"
And the acms CLI output should contain "total_tokens"
Scenario: acms show with project scope renders scoped table
Given a mocked ACMS tier service with one hot fragment "f3" path "src/c.py" size 75
When I invoke acms show CLI with view "default" and project scope "local/proj"
Then the acms CLI exit code should be 0
Scenario: acms show with truncated entries shows truncated flag
Given a mocked ACMS tier service with two fragments exceeding budget
When I invoke acms show CLI with view "default" and token budget 80
Then the acms CLI exit code should be 0
And the acms CLI output should contain "truncated"
Scenario: acms show with custom budget renders budget utilization
Given a mocked ACMS tier service with one hot fragment "f4" path "src/d.py" size 400
When I invoke acms show CLI with view "default" and token budget 1000
Then the acms CLI exit code should be 0
And the acms CLI output should contain "400"
# ── acms clear CLI ────────────────────────────────────────────────────────
Scenario: acms clear with invalid tier exits with error
When I invoke acms clear CLI with invalid tier "badtier"
Then the acms CLI exit code should be 1
Scenario: acms clear with no filter shows no-filter message
Given a mocked ACMS tier service with no fragments
When I invoke acms clear CLI with no filter
Then the acms CLI exit code should be 0
And the acms CLI output should contain "No filter specified"
Scenario: acms clear with no filter and JSON format outputs JSON
Given a mocked ACMS tier service with no fragments
When I invoke acms clear CLI with no filter and output format "json"
Then the acms CLI exit code should be 0
And the acms CLI output should contain "removed_count"
Scenario: acms clear with path filter and yes flag removes entries
Given a mocked ACMS tier service with one hot fragment "c1" path "old.py" size 50
When I invoke acms clear CLI with path filter "old.py" and yes flag
Then the acms CLI exit code should be 0
And the acms CLI output should contain "Removed"
Scenario: acms clear with path filter yes flag and JSON format
Given a mocked ACMS tier service with one hot fragment "c2" path "old2.py" size 50
When I invoke acms clear CLI with path filter "old2.py" yes flag and output format "json"
Then the acms CLI exit code should be 0
And the acms CLI output should contain "removed_count"
Scenario: acms clear with tier filter and yes flag removes entries
Given a mocked ACMS tier service with one hot fragment "c3" path "hot.py" size 50
When I invoke acms clear CLI with tier filter "hot" and yes flag
Then the acms CLI exit code should be 0
Scenario: acms clear with tag filter and yes flag removes entries
Given a mocked ACMS tier service with one tagged fragment "c4" path "tagged.py" size 50 tag "stale"
When I invoke acms clear CLI with tag filter "stale" and yes flag
Then the acms CLI exit code should be 0
Scenario: acms clear with path filter confirmed removes entries
Given a mocked ACMS tier service with one hot fragment "c5" path "confirm.py" size 50
When I invoke acms clear CLI with path filter "confirm.py" and confirmation "y"
Then the acms CLI exit code should be 0
Scenario: acms clear with path filter declined leaves entries intact
Given a mocked ACMS tier service with one hot fragment "c6" path "decline.py" size 50
When I invoke acms clear CLI with path filter "decline.py" and confirmation "n"
Then the acms CLI exit code should be 0
And the acms CLI output should contain "Cancelled"