Identify the retained effect

The counter already contains 5 when the retry begins. The completion receipt is missing. Applying the request again produces 10, although the declared task asks for one increment of 5. The first update survived our controlled stop; the evidence used to decide whether to repeat it did not.[4][5]

This is an original local SQLite example with invented task data. The complete task state has one integer counter and a table binding each task ID to its integer increment. A request for task-A with increment 5 should leave value 5 and one matching receipt. Receiving the same ID and increment again should add nothing. Reusing that ID with a different increment is refused under this teaching contract.[4][5]

We compared three implementations. Effect first commits the counter update and then inserts the receipt in a separate transaction. Receipt first reverses those two commits. The third implementation places the receipt lookup, counter update and receipt insert inside one explicit transaction. All three begin each main case with their own database containing zero and no receipts.[4][5]

  • Effect without receipt: The update can survive while the retry marker does not; replay then applies the same intent twice.

Compare the interruption boundaries

An authored exception after the first write exposes the difference. Effect first has committed 5 but has no receipt, so the cleanly reopened retry applies another 5. Receipt first has committed the receipt while the value is still zero, so the retry skips necessary work. Reversing two separate writes exchanges one failure for another; it does not make their state consistent.[4][5]

The transaction implementation has an uncommitted value of 5 at that same boundary. Our exception handler explicitly rolls back the live transaction before closing the connection. A new connection reads zero with no receipt, and the retry applies the pair once. The saved action log retains both the earlier uncommitted snapshot and the later clean-reopen state. They must not be presented as the same observation.[4][5]

Retain all cases and attempts

Each policy has five declared cases: stop before either write, after the first write, after the second write, after commit but before reply, and normal completion. Each first attempt is followed by one same-ID retry. Once both changes have committed, a missing reply does not cause another update in any of these implementations: the retained receipt makes the retry skip. Normal completion is also retained rather than selecting only the two failing cases.[4][5]

Across the fifteen main cases, effect first and receipt first each satisfy the final value-and-receipt contract in four of five cases; the transaction pair satisfies it in all five. These are hand-picked boundaries, not failure rates or independent recovery trials. The full result keeps all thirty main attempts, all intermediate states and every verdict.[4][5]

Thirteen further controls retain twenty-two attempts. Six scenarios cover a changed payload on one ID, equal payloads on distinct IDs, repeated requests, zero and negative increments, and a second task interrupted after the first task completed. Seven malformed requests are refused before writes. Equal payloads with different IDs are both applied; zero still needs a receipt. The input and identity rules are explicit rather than inferred from a final counter value.[4][5]

  • Receipt without effect: Reversing separate commits can make recovery skip work that never took effect.

Final counter after one same-ID retry in every authored case. Required value is 5; each final database also contains one matching task-A receipt.

PolicyBefore writesAfter first writeAfter second writeAfter commit, before replyNormal completion
Effect first510555
Receipt first50555
One transaction55555
  • Every main case starts from a separate zero-valued database. The first four columns inject an exception; normal completion does not.
  • Transaction-pair unfinished writes are explicitly rolled back before clean reopen. These are not crash or power-loss trials.

Original execution, credit and scope

The transactional principle is established practice. Malcolm Featonby’s Amazon Builders’ Library article explains why an idempotency token and its effects need an atomic relationship. SQLite documents automatic transactions and explicit BEGIN, COMMIT and ROLLBACK. Python’s sqlite3 documentation explains how isolation_level=None leaves SQL transaction control explicit. Nodus authored the fixture, policies, cut points, expectations and local experiment; it did not invent transactions or idempotency.[1][2][3][4]

Every connection records the requested and observed settings: DELETE journal mode, FULL synchronous mode, a 1000 ms busy timeout and explicit Python transaction control. Those settings describe this run. They do not establish that our experiment tested hardware persistence. We raise Python exceptions, explicitly roll back where needed, close cleanly and reopen in the same process. We kill no process, interrupt no power and test no concurrent clients or external side effect.[4][5]

The one original CPU invocation completed on November 30, 2026 (UTC), using CPython 3.9.6 and SQLite 3.51.0. All fifteen main literal expectations and thirteen selected control expectations matched. The package keeps the exact executed source, fixture, protocol, complete saved result and execution summary. Artwork and this article were prepared from those saved bytes without rerunning the experiment.[4][5][6]

For a recovery or reward-processing workflow, identify the effect and the evidence used to suppress a retry. Inspect both at each declared interruption point, then retain what the retry actually does. A receipt alone does not establish that the effect happened, and a missing receipt does not establish that it did not. This small local example supplies no general exactly-once guarantee for a distributed system.[4][5]

  • Keep the effect, its completion evidence and the retry outcome in the same recovery record.

Sources

  1. Malcolm Featonby, Amazon Builders’ Library: Making retries safe with idempotent APIs aws.amazon.com
  2. SQLite contributors: Transaction www.sqlite.org
  3. Python Software Foundation: sqlite3 controlling transactions (Python 3.9) docs.python.org
  4. MIT executable proof and complete saved result data.nodus-compute.ai
  5. Full saved result JSON data.nodus-compute.ai
  6. Original execution and saved-result provenance data.nodus-compute.ai