Skip to content

Store commit-failure fakes raise inside the transaction body instead of at commit #1559

Open

Description

@doublewhy

Problem

Two tests that claim to cover a failed store commit raise OSError("commit failed") inside the transaction body (dev a4357f9a):

  • test_failed_atomic_control_commit_exposes_no_partial_transition (implementations/python/tests/test_run_310_supervisory_lifecycle.py:847-876) wraps _upsert_record and raises at :872. record_participant_control claims a running record (raes_runtime/participant_control_mediation.py:112) before it calls _commit_control_transition (:115), so the first _upsert_record call is the claim, and the test never reaches the atomic control commit it names.
  • test_local_control_plane_store_rolls_back_snapshot_transaction_failure (implementations/python/tests/test_runtime_control_plane_api.py:1864-1887) wraps _upsert_snapshot and raises at :1878. It saves an empty RuntimeSnapshot(), which equals the default snapshot, so even a committed write would pass.

An error raised in the body takes the rollback branch of transaction() (raes_runtime/control_plane_store_local_codec.py:13-24). A real commit failure is a sqlite3 error raised by commit(): transaction() re-raises it without a rollback, and _connection() (raes_runtime/control_plane_store_local.py:357-362) closes the connection, which discards the open transaction. The audit observed this on SQLite 3.50.4 with a deferred foreign key: commit() raised sqlite3.IntegrityError, and nothing persisted after close().

The #1344 fixture-provenance audit lists this as finding ST-2, open, in the record #1461 proposes. The fix changes only tests, and #1472 proposes it.

Scope

  • Make both fakes fail at SQLite's own COMMIT (for example through a deferred foreign-key violation in the open transaction) after the writes each test names, and assert on state that a committed write would change.

Done when

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions