You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(spm): serialize concurrent scans to protect synthetic Package.swift (DEVA11Y-483) (#33)
* fix(spm): serialize concurrent scans to protect synthetic Package.swift (DEVA11Y-483)
Guard the setup/scan/cleanup cycle with an atomic per-directory mkdir lock so
concurrent spm.sh invocations in the same working directory no longer race: the
first instance to exit can no longer delete the shared synthetic Package.swift
out from under a still-running peer. Stale locks left by killed peers are
reclaimed after 5 minutes; mkdir is used instead of flock(1) for macOS
portability. Applied to the bash, zsh and fish variants.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(spm): redesign concurrency lock to fully close the scan race (DEVA11Y-483)
Addresses all code-review findings on the first cut:
- #1 Decide manifest ownership UNDER the lock from the live filesystem, not a
startup PACKAGE_EXISTS snapshot. The lock is now taken unconditionally, so a
peer that starts after the synthetic Package.swift already exists still
serializes instead of running unprotected and getting its file deleted.
- #2 Reclaim a crashed peer's lock by PID liveness (kill -0), not a 5-min mtime
that would steal a slow-but-alive long scan's lock.
- #3 Claim a stale lock atomically via rename so two waiters can't both reclaim.
- #4 Wait-timeout is non-fatal: it skips the scan (exit 0) with a visible
'waiting...'/'skipping' notice instead of hanging a git commit then aborting it.
- #5 A non-EEXIST mkdir failure (unwritable/read-only/full TMPDIR) fails fast
with an actionable message instead of waiting out the full timeout.
- #6 The lock lives under TMPDIR keyed by the package path, never inside the
working tree, so a crash can't leave it to be git-added.
- #7 Consistent 'A11y scan:' message prefix.
- Also fixes a latent bug from the first cut: cleanup state (lock_dir/have_lock/
created_package) is now global, since the EXIT trap fires after a11y_scan
returns when its locals are out of scope (verified) -- previously the lock was
never released on a normal run.
Verified with an integration test (staggered concurrent runs serialize; both
scans see Package.swift throughout; no tree/TMPDIR residue) and unit tests for
stale reclaim, live-owner detection, and fail-fast. Applied to bash/zsh/fish.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(review): regenerate spm.sh checksum sidecars after lock redesign (DEVA11Y-483)
The concurrency-lock redesign edited all three spm.sh launchers but left their
.sha256 sidecars stale, which would make the self-update integrity check abort
on every run (dead on arrival, same class as the DEVA11Y-475 fix). Regenerate
all three sidecars to match.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments