0184. Guard source publication and scaffold rollback
- Status: Accepted
- Date: 2026-11-08
- Plan: M16.6
Amends the publication portion of ADR-0049. Stage, write and sync complete candidate files before replacing original names. Lock opened containing directories in a stable order for cooperating Harness source writers. Check contents and identity before publication. Exchange the candidate and live file on the same filesystem, then check the displaced version. Rollback applies the same ownership checks and preserves conflicts. Report any retained version by its recovery path. A source edit batch has ordered per-file publication and guarded rollback. It has no cross-file crash transaction.
Scaffolding publishes new entries exclusively. On failure capture an entry before removing it and check it again, removing only owned files and empty owned directories. Restore a foreign entry without overwriting a newer one. Name any entry retained in recovery. Process interruption can leave private staging; inspect recovery content before removing it.
Exchange retains the entry that wins an external name race. An ordinary preflight followed by rename would overwrite that entry. External editors do not participate in Harness locks. Concurrent writes through retained descriptors after the final check, and deliberate mutation of invocation-private staging, are outside the ownership contract. A filesystem without the required exchange or exclusive-rename operation rejects publication.