A pass releases the quarantine only after the object hashes to the row
again, reads exactly ceil(N/page) SQL pages, publishes
audit.attachment_discarded reason=reconcile for the intents it drops,
is assembled by dishka with the same storage provider as the API and
ends any failure as reconcile.failed with exit code 1. The demo passes
13 of 13 checks, and the cost matrix up to 100k confirms the request
counts and the constant memory of H2 and refutes its linear time at
100k (19.6 instead of 10 +- 30 %, the RustFS listing page grows from
91 to 197 ms). student-test (348), test, persistence and failover pass
on the stand. The requirements are synced into lab4-storage-reconciler.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
Track 2 of lab 4 is closed. One reconciler pass merges the sorted bucket
listing with keyset pages of attachments by object key, finds objects
without a row, ready rows without an object or with other bytes and
abandoned intents, deletes only old objects without a row after a
second look at the row and old intents under SKIP LOCKED, and puts
damaged ready rows into a reversible quarantine instead of deleting
them. On the stand the dry-run found exactly the 22 injected
discrepancies of seven classes, apply fixed the 18 fixable ones, the
repeat did nothing, and 75 passes during 3418 uploads lost no ready
attachment. A shallow pass costs 0.105 / 1.000 / 3.729 s for 1k / 10k /
30k objects at a flat 83 MiB, 95 % of it in the RustFS listing; --deep
is 4.3-5 times dearer per object.
For the defence: make reconcile-demo shows injection, dry-run, apply,
the repeat, quarantine through the API, healing, the held lock, a
stopped S3 and the run under uploads in about four minutes; the cost
matrix is evidence/reconcile/cost/summary.txt (make reconcile-cost
repeats it on a fresh stand in about seven).
The lab4-storage-reconciler spec is added and the quarantine rule of
lab4-attachments is updated in the main specs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27