flowchart LR accTitle: Ten tests of the export admission contract accDescr: The supplied SQLite teaching lab records requests, jobs, outbox rows and remaining credits after each failure. Explore the four pre-commit cuts, post-commit recovery and identity cases. %% journal-retry-failure-matrix (en) %% https://www.thebsq.com/blog/prototype-to-production-checklist/ subgraph g1 ["Process termination"] %% n_fixture — Each crash case starts in a temporary database with ten credits. Reconnect after the child process terminates and count committed rows before retrying. n_fixture["Ten-credit fixture"] %% n_request — The request identity was tentatively inserted. On reconnect no claimed request, job or outbox survives and the balance remains ten. n_request["After request insert"] %% n_debit — The transaction had reduced the balance. The uncommitted debit rolls back with the identity, restoring all ten credits. n_debit["After quota debit"] %% n_job — The job row may have existed within the transaction. Reopening the database must reveal no durable job awaiting a missing dispatch. n_job["After job insert"] %% n_precommit — All four writes were staged, including outbox intent. The four observed values after restart are zero requests, zero jobs, zero outbox rows and ten credits. n_precommit["Immediately before commit"] %% n_postcommit — Restart now finds one request, one job, one outbox row and nine credits. Replaying the same key must yield the saved receipt without changing any count. n_postcommit["After commit, before reply"] end subgraph g2 ["Identity and quota"] %% n_concurrent — Eight callers submit one key and payload. SQLite serializes writers in this fixture. All eight must converge on one receipt, one job and one debit. n_concurrent["Eight equal callers"] %% n_changed — After a prior acceptance, changing the normalized input with the original key must produce a mismatch and leave that acceptance untouched. n_changed["Same key, new snapshot"] %% n_tenant — Each namespace gets an independent job and balance. This teaching case exercises key scoping. Production authorization requires its own checks. n_tenant["Same key, different tenant"] %% n_newkey — A fresh key represents deliberate new work. An identical payload can produce another accepted job and another debit when there is credit. n_newkey["Same input, new key"] %% n_empty — The zero-credit fixture rejects admission. No partial request, job or outbox may survive. Retrying alone cannot fund an export. n_empty["Exhausted balance"] end subgraph g3 ["Evaluate the guarantee"] %% n_recover — Retry after a pre-commit crash. The expected durable tuple is now one request, one job, one outbox and nine credits, all representing the same intent. n_recover["Perform one admission"] %% n_inspect — Compare the receipt and the four state values with the prediction for this case. A successful HTTP status alone cannot establish the debit and dispatch invariant. n_inspect["Compare durable state"] %% n_limits — Single-writer SQLite results apply to this fixture. Lock timeouts, lost commit acknowledgements and failover must be examined against the production engine and its isolation rules. n_limits["Move the test to the real adapter"] end n_fixture -->|"Stop after the first write"| n_request n_fixture -->|"Stop with an uncommitted debit"| n_debit n_fixture -->|"Stop with an uncommitted job"| n_job n_fixture -->|"Stop after staging the outbox"| n_precommit n_fixture -->|"Stop after durable acceptance"| n_postcommit n_fixture -->|"Submit matching intents together"| n_concurrent n_fixture -->|"Resubmit a changed snapshot"| n_changed n_fixture -->|"Change the tenant namespace"| n_tenant n_fixture -->|"Express another intent"| n_newkey n_fixture -->|"Set initial credit to zero"| n_empty n_request -->|"Verify rollback, then retry K"| n_recover n_debit -->|"Verify rollback, then retry K"| n_recover n_job -->|"Verify rollback, then retry K"| n_recover n_precommit -->|"Verify rollback, then retry K"| n_recover n_postcommit -->|"Replay the existing receipt"| n_inspect n_recover -->|"Assert one accepted job"| n_inspect n_concurrent -->|"Compare all eight receipts"| n_inspect n_changed -->|"Assert unchanged state"| n_inspect n_tenant -->|"Check both independent balances"| n_inspect n_newkey -->|"Assert a second accepted job"| n_inspect n_empty -->|"Assert zero partial records"| n_inspect n_inspect -->|"Carry the assertions into the target engine"| n_limits %% Crash after the debit — n_fixture → n_debit → n_recover → n_inspect → n_limits %% Crash after commit — n_fixture → n_postcommit → n_inspect → n_limits %% Competing callers — n_fixture → n_concurrent → n_inspect → n_limits