Skip to content

[JIRA DEVA11Y-128] SPM Plugin implementation - #1

Merged
maunilm merged 1 commit into
mainfrom
DEVA11Y-128
Nov 21, 2025
Merged

[JIRA DEVA11Y-128] SPM Plugin implementation#1
maunilm merged 1 commit into
mainfrom
DEVA11Y-128

Conversation

@Crash0v3rrid3

Copy link
Copy Markdown
Collaborator

No description provided.

@Crash0v3rrid3
Crash0v3rrid3 requested a review from a team as a code owner November 20, 2025 14:27
@maunilm
maunilm merged commit ad42300 into main Nov 21, 2025
2 checks passed
Crash0v3rrid3 added a commit that referenced this pull request Jul 30, 2026
…A11Y-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>
Crash0v3rrid3 added a commit that referenced this pull request Aug 3, 2026
…ft (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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants