Files
cleveragents-core/features/sandbox_protocol_coverage_boost.feature

99 lines
4.6 KiB
Gherkin
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Feature: Sandbox protocol coverage boost
Exercise uncovered lines in infrastructure/sandbox/protocol.py including
SandboxStatus.assert_transition error path and Sandbox Protocol default stubs.
# ---------------------------------------------------------------
# SandboxStatus.assert_transition invalid transition raises error
# Covers lines 121-123
# ---------------------------------------------------------------
Scenario: assert_transition raises SandboxStateError for invalid transition
Given spcb sandbox status "cleaned_up" and target status "active"
When spcb assert_transition is called with those statuses
Then spcb a SandboxStateError should be raised
And spcb the error message should contain "cleaned_up -> active"
Scenario: assert_transition raises SandboxStateError for pending to committed
Given spcb sandbox status "pending" and target status "committed"
When spcb assert_transition is called with those statuses
Then spcb a SandboxStateError should be raised
And spcb the error message should contain "pending -> committed"
Scenario: assert_transition raises SandboxStateError for committed to active
Given spcb sandbox status "committed" and target status "active"
When spcb assert_transition is called with those statuses
Then spcb a SandboxStateError should be raised
And spcb the error message should contain "committed -> active"
Scenario: assert_transition succeeds for valid pending to created transition
Given spcb sandbox status "pending" and target status "created"
When spcb assert_transition is called with those statuses
Then spcb no exception should be raised
# ---------------------------------------------------------------
# Sandbox Protocol default property/method stubs
# Covers lines 223, 228, 233, 248, 263, 278, 290, 301
# ---------------------------------------------------------------
Scenario: Protocol sandbox_id default stub returns None
Given spcb a bare Sandbox protocol subclass instance
When spcb the sandbox_id property is accessed
Then spcb the result should be None
Scenario: Protocol status default stub returns None
Given spcb a bare Sandbox protocol subclass instance
When spcb the status property is accessed
Then spcb the result should be None
Scenario: Protocol context default stub returns None
Given spcb a bare Sandbox protocol subclass instance
When spcb the context property is accessed
Then spcb the result should be None
Scenario: Protocol create default stub returns None
Given spcb a bare Sandbox protocol subclass instance
When spcb the create method is called with plan_id "test-plan"
Then spcb the result should be None
Scenario: Protocol get_path default stub returns None
Given spcb a bare Sandbox protocol subclass instance
When spcb the get_path method is called with path "src/main.py"
Then spcb the result should be None
Scenario: Protocol commit default stub returns None
Given spcb a bare Sandbox protocol subclass instance
When spcb the commit method is called with message "test commit"
Then spcb the result should be None
Scenario: Protocol rollback default stub returns None
Given spcb a bare Sandbox protocol subclass instance
When spcb the rollback method is called
Then spcb the result should be None
Scenario: Protocol cleanup default stub returns None
Given spcb a bare Sandbox protocol subclass instance
When spcb the cleanup method is called
Then spcb the result should be None
# ---------------------------------------------------------------
# Additional assert_transition edge cases for branch coverage
# ---------------------------------------------------------------
Scenario: assert_transition raises for every terminal-state outbound attempt
Given spcb sandbox status "cleaned_up" and target status "pending"
When spcb assert_transition is called with those statuses
Then spcb a SandboxStateError should be raised
And spcb the error message should contain "cleaned_up -> pending"
Scenario: assert_transition raises for errored to active
Given spcb sandbox status "errored" and target status "active"
When spcb assert_transition is called with those statuses
Then spcb a SandboxStateError should be raised
And spcb the error message should contain "errored -> active"
Scenario: assert_transition raises for rolled_back to committed
Given spcb sandbox status "rolled_back" and target status "committed"
When spcb assert_transition is called with those statuses
Then spcb a SandboxStateError should be raised
And spcb the error message should contain "rolled_back -> committed"