Files
cleveragents-core/features/automation_profile_cli_coverage_boost.feature
T
freemo a808c395f9
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 35s
CI / security (pull_request) Successful in 50s
CI / unit_tests (pull_request) Successful in 2m46s
CI / integration_tests (pull_request) Successful in 3m16s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m6s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 16s
CI / build (push) Successful in 18s
CI / security (push) Successful in 32s
CI / typecheck (push) Successful in 35s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m52s
CI / integration_tests (push) Successful in 3m8s
CI / docker (push) Successful in 39s
CI / coverage (push) Successful in 5m53s
CI / benchmark-publish (push) Successful in 16m55s
CI / benchmark-regression (pull_request) Successful in 33m0s
test(coverage): add Behave BDD tests to improve unit test coverage across 53 source modules
Add 53 new .feature files and corresponding step definition files targeting
uncovered lines identified in build/coverage.xml. Fix AmbiguousStep conflicts
in 7 pre-existing step files by disambiguating step text.

New tests cover: ACP clients/facade, actor CLI/config, application container,
ACMS service/strategies, async worker, automation profile CLI, autonomy
guardrail, bridge, change model, config CLI/service, context service,
cross-plan correction, database models, decision service, decomposition
clustering/service, discovery handler, langchain chat provider, langgraph
nodes, materializers, multi-project service, plan apply/CLI/lifecycle/model/
preflight/resume/service, PostgreSQL analyzer, project CLI/context CLI,
provider registry, reactive application/route, repositories, resolver handler,
resource registry service, resume model, retry patterns, sandbox protocol,
server CLI, skill CLI/service, skills registry, subplan execution/service,
system CLI, UKO loader, UoW, and YAML template engine.

Closes #645
2026-03-09 13:01:58 -04:00

78 lines
4.3 KiB
Gherkin

Feature: Automation Profile CLI guards coverage boost
As a developer
I want to cover the guards-related branches in automation_profile CLI module
So that the uncovered lines 91-97 and 194-204 are exercised
Background:
Given a fresh automation profile CLI runner for guards coverage
# -----------------------------------------------------------------
# Direct unit-level coverage of _guards_dict (lines 91-97)
# -----------------------------------------------------------------
Scenario: _guards_dict returns all guard fields when guards are present
Given an AutomationGuard with max_tool_calls_per_step 10 and max_total_cost 50.0
When I call _guards_dict with the guard object
Then the guards dict should contain key "max_tool_calls_per_step" with value 10
And the guards dict should contain key "max_total_cost" with value 50.0
And the guards dict should contain key "tool_allowlist"
And the guards dict should contain key "tool_denylist"
And the guards dict should contain key "require_approval_for_writes"
And the guards dict should contain key "require_approval_for_apply"
Scenario: _guards_dict returns None when guards are None
When I call _guards_dict with None
Then the guards dict result should be None
Scenario: _guards_dict populates allowlist and denylist from guard
Given an AutomationGuard with tool_allowlist "read_file,write_file" and tool_denylist "rm_rf"
When I call _guards_dict with the guard object
Then the guards dict tool_allowlist should be "read_file,write_file"
And the guards dict tool_denylist should be "rm_rf"
# -----------------------------------------------------------------
# _profile_spec_dict includes guards (lines 91-97 via indirect call)
# -----------------------------------------------------------------
Scenario: _profile_spec_dict includes populated guards for profile with guards
Given an AutomationProfile with guards having require_approval_for_writes true
When I call _profile_spec_dict with the guarded profile
Then the profile spec dict guards should not be None
And the profile spec dict guards should have "require_approval_for_writes" as true
# -----------------------------------------------------------------
# _print_profile rich format with guards (lines 194-204)
# -----------------------------------------------------------------
Scenario: Show profile with guards in rich format displays guard details
Given a custom guarded profile "acme/guarded" is stored in the repo
When I run automation-profile show "acme/guarded" in rich format
Then the guards coverage show command should succeed
And the guards coverage output should contain "Guards"
And the guards coverage output should contain "max_tool_calls_per_step"
And the guards coverage output should contain "require_approval_for_writes"
And the guards coverage output should contain "require_approval_for_apply"
Scenario: Add profile with guards config in rich format displays guard details
Given a YAML config file for a guarded profile "acme/newguarded"
When I run automation-profile add with the guarded config file
Then the guards coverage add command should succeed
And the guards coverage output should contain "Guards"
And the guards coverage output should contain "max_tool_calls_per_step"
And the guards coverage output should contain "tool_allowlist"
And the guards coverage output should contain "tool_denylist"
Scenario: Show profile with guards in JSON format includes guards data
Given a custom guarded profile "acme/guardedjson" is stored in the repo
When I run automation-profile show "acme/guardedjson" with format "json"
Then the guards coverage show command should succeed
And the guards coverage output should contain "max_tool_calls_per_step"
And the guards coverage output should contain "require_approval_for_writes"
Scenario: Remove guarded profile with --format json includes guards in output
Given a custom guarded profile "acme/guardedremove" is stored in the repo
When I run automation-profile remove "acme/guardedremove" with --yes and format "json"
Then the guards coverage remove command should succeed
And the guards coverage output should contain "max_tool_calls_per_step"
And the guards coverage output should contain "removed"