- health 'mode' took the 30 s flock and mkdir'd the state dir; a held lock gave an empty
answer, which sync (OFF) read as 'not off' and reverted from the newest backup. mode is
now read-only and lock-free.
- apply's rewrite() truncated repo files in place and revert used cp -a over the file;
both now write a temp file and rename(2), so a concurrent dnf never sees half a file.
- apply/revert take the same lock as the health timer so a health run cannot rewrite
repo files while they edit them.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6