Files
cleveragents-core/features/automation_profile_cli_coverage_boost.feature

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"