36c571db83
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 30s
CI / security (pull_request) Successful in 22s
CI / quality (pull_request) Successful in 16s
CI / integration_tests (pull_request) Successful in 5m12s
CI / build (pull_request) Successful in 16s
CI / lint (push) Successful in 13s
CI / typecheck (push) Successful in 29s
CI / security (push) Successful in 23s
CI / quality (push) Successful in 16s
CI / unit_tests (pull_request) Successful in 13m42s
CI / integration_tests (push) Successful in 4m53s
CI / build (push) Successful in 16s
CI / unit_tests (push) Successful in 15m9s
CI / coverage (pull_request) Successful in 7m58s
CI / coverage (push) Successful in 8m14s
CI / docker (pull_request) Successful in 9s
CI / docker (push) Successful in 8s
89 lines
5.4 KiB
Gherkin
89 lines
5.4 KiB
Gherkin
Feature: Tool lifecycle coverage boost
|
|
As the tool execution engine
|
|
I need to cover edge-case branches in ToolLifecycleCache and ToolRuntime
|
|
Including empty-cache iteration, last-tool removal, cancellation re-raise,
|
|
None-instance execution, and no-op deactivation paths
|
|
|
|
# ── ToolLifecycleCache.remove deletes plan entry when last tool removed ──
|
|
|
|
Scenario: Removing the last tool from a plan deletes the plan entry
|
|
Given I create a coverage-boost lifecycle cache
|
|
And I have a coverage-boost mock tool instance named "builtin/only-tool"
|
|
When I put the coverage-boost instance in cache for plan "plan-rm-1" and tool "builtin/only-tool"
|
|
Then the coverage-boost cache should have 1 plans
|
|
When I remove tool "builtin/only-tool" from coverage-boost cache plan "plan-rm-1"
|
|
Then the coverage-boost cache should have 0 plans
|
|
And the coverage-boost cache internal dict should not contain plan "plan-rm-1"
|
|
|
|
Scenario: Removing a tool that does not exist in cache returns None
|
|
Given I create a coverage-boost lifecycle cache
|
|
When I remove tool "builtin/ghost" from coverage-boost cache plan "plan-rm-2"
|
|
Then the coverage-boost remove result should be None
|
|
|
|
# ── ToolLifecycleCache.get_plan_tools with empty cache ──────────────────
|
|
|
|
Scenario: Getting plan tools for a plan with no activated tools returns empty list
|
|
Given I create a coverage-boost lifecycle cache
|
|
Then the coverage-boost plan tools for plan "plan-empty" should be an empty list
|
|
|
|
# ── ToolRuntime.activate with ToolCancelledError ────────────────────────
|
|
|
|
Scenario: Activating a tool that raises ToolCancelledError propagates the error
|
|
Given I create a coverage-boost tool runtime
|
|
And I register a coverage-boost cancelling-activate tool "builtin/cancel-act"
|
|
And I create a coverage-boost execution context with plan_id "plan-cancel-act"
|
|
When I try to activate the cancelling tool "builtin/cancel-act" in coverage-boost runtime
|
|
Then a ToolCancelledError should have been raised in coverage-boost activation
|
|
|
|
# ── ToolRuntime.execute with None cached instance ──────────────────────
|
|
|
|
Scenario: Executing a tool when cached instance is None raises ToolNotActivatedError
|
|
Given I create a coverage-boost tool runtime
|
|
And I register a coverage-boost tool "builtin/null-cache" with a mock that nullifies cache
|
|
And I create a coverage-boost execution context with plan_id "plan-null-cache"
|
|
When I try to execute the null-cache tool "builtin/null-cache" in coverage-boost runtime
|
|
Then a ToolNotActivatedError should have been raised in coverage-boost execution
|
|
|
|
# ── ToolRuntime.execute with ToolCancelledError during execution ────────
|
|
|
|
Scenario: Executing a tool that raises ToolCancelledError records trace and re-raises
|
|
Given I create a coverage-boost tool runtime
|
|
And I register a coverage-boost cancelling-execute tool "builtin/cancel-exec"
|
|
And I create a coverage-boost execution context with plan_id "plan-cancel-exec"
|
|
When I try to execute the cancelling-execute tool "builtin/cancel-exec" in coverage-boost runtime
|
|
Then a ToolCancelledError should have been raised in coverage-boost execution
|
|
And the coverage-boost context should have 1 traces
|
|
And the coverage-boost last trace should show success False
|
|
And the coverage-boost last trace error should be "Cancelled"
|
|
|
|
# ── ToolRuntime.deactivate with tool not in cache ──────────────────────
|
|
|
|
Scenario: Deactivating a tool that was never activated is a silent no-op
|
|
Given I create a coverage-boost tool runtime
|
|
And I register a coverage-boost read-only tool "builtin/never-active" with a mock
|
|
And I create a coverage-boost execution context with plan_id "plan-deact-none"
|
|
When I deactivate tool "builtin/never-active" in the coverage-boost runtime
|
|
Then no coverage-boost exception should have been raised
|
|
And the coverage-boost mock "builtin/never-active" should not have been deactivated
|
|
|
|
# ── ToolRuntime.deactivate_plan with empty plan ────────────────────────
|
|
|
|
Scenario: Deactivating a plan with no activated tools is a silent no-op
|
|
Given I create a coverage-boost tool runtime
|
|
And I create a coverage-boost execution context with plan_id "plan-deact-empty"
|
|
When I deactivate plan in the coverage-boost runtime
|
|
Then no coverage-boost exception should have been raised
|
|
|
|
# ── ToolLifecycleCache.remove with multiple tools leaves remaining ─────
|
|
|
|
Scenario: Removing one of two tools keeps the plan entry with the remaining tool
|
|
Given I create a coverage-boost lifecycle cache
|
|
And I have a coverage-boost mock tool instance named "builtin/tool-a"
|
|
And I have a second coverage-boost mock tool instance named "builtin/tool-b"
|
|
When I put the coverage-boost instance in cache for plan "plan-rm-multi" and tool "builtin/tool-a"
|
|
And I put the second coverage-boost instance in cache for plan "plan-rm-multi" and tool "builtin/tool-b"
|
|
Then the coverage-boost cache should have 1 plans
|
|
When I remove tool "builtin/tool-a" from coverage-boost cache plan "plan-rm-multi"
|
|
Then the coverage-boost cache should have 1 plans
|
|
And the coverage-boost cache get for plan "plan-rm-multi" and tool "builtin/tool-b" should not be None
|