Files
cleveragents-core/features/transaction_sandbox_coverage.feature
freemo 051ee7c290 test(coverage): add Behave BDD tests to improve coverage across 52 source files
Added 52 new .feature files and corresponding _steps.py files targeting
previously uncovered code paths in the following areas:

- TUI layer: app, commands, persona (state/schema/registry), widgets,
  input (shell_exec, reference_parser)
- Application services: plan lifecycle/service/executor, session,
  project, repo indexing, correction, checkpoint, actor, llm_actors,
  strategy coordinator, resource file watcher, service retry wiring
- CLI commands: session, resource, repl, plan, db, automation_profile
- Domain models: retry_policy, resource_type, cost_budget,
  docker_compose_analyzer, detail_level, _sql_string_aware,
  _postgresql_helpers
- Core: circuit_breaker, retry_service_patterns
- Infrastructure: repositories, transaction_sandbox, strategy_registry,
  plugins/loader, container
- Config: settings
- Agents: plan_generation, context_analysis, auto_debug
- A2A: facade

All new tests follow the Behave/Gherkin BDD standard. Resolved step
definition collisions with unique prefixes. Fixed Alembic fileConfig
logger disabling issue (disable_existing_loggers=False).

ISSUES CLOSED: #1068
2026-03-20 21:22:10 +00:00

44 lines
2.1 KiB
Gherkin

Feature: Transaction Sandbox Coverage
Additional scenarios that exercise previously uncovered code paths
in the TransactionSandbox module (lines 102, 112, 147-151, 237-241,
282-286, 366).
Background:
Given the transaction sandbox module is imported
Scenario: Accessing sandbox_id returns a valid ULID string
Given I have a fresh TransactionSandbox for resource "res-1" and path ":memory:"
When I access the sandbox_id property
Then the sandbox_id should be a non-empty string
Scenario: Context is None before creation and populated after creation
Given I have a fresh TransactionSandbox for resource "res-2" and path ":memory:"
When I access the context property before calling create
Then the context should be None
When tscov I create the sandbox with plan "plan-ctx"
And I access the context property after calling create
Then the context should contain plan id "plan-ctx"
Scenario: Creating sandbox with a database error raises SandboxCreationError
Given I have a TransactionSandbox whose connection will fail during create
When I attempt to create the failing sandbox with plan "plan-fail"
Then a SandboxCreationError should be raised
And the sandbox status should be errored
Scenario: Commit raises SandboxCommitError when COMMIT SQL fails
Given I have an active TransactionSandbox with a connection that fails on COMMIT
When I attempt to commit the sandbox
Then a SandboxCommitError should be raised
And the sandbox status should be errored
Scenario: Rollback raises SandboxRollbackError when ROLLBACK SQL fails
Given I have an active TransactionSandbox with a connection that fails on ROLLBACK
When I attempt to rollback the sandbox
Then a SandboxRollbackError should be raised
And the sandbox status should be errored
Scenario: Execute raises SandboxStateError when connection is None
Given I have a TransactionSandbox in active state with no database connection
When I attempt to execute SQL "SELECT 1" on the sandbox
Then a SandboxStateError about missing connection should be raised