Files
cleveragents-core/features/automation_profile_service.feature
T

125 lines
5.3 KiB
Gherkin

Feature: Automation Profile Service
As a developer
I want to resolve automation profiles with precedence
So that plan execution autonomy is configured correctly
# ---- Precedence resolution ----
Scenario: Plan-level profile takes highest precedence
Given an automation profile service with global default "manual"
When I resolve profile with plan "full-auto" action "auto" project "supervised"
Then the resolved profile name should be "full-auto"
Scenario: Action-level profile used when plan is not set
Given an automation profile service with global default "manual"
When I resolve profile with plan None action "auto" project "supervised"
Then the resolved profile name should be "auto"
Scenario: Project-level profile used when plan and action are not set
Given an automation profile service with global default "manual"
When I resolve profile with plan None action None project "supervised"
Then the resolved profile name should be "supervised"
Scenario: Global default used when no level is set
Given an automation profile service with global default "cautious"
When I resolve profile with plan None action None project None
Then the resolved profile name should be "cautious"
Scenario: Default global is manual when nothing configured
Given an automation profile service with no configuration
When I resolve profile with plan None action None project None
Then the resolved profile name should be "manual"
# ---- Missing profile errors ----
Scenario: Missing profile raises NotFoundError
Given an automation profile service with global default "manual"
When I try to get profile "nonexistent-profile"
Then a profile not found error should be raised
And the profile service error should mention "nonexistent-profile"
Scenario: Missing profile in resolve raises NotFoundError
Given an automation profile service with global default "does-not-exist"
When I try to resolve profile with all None
Then a profile not found error should be raised
# ---- Legacy automation_level mapping ----
Scenario: Legacy manual maps to manual profile
Given an automation profile service with global default "manual"
When I map legacy level "manual"
Then the mapped profile name should be "manual"
Scenario: Legacy supervised maps to supervised profile
Given an automation profile service with global default "manual"
When I map legacy level "supervised"
Then the mapped profile name should be "supervised"
Scenario: Legacy auto maps to auto profile
Given an automation profile service with global default "manual"
When I map legacy level "auto"
Then the mapped profile name should be "auto"
Scenario: Legacy full_auto maps to full-auto profile
Given an automation profile service with global default "manual"
When I map legacy level "full_auto"
Then the mapped profile name should be "full-auto"
Scenario: Unknown legacy level raises ValidationError
Given an automation profile service with global default "manual"
When I try to map legacy level "unknown_level"
Then a legacy mapping validation error should be raised
And the validation error should mention "unknown_level"
Scenario: Resolve legacy level returns full profile
Given an automation profile service with global default "manual"
When I resolve legacy level "auto"
Then the resolved profile should have auto_apply 1.0
# ---- Environment variable override ----
Scenario: Env var overrides empty global default
Given an automation profile service with no configuration
And the env var CLEVERAGENTS_AUTOMATION_PROFILE is set to "ci"
When I resolve profile with plan None action None project None
Then the resolved profile name should be "ci"
Scenario: Explicit global default takes precedence over env var
Given an automation profile service with global default "review"
And the env var CLEVERAGENTS_AUTOMATION_PROFILE is set to "ci"
When I resolve profile with plan None action None project None
Then the resolved profile name should be "review"
# ---- CRUD via repository ----
Scenario: List profiles includes built-ins
Given an automation profile service with global default "manual"
When I list all profiles
Then the profile list should include "manual"
And the profile list should include "full-auto"
And the profile list should have at least 8 entries
# ---- Get built-in profile ----
Scenario: Get built-in profile by name
Given an automation profile service with global default "manual"
When I get profile "auto"
Then the retrieved profile name should be "auto"
And the retrieved profile auto_apply should be 1.0
# ---- Profile threshold checks ----
Scenario: Manual profile has all thresholds at 1.0
Given an automation profile service with global default "manual"
When I get profile "manual"
Then the retrieved profile auto_strategize should be 1.0
And the retrieved profile auto_execute should be 1.0
And the retrieved profile auto_apply should be 1.0
Scenario: Full-auto profile has all thresholds at 0.0
Given an automation profile service with global default "manual"
When I get profile "full-auto"
Then the retrieved profile auto_strategize should be 0.0
And the retrieved profile auto_execute should be 0.0
And the retrieved profile auto_apply should be 0.0