mirror of
https://github.com/safishamsi/graphify.git
synced 2026-07-13 10:57:13 +00:00
2c975ee9fb
The rebuild lock file accumulated concatenated PIDs across post-commit rebuilds without a separator, and was never removed when the rebuild finished. Two practical consequences for users: 1. Downstream tooling that polls for `.rebuild.lock` to disappear before doing post-rebuild work (publish scripts copying graph.html to a web root, etc.) blocked forever / until its own timeout. 2. The accumulated digit string could not be parsed by humans or tooling to find the owning PID. The `_rebuild_lock` context manager now: - Opens the lock file with `a+` so a non-acquiring caller does not truncate the existing holder's PID. - After flock acquisition, truncates and writes a single `<pid>\n` line so external readers can `kill -0 $(cat .rebuild.lock)` to check liveness. - Unlinks the lock file in the finally block (only when *we* held the lock), restoring the "signal-by-absence" convention users rely on. Four regression tests added under `tests/test_watch.py` covering the PID-with-newline payload, post-release unlink, no-accumulation across sequential acquisitions, and the non-blocking-caller-does-not-clobber invariant. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>