aboutsummaryrefslogtreecommitdiff
path: root/languages/bash/tests/validate-bash.bats
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-19 04:50:21 -0500
committerCraig Jennings <c@cjennings.net>2026-07-19 04:50:21 -0500
commita8b6cf4fba4420d8cc657604473259b5242d8c37 (patch)
tree0b9070a650bfa5253d74bd5d0caaf0f3afbd51a3 /languages/bash/tests/validate-bash.bats
parent495e36b9cc95458305d4aecdf6ba88935176c178 (diff)
downloadrulesets-a8b6cf4fba4420d8cc657604473259b5242d8c37.tar.gz
rulesets-a8b6cf4fba4420d8cc657604473259b5242d8c37.zip
feat(sentry): add agent-lock mkdir-atomic advisory lock helper
Phase 1 of the sentry supervisor workflow. sentry needs two locks: a single-runner lock so overlapping /loop fires don't stack, and a roam-write lock so agent edits to the shared roam tree serialize. flock can't serve either, because every Bash call an agent makes is its own short-lived shell, so an flock dies with the call that took it. agent-lock persists the lock on disk between calls. An atomic mkdir is the acquire. A metadata file inside records pid, host, ISO timestamp, and TTL. Staleness is age-based on the meta mtime, so a crashed holder's lock expires instead of wedging every later acquire, and every reclaim surfaces a note rather than clearing silently. refresh re-touches the mtime as a heartbeat, release is idempotent, status reports free/held/stale, path prints the resolved dir. Locks live under XDG_RUNTIME_DIR/agent-locks (tmpfs: host-local, out of every repo, cleared on reboot), with a ~/.cache fallback where no runtime dir exists. Reclaim claims the stale dir with an atomic rename before removing it, so two acquirers that both see a lock stale can't both win. A plain remove-then-mkdir would let the loser delete the winner's fresh lock and double-acquire, defeating the roam-write lock's purpose. Nothing calls it yet. 18 bats tests cover fresh win, contention, release, stale reclaim, heartbeat, path resolution, and usage errors.
Diffstat (limited to 'languages/bash/tests/validate-bash.bats')
0 files changed, 0 insertions, 0 deletions