DR original Problem Management transaction lab, 2026-10-04

Run from project root, standard library only:
python3 content/labs/problem-transactions/run.py --output /tmp/dr-problem-transactions.json
Output must be a new filename. No network, credentials or platform database access.
Three separate connections to a private temporary SQLite file with invented data.
Explicit LEGACY_TRANSACTION_CONTROL plus isolation_level=None, explicit SQL BEGIN,
COMMIT and ROLLBACK. WAL confirmed; automatic checkpointing disabled only to control
this exercise. timeout=0 exposes contention without a performance measurement.
Recorded CPython 3.13.1, SQLite 3.51.2, Darwin arm64. Python rolling 3.13 docs currently
label 3.13.16; that source label is not the executed interpreter version.

Fifteen groups passed twice. Require exit 0, passed=15, failed=0, failure=null and
matching scriptSha256. Read trace for exact statements, parameters, results and
extended errors. Compare checks from your execution; page counts in checkpoint
trace are observations of this fixture, not a universal configuration guarantee.

A pending change 10->20 is visible to its writer but not another connection.
A competing BEGIN IMMEDIATE fails with SQLITE_BUSY (5). Rollback releases the
writer position; the next writer commits 30. A reader of 30 remains at 30 after
another connection commits 40. Two UPDATE attempts in that same old transaction
fail with SQLITE_BUSY_SNAPSHOT (517). A new transaction rereads 40 and the fictional
authorized add-ten intent produces committed 50. Early writer reservation excludes
another writer while a separate reader can still read committed 50.

A change to 60 remains pending after an INSERT violates UNIQUE under default ABORT;
the other connection still reads 50. Explicit rollback removes the pending change.
The OR ROLLBACK variant instead ends the transaction on the same constraint error.
A reader at 50 remains active while writes commit 51,52,53. PASSIVE status=0 can
coexist with incomplete checkpointing. After the reader ends, TRUNCATE returns
[0,0,0] and a fresh read still observes 53. All connections close and the owned
temporary directory is removed. No manual WAL deletion is performed or recommended.

These are actual SQLite transaction interleavings with controlled single-thread
ordering, not parallel query throughput. No pool in this new lab; the historical
asyncio pool and sequential counter examples remain separate. No Oracle, Java/JDBC,
remote database, external business effects, production incident, benchmark, power
failure or crash recovery is executed. Retrying current-value addition is a fictional
contract, not permission to replay arbitrary banking decisions. Review the actual
engine, driver, transaction manager, authorization and business contract for a target.
Teaching code is not a production-ready transaction library. No human workshop or
independent specialist review is claimed. See worksheet.txt for proposed practice.
