Files
cleveragents-core/features/automation_profile_cli.feature
T
CoreRasurae 007af498b8
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 33s
CI / lint (pull_request) Successful in 3m42s
CI / security (pull_request) Successful in 4m8s
CI / quality (pull_request) Successful in 4m9s
CI / typecheck (pull_request) Successful in 4m20s
CI / integration_tests (pull_request) Successful in 7m2s
CI / unit_tests (pull_request) Successful in 7m55s
CI / docker (pull_request) Successful in 1m19s
CI / coverage (pull_request) Successful in 8m46s
CI / e2e_tests (pull_request) Successful in 16m1s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 17s
CI / helm (push) Successful in 22s
CI / quality (push) Successful in 31s
CI / lint (push) Successful in 3m28s
CI / typecheck (push) Successful in 3m54s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m5s
CI / integration_tests (push) Successful in 6m13s
CI / unit_tests (push) Successful in 6m28s
CI / docker (push) Successful in 1m34s
CI / coverage (push) Successful in 12m5s
CI / e2e_tests (push) Successful in 18m47s
CI / status-check (push) Successful in 1s
CI / benchmark-publish (push) Successful in 28m0s
CI / benchmark-regression (pull_request) Successful in 59m48s
refactor(autonomy): rename automation profile task flags to spec names
Renamed all 11 task-type confidence threshold fields in AutomationProfile
from phase-transition semantics to spec-defined task-type semantics.
Updated all 8 built-in profiles, CLI formatting, YAML schema, services,
and all Behave/Robot tests referencing the old field names.

Post-review fixes:
- Fixed 24 stale old field names in M6 fixture files
  (automation_profiles.json, autonomy_guardrails.json)
- Added model_validator(mode='before') to detect legacy field names
  and raise actionable ValueError with rename mapping
- Added semantic bridge comments in PlanLifecycleService mapping
  task-type thresholds to phase-transition gates
- Added threshold_field to structured log messages for observability
- Restored categorised CLI automation-profile show output to match
  spec (Phase Transitions / Decision Automation / Self-Repair /
  Execution Controls) instead of flat list
- Added missing access_network field to spec show output examples
  (Rich, Plain, JSON, YAML variants)
- Aligned ADR-017 profile fields table to all 11 fields with
  descriptions matching spec Automatable Tasks table
- Aligned automation_profiles.md threshold descriptions with spec
- Added spec section references in phase_reversion.md, error_recovery.md,
  and plan_execute.md for field naming context
- Extended repository roundtrip test to assert all 11 threshold fields
- Fixed benchmark _make_profile() passing safety fields as top-level
  kwargs instead of via SafetyProfile sub-model (incompatible with
  extra="forbid")
- Aligned CLI JSON/YAML output structure for automation-profile show
  with the specification grouped format (phase_transitions,
  decision_automation, self_repair, execution_controls)
- Moved safety boolean fields into the Execution Controls section
  of Rich output per spec examples
- Reverted auto profile description to "Fully automatic except apply"
  per specification (line 16703, line 28406)
- Improved bridge comments in test steps with semantic context for
  threshold-to-gate mappings

ISSUES CLOSED: #902
2026-03-30 13:18:07 +01:00

158 lines
7.3 KiB
Gherkin

Feature: Automation Profile CLI commands
As a developer
I want to manage automation profiles via CLI commands
So that I can control plan execution autonomy levels
Background:
Given an automation profile CLI runner with mocks
# Add command tests
Scenario: Add profile via config file
Given a valid automation profile config YAML file
When I run automation-profile add with --config pointing to the YAML file
Then the automation-profile add should succeed
And the automation-profile output should contain "acme/strict"
Scenario: Add profile with --update for existing custom profile
Given a valid automation profile config YAML file
And the custom profile "acme/strict" already exists
When I run automation-profile add with --config and --update
Then the automation-profile add should succeed
And the automation-profile output should contain "Updated"
Scenario: Add profile conflict without --update
Given a valid automation profile config YAML file
And the custom profile "acme/strict" already exists
When I run automation-profile add with --config without --update
Then the automation-profile command should abort
And the automation-profile output should contain "Conflict"
Scenario: Add profile with missing config file fails
When I run automation-profile add with --config pointing to a missing file
Then the automation-profile command should abort
Scenario: Add profile with invalid YAML fails
Given an invalid YAML automation profile config file
When I run automation-profile add with --config pointing to the invalid YAML file
Then the automation-profile command should abort
Scenario: Add profile with invalid name fails
Given an automation profile config YAML file with invalid name
When I run automation-profile add with --config pointing to the invalid name YAML file
Then the automation-profile command should abort
Scenario: Add profile with invalid threshold fails
Given an automation profile config YAML file with invalid threshold
When I run automation-profile add with --config pointing to the invalid threshold YAML file
Then the automation-profile command should abort
Scenario: Add profile with legacy threshold keys fails
Given an automation profile config YAML file with legacy threshold keys
When I run automation-profile add with --config pointing to the legacy threshold YAML file
Then the automation-profile command should abort
And the automation-profile output should contain "auto_strategize"
Scenario: Add profile cannot overwrite built-in
Given an automation profile config YAML file with built-in name "manual"
When I run automation-profile add with --config pointing to the built-in name YAML file
Then the automation-profile command should abort
And the automation-profile output should contain "built-in"
Scenario: Add profile with unsupported schema version
Given an automation profile config YAML file with schema_version "2.0"
When I run automation-profile add with --config pointing to the unsupported schema YAML file
Then the automation-profile command should abort
And the automation-profile output should contain "schema_version"
# List command tests
Scenario: List profiles shows built-in profiles
When I run automation-profile list
Then the automation-profile list should succeed
And the automation-profile output should contain "manual"
And the automation-profile output should contain "auto"
Scenario: List profiles with namespace filter
Given a custom profile "acme/strict" has been added
When I run automation-profile list with namespace filter "acme"
Then the automation-profile list should succeed
And the automation-profile output should contain "acme/strict"
Scenario: List profiles with regex filter
When I run automation-profile list with regex "caut.*"
Then the automation-profile list should succeed
And the automation-profile output should contain "cautious"
Scenario: List profiles with invalid regex
When I run automation-profile list with regex "[invalid"
Then the automation-profile command should abort
Scenario: List profiles with --format json output snapshot
When I run automation-profile list with --format json
Then the automation-profile list should succeed
And the automation-profile json output should contain "name"
And the automation-profile json output should contain "decompose_task"
Scenario: List profiles with no matches
When I run automation-profile list with namespace filter "nonexistent"
Then the automation-profile output should contain "No profiles found"
# Show command tests
Scenario: Show built-in profile details
When I run automation-profile show "manual"
Then the automation-profile show should succeed
And the automation-profile output should contain "manual"
And the automation-profile output should contain "1.0"
Scenario: Show profile not found
When I run automation-profile show "nonexistent/profile"
Then the automation-profile command should abort
And the automation-profile output should contain "not found"
Scenario: Show profile with --format yaml output snapshot
When I run automation-profile show "manual" with --format yaml
Then the automation-profile show should succeed
And the automation-profile yaml output should contain "name: manual"
And the automation-profile yaml output should contain "decompose_task"
Scenario: Show profile with --format json
When I run automation-profile show "manual" with --format json
Then the automation-profile show should succeed
And the automation-profile json output should contain "name"
Scenario: Show profile with --format plain
When I run automation-profile show "manual" with --format plain
Then the automation-profile show should succeed
And the automation-profile output should contain "name: manual"
Scenario: Show profile with --format table
When I run automation-profile show "manual" with --format table
Then the automation-profile show should succeed
# Remove command tests
Scenario: Remove custom profile with confirmation
Given a custom profile "acme/strict" has been added
When I run automation-profile remove "acme/strict" with --yes
Then the automation-profile remove should succeed
And the automation-profile output should contain "removed"
Scenario: Remove built-in profile fails
When I run automation-profile remove "manual" with --yes
Then the automation-profile command should abort
And the automation-profile output should contain "built-in"
Scenario: Remove nonexistent profile fails
When I run automation-profile remove "nonexistent/profile" with --yes
Then the automation-profile command should abort
And the automation-profile output should contain "not found"
Scenario: Remove profile with --format json
Given a custom profile "acme/toremove" has been added
When I run automation-profile remove "acme/toremove" with --yes and --format json
Then the automation-profile remove should succeed
And the automation-profile json output should contain "removed"
# Legacy flag removal tests
Scenario: Legacy --automation-level flag is rejected on plan use
When I invoke plan use with --automation-level "manual"
Then the plan output should contain "No such option: --automation-level"