fix(context-policy): resolve AmbiguousStep conflict and fix ruff formatting
CI / load-versions (pull_request) Successful in 8s
CI / push-validation (pull_request) Successful in 9s
CI / build (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 18s
CI / lint (pull_request) Successful in 20s
CI / quality (pull_request) Successful in 20s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 1m20s
CI / unit_tests (pull_request) Successful in 5m57s
CI / docker (pull_request) Successful in 2m17s
CI / integration_tests (pull_request) Successful in 8m51s
CI / coverage (pull_request) Successful in 11m41s
CI / status-check (pull_request) Successful in 1s

Rename step decorators in context_policy_strategy_config_steps.py from
'the strategy should be "{strategy}"' to 'the policy strategy should be
"{strategy}"' (and likewise for the None variant) to avoid collision with
the identically-patterned step already registered in
plan_merge_strategy_steps.py. Update the feature file to match.

Also apply ruff format to the three files flagged by CI lint gate:
- features/steps/context_policy_strategy_config_steps.py
- scripts/update_context_policy.py
- src/cleveragents/domain/models/core/context_policy.py

ISSUES CLOSED: #7572
This commit is contained in:
2026-06-18 22:42:40 -04:00
committed by drew
parent c104425bed
commit 91d497ca03
4 changed files with 75 additions and 75 deletions
@@ -7,31 +7,31 @@ Feature: Context Policy Strategy Configuration
Scenario: Create context policy with basic strategy
Given a context policy with strategy "basic"
When I validate the context policy
Then the strategy should be "basic"
Then the policy strategy should be "basic"
And the policy should be valid
Scenario: Create context policy with semantic strategy
Given a context policy with strategy "semantic"
When I validate the context policy
Then the strategy should be "semantic"
Then the policy strategy should be "semantic"
And the policy should be valid
Scenario: Create context policy with relevance_scoring strategy
Given a context policy with strategy "relevance_scoring"
When I validate the context policy
Then the strategy should be "relevance_scoring"
Then the policy strategy should be "relevance_scoring"
And the policy should be valid
Scenario: Create context policy with adaptive strategy
Given a context policy with strategy "adaptive"
When I validate the context policy
Then the strategy should be "adaptive"
Then the policy strategy should be "adaptive"
And the policy should be valid
Scenario: Create context policy with fusion strategy
Given a context policy with strategy "fusion"
When I validate the context policy
Then the strategy should be "fusion"
Then the policy strategy should be "fusion"
And the policy should be valid
Scenario: Reject invalid strategy name
@@ -50,7 +50,7 @@ Feature: Context Policy Strategy Configuration
Scenario: Create context policy without strategy
Given a context policy without strategy
When I validate the context policy
Then the strategy should be None
Then the policy strategy should be None
And the policy should be valid
Scenario: Create context policy with strategy but no config
@@ -63,7 +63,7 @@ def step_validate_policy(context: Context) -> None:
context.policy_error = str(exc)
@then('the strategy should be "{strategy}"')
@then('the policy strategy should be "{strategy}"')
def step_strategy_is(context: Context, strategy: str) -> None:
if strategy == "None":
assert context.policy.strategy is None
@@ -71,14 +71,16 @@ def step_strategy_is(context: Context, strategy: str) -> None:
assert context.policy.strategy == strategy
@then("the strategy should be None")
@then("the policy strategy should be None")
def step_strategy_is_none(context: Context) -> None:
assert context.policy.strategy is None
@then("the policy should be valid")
def step_policy_valid(context: Context) -> None:
assert context.policy_error is None, f"Expected valid policy but got error: {context.policy_error}"
assert context.policy_error is None, (
f"Expected valid policy but got error: {context.policy_error}"
)
@then("the policy should be invalid")