Commit graph

3 commits

Author SHA1 Message Date
maphew
cb1a0700b0 fix(linear): clean sync lock lint 2026-05-02 18:38:36 -07:00
kev
175bc23d1f fix(linear): keep lock file stable across Release cycles
Removing the lock file after unlocking creates a lifecycle race: a blocked
waiter acquires the old inode (between flock release and os.Remove), then a
third process creates a new file at the same path and locks it — both
processes believe they hold the lock.

Fix: never call os.Remove in Release(). Truncate diagnostic metadata while
still holding the flock, then release. The stable path is reused by
subsequent AcquireSyncLock calls via O_CREATE|O_RDWR.

Also:
- Handle writeLockInfo's Truncate error (was silently discarded with _ =)
- Add #nosec G304 to readLockInfo (path is program-constructed, not user input)
- Update test: assert lock file persists and is empty after Release, not removed
2026-05-02 18:55:08 -04:00
kev
989d0f9496 feat(linear): add per-workspace concurrency lock on sync
Acquires .beads/.linear-sync.lock at start of bd linear sync to
serialize concurrent invocations. Stale lock detection via PID
check. Clean release on SIGTERM via defer. Prevents duplicate
creates and conflict thrash from overlapping sync runs.
2026-05-02 01:02:55 -04:00