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
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
76 lines
4.1 KiB
Gherkin
76 lines
4.1 KiB
Gherkin
Feature: Autonomy Guardrail Service – coverage boost
|
||
Targets uncovered code paths in autonomy_guardrail_service.py to
|
||
increase line coverage for lines 173, 191-194, 211, 259, 266,
|
||
285-288, 310, 371-372, 404-405, and 517.
|
||
|
||
# ---- check_tool_budget: budget blocked path (lines 173, 191-194) ----
|
||
|
||
Scenario: Service budget check blocks when budget is exceeded and logs warning
|
||
Given a guardrail service with tool_budget 10.0 for plan "budget-block"
|
||
When I check tool budget via the coverage service for plan "budget-block" with cost 15.0
|
||
Then the coverage budget check should return False
|
||
And the audit trail for coverage plan "budget-block" should record a budget_blocked event
|
||
|
||
Scenario: Service budget check blocks when cumulative spend exceeds budget
|
||
Given a guardrail service with tool_budget 20.0 for plan "budget-cumul"
|
||
When I successfully check tool budget for plan "budget-cumul" with cost 12.0
|
||
And I check tool budget via the coverage service for plan "budget-cumul" with cost 12.0
|
||
Then the coverage budget check should return False
|
||
|
||
# ---- check_wall_clock: no guardrails configured (line 211) ----
|
||
|
||
Scenario: Service wall-clock check returns True for unconfigured plan
|
||
Given a fresh guardrail service for coverage
|
||
When I check wall-clock via the coverage service for plan "no-wc-plan"
|
||
Then the coverage wall-clock check should return True
|
||
|
||
# ---- check_actor_tool_calls: no guardrails configured (line 259) ----
|
||
|
||
Scenario: Service actor tool-call check returns True for unconfigured plan
|
||
Given a fresh guardrail service for coverage
|
||
When I check actor tool calls via the coverage service for plan "no-actor-plan" with 50 calls
|
||
Then the coverage actor check should return True
|
||
|
||
# ---- check_actor_tool_calls: blocked path (lines 266, 285-288) ----
|
||
|
||
Scenario: Service actor tool-call check blocks when limit exceeded and logs warning
|
||
Given a guardrail service with actor tool-call limit 3 for plan "actor-block"
|
||
When I check actor tool calls via the coverage service for plan "actor-block" with 5 calls
|
||
Then the coverage actor check should return False
|
||
And the audit trail for coverage plan "actor-block" should record an actor_limit_blocked event
|
||
|
||
Scenario: Service actor tool-call check blocks at exact limit
|
||
Given a guardrail service with actor tool-call limit 3 for plan "actor-exact"
|
||
When I check actor tool calls via the coverage service for plan "actor-exact" with 3 calls
|
||
Then the coverage actor check should return False
|
||
|
||
# ---- check_retries_per_failure: no guardrails configured (line 310) ----
|
||
|
||
Scenario: Service retries check returns True for unconfigured plan
|
||
Given a fresh guardrail service for coverage
|
||
When I check retries via the coverage service for plan "no-retry-plan" with 10 retries
|
||
Then the coverage retry check should return True
|
||
|
||
# ---- check_confirmation_required: not required path (lines 371-372) ----
|
||
|
||
Scenario: Service confirmation check grants access for non-listed operation
|
||
Given a guardrail service with confirmations "deploy,delete" for plan "confirm-grant"
|
||
When I check confirmation via the coverage service for plan "confirm-grant" operation "read"
|
||
Then the coverage confirmation check should return False
|
||
And the audit trail for coverage plan "confirm-grant" should record a confirmation_granted event
|
||
|
||
# ---- record_enforcement public method (lines 404-405) ----
|
||
|
||
Scenario: Public record_enforcement persists an audit entry
|
||
Given a fresh guardrail service for coverage
|
||
When I call record_enforcement for plan "rec-plan" with a step_allowed entry
|
||
Then the audit trail for coverage plan "rec-plan" should have 1 entries
|
||
|
||
# ---- _record_enforcement_locked: creates new trail (line 517) ----
|
||
|
||
Scenario: record_enforcement creates audit trail for plan with no prior trail
|
||
Given a fresh guardrail service for coverage
|
||
When I call record_enforcement for plan "new-trail" with a budget_allowed entry
|
||
Then the audit trail for coverage plan "new-trail" should have 1 entries
|
||
And the first entry for coverage plan "new-trail" should be budget_allowed
|