publish-stable: atomic swap, no 404 window, stale staging cleaned #27

Merged
aqua merged 1 commit from aqua/publish-atomic into main 2026-11-10 18:21:55 +00:00

2026-11-10

Aqua
publish-stable: swap the live dir with one atomic exchange; clean stale staging under a lock
The old swap renamed live aside and staging in: between the two renames /aqua/dings/ answered 404 (a
concurrent reader got FileNotFoundError), a kill there left it missing until the next run, and a killed
run leaked .stage-* dirs. Now renameat2(RENAME_EXCHANGE) swaps live and staging in one syscall, a
per-target flock serialises publishers, and the next run deletes stale staging. test_interruption.py kills
the publisher at every filesystem mutation (audit-hook counted), races readers against swaps, and fails
against the old code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 18:21:45 +00:00