From 8d0e5a3707241473a48c04fa7a5525bc49b92f5a Mon Sep 17 00:00:00 2001 From: David Christensen Date: Thu, 29 Oct 2026 13:44:45 -0400 Subject: [PATCH 1/2] fix(test): make claim-test stub CAS independent of mkdir Ubuntu 26.04 runners ship uutils mkdir 0.8.0, which checks for the leaf and then creates it, so two racing creates both succeeded and the simultaneous-claims rounds failed with exits 0:0. The stub gh now claims a label with bash's noclobber redirect, an O_EXCL open of its description file, and a racy mkdir shim on the test PATH makes any regression to a mkdir CAS fail on every host. Closes #480 --- .claude-plugin/plugin.json | 2 +- tests/fixtures/quest-log/claim-test.sh | 39 ++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index bc959efc..4754341b 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "adept", - "version": "7.12.3", + "version": "7.12.4", "icon": "docs/assets/adept-logo-grimoire.png", "description": "Development-workflow skills: design, TDD, adversarial review, shipping, and campaign orchestration for Claude Code and Codex.", "author": { diff --git a/tests/fixtures/quest-log/claim-test.sh b/tests/fixtures/quest-log/claim-test.sh index 18e37274..22fbd938 100755 --- a/tests/fixtures/quest-log/claim-test.sh +++ b/tests/fixtures/quest-log/claim-test.sh @@ -3,8 +3,9 @@ set -euo pipefail # Adversarial suite for the quest-claim tracker operations. A stateful stub # gh stands in for GitHub: its label store is a fixture directory where -# create is mkdir -- atomic, failing on existence, the fixture's stand-in -# for the server-side unique-name constraint ADR 0018 probes live. +# create is an exclusive file create -- atomic, failing on existence, the +# fixture's stand-in for the server-side unique-name constraint ADR 0018 +# probes live. unset RIPGREP_CONFIG_PATH script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P) @@ -25,8 +26,10 @@ chmod +x "$assets/tracker.sh" tracker="$assets/tracker.sh" # --- stub gh --------------------------------------------------------------- -# The store is $GH_STORE//description. mkdir is the CAS. All -# claim ops go through it, so concurrent cases exercise real interleavings. +# The store is $GH_STORE//description. The CAS is bash's +# noclobber redirect, an O_EXCL open of description, not mkdir: no coreutils +# behaviour can weaken it. All claim ops go through it, so concurrent cases +# exercise real interleavings. mkdir -p "$sandbox/bin" cat >"$sandbox/bin/gh" <<'FAKE_GH' #!/usr/bin/env bash @@ -60,9 +63,11 @@ if [[ $1 == label && $2 == create ]]; then exit 1 ;; esac - mkdir -p "$GH_STORE/quest-claim" - if mkdir "$GH_STORE/$name" 2>/dev/null; then + mkdir -p "$GH_STORE/$name" + if ( + set -C printf '%s' "$desc" >"$GH_STORE/$name/description" + ) 2>/dev/null; then printf 'Created label %s\n' "$name" exit 0 fi @@ -118,6 +123,28 @@ exit 1 FAKE_GH chmod +x "$sandbox/bin/gh" +# --- racy mkdir -------------------------------------------------------------- +# uutils mkdir 0.8.0 (Ubuntu 26.04) checks for the leaf and then creates it, so +# two racing calls both succeed. This shim widens that window on every host: +# a CAS that leans on mkdir fails the concurrent rounds below deterministically +# instead of only on that one userland. +REAL_MKDIR=$(command -v mkdir) +export REAL_MKDIR +cat >"$sandbox/bin/mkdir" <<'RACY_MKDIR' +#!/usr/bin/env bash +set -euo pipefail +[[ $1 == -p ]] && exec "$REAL_MKDIR" "$@" +for dir; do + [[ ! -e $dir ]] || { + printf 'mkdir: %s: File exists\n' "$dir" >&2 + exit 1 + } +done +sleep 0.2 +exec "$REAL_MKDIR" -p "$@" +RACY_MKDIR +chmod +x "$sandbox/bin/mkdir" + assert_exit() { local expected=$1 actual=$2 label=$3 [[ $actual == "$expected" ]] || From 915ae4b411e64e69eeb86ef574d1849e12be3fcf Mon Sep 17 00:00:00 2001 From: David Christensen Date: Thu, 29 Oct 2026 13:50:34 -0400 Subject: [PATCH 2/2] docs(test): narrow claim-test CAS and shim comments to what they hold --- tests/fixtures/quest-log/claim-test.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/fixtures/quest-log/claim-test.sh b/tests/fixtures/quest-log/claim-test.sh index 22fbd938..2530deef 100755 --- a/tests/fixtures/quest-log/claim-test.sh +++ b/tests/fixtures/quest-log/claim-test.sh @@ -27,9 +27,9 @@ tracker="$assets/tracker.sh" # --- stub gh --------------------------------------------------------------- # The store is $GH_STORE//description. The CAS is bash's -# noclobber redirect, an O_EXCL open of description, not mkdir: no coreutils -# behaviour can weaken it. All claim ops go through it, so concurrent cases -# exercise real interleavings. +# noclobber redirect, an O_EXCL open of description; mkdir -p only makes its +# directory, so mkdir's own atomicity no longer decides a race. All claim ops +# go through it, so concurrent cases exercise real interleavings. mkdir -p "$sandbox/bin" cat >"$sandbox/bin/gh" <<'FAKE_GH' #!/usr/bin/env bash @@ -125,9 +125,9 @@ chmod +x "$sandbox/bin/gh" # --- racy mkdir -------------------------------------------------------------- # uutils mkdir 0.8.0 (Ubuntu 26.04) checks for the leaf and then creates it, so -# two racing calls both succeed. This shim widens that window on every host: -# a CAS that leans on mkdir fails the concurrent rounds below deterministically -# instead of only on that one userland. +# two racing calls both succeed. This shim widens that window on every host, +# so a CAS that leans on mkdir reliably fails the simultaneous-claims rounds +# below instead of only on that one userland. REAL_MKDIR=$(command -v mkdir) export REAL_MKDIR cat >"$sandbox/bin/mkdir" <<'RACY_MKDIR'