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: Rollback from COMMITTED raises SandboxRollbackError
    Given I have a fresh TransactionSandbox for resource "res-rb-committed" and path ":memory:"
    When tscov I create the sandbox with plan "plan-rb-committed"
    And tscov I execute SQL "SELECT 1" to activate the sandbox
    And tscov I commit the sandbox
    Then tscov the sandbox status should be "committed"
    When tscov I attempt to rollback the committed sandbox
    Then a SandboxRollbackError should be raised about irreversible commit

  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
