Expand description
File-based lock to prevent concurrent devflow advance invocations for
the same phase.
Creates .devflow/lock-{phase:02} with the PID of the lock holder.
Uses O_EXCL for atomic acquisition — if the file already exists,
the lock is contended.
The lock is scoped per-phase (not per-project): advance() holds it
across a gate’s multi-day blocking wait, and every phase run ends at a
mandatory Ship gate, so a project-wide lock would starve devflow parallel’s sibling phases with no retry (CR-03, 13-REVIEW.md).
Structs§
- Lock
Guard - Guard that releases the lock file on drop.
Enums§
- Lock
Error - Errors produced by lock operations.
Functions§
- acquire
- Acquire an exclusive lock for the given project root and phase.
- acquire_
project - Acquire the short-held, project-wide lock that serializes mutations of the primary checkout (version-bump commits/tags, docs commits, branch integration/cleanup) across concurrently finishing phases (13-DEFERRED-CR-03 fix shape #3).
- acquire_
project_ blocking - Blocking variant of
acquire_project: waits out a sibling phase’s short critical section, polling with backoff up totimeout. Returns the lastContendederror if the sibling still holds the lock at the deadline — aftertimeoutof waiting the holder is more likely wedged than slow, and failing loudly beats mutating the checkout concurrently. - holder
- Check whether a lock is currently held for this project/phase, returning the PID of the holder if the file exists.
- remove_
stale_ locks - Remove this project’s per-phase lock files, skipping any whose recorded
holder PID is still alive — deleting a live holder’s lock would let a
duplicate
advanceacquire it, after which the original holder’sLockGuard::Dropdeletes the NEW holder’s file.