fix(orders): call the order-verbs by absolute path, not bare PATH names

board.sh's --dispatch --order-id thin starter told a dispatched session
to run `coord-order-claim <id>` / `coord-order-done <id> ...` literally.
Neither is on PATH, so step one was command-not-found - easy to misread
as "the order does not exist" (Verifiseringsloven ansikt 4).

Measuring the denominator beyond the one line the order named found the
same defect in two more emitters that hand a session its own next-step
text: coord-order-inbox.sh's SessionStart injection (every pending/claimed
order, not only dispatched ones) and coord-order-claim.sh's own WHEN DONE
/ IF YOU CANNOT lines. All three now call the verb via $SELFDIR (derived
from $0's directory, correct at emission time), and board.sh's interpolation
of it is shell-clean-guarded like the other two values sharing its
double-quoted position - reachability proven with a copy of board.sh run
from a space-containing path, not asserted.

board-selftest 239->246, orders-selftest 99->104. CLAUDE.md counts and a
new F-paragraph updated to match.

ORDRE 20260817T213139Z-643032142-from-.claude

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019syEQHvw2jf1dTR4bUPKRG
This commit is contained in:
Kjell Tore Guttormsen 2026-08-18 09:16:59 +02:00
commit 393499c3ee
6 changed files with 130 additions and 11 deletions

View file

@ -1820,6 +1820,43 @@ printf '%s\n' "$d11" | grep -q "^paste=claude .*\"\$(cat $DSP)\""; check "dispat
printf '%s\n' "$d11" | grep -qi 'exit'; check "dispatch: paste-only says the existing session must be exited first" $?
printf '%s\n' "$d11" | grep -q 'plan_drop_open'; check "dispatch: paste-only names the filter that made this form necessary" $?
# --- The --order-id thin starter must call the verbs by an executable path ---
# ORDRE 65 (.claude, 2026-08-17): the starter text told a dispatched session to
# run `coord-order-claim <id>` and `coord-order-done <id> ...` as bare command
# names. Neither is on PATH (only coord-send.sh/coord-inbox.sh/coord-done.sh
# have ever been documented as bare names, and only in prose a human reads -
# this string lands in argv and a SESSION executes it literally). The absolute
# path is derived from where board.sh itself is running FROM ($0's directory,
# the same $SELFDIR variable ROUTE already uses), not a literal "0.27.0" - so
# it is correct at EMISSION time for whichever cache path is actually live
# then. It does not survive a version bump landing between generation and
# paste - a plan-file form held across a release can still go stale.
mkdir -p "$CLAUDE_COORD_DIR/repo-a/orders"
echo "order body" > "$CLAUDE_COORD_DIR/repo-a/orders/testorder1.md"
d12="$("$BOARD" --roots "$ROOT" --dispatch --repo repo-a --order-id testorder1 --target-pane no $DSPTRAITS 2>/dev/null)"; rc=$?
[ "$rc" -eq 0 ]; check "dispatch --order-id: exits 0 for a pending order" $?
# Anchored to `bash /` (not just `/scripts/...`) so a RELATIVE path (which
# would also contain the substring "/scripts/coord-order-claim.sh") cannot
# pass this check - the property being tested is "absolute", not "has slashes".
printf '%s\n' "$d12" | grep -Eq 'command=.*bash /.*/scripts/coord-order-claim\.sh testorder1'; check "dispatch --order-id: starter calls coord-order-claim.sh by an ABSOLUTE script path, not a bare PATH name" $?
printf '%s\n' "$d12" | grep -Eq 'command=.*bash /.*/scripts/coord-order-done\.sh testorder1 --commit'; check "dispatch --order-id: starter calls coord-order-done.sh by an ABSOLUTE script path, not a bare PATH name" $?
printf '%s\n' "$d12" | grep -Eq '(^|[^./])coord-order-claim testorder1'; [ $? -ne 0 ]; check "dispatch --order-id: no bare, un-pathed coord-order-claim invocation survives in the starter" $?
printf '%s\n' "$d12" | grep -Eq '(^|[^./])coord-order-done testorder1'; [ $? -ne 0 ]; check "dispatch --order-id: no bare, un-pathed coord-order-done invocation survives in the starter" $?
# --- The $SELFDIR interpolation is shell-clean-guarded like $D_PROMPT/$D_ORDER ---
# It is install-location-derived, not operator input, but it lands in the
# EXACT SAME double-quoted position in $d_full as those two - so a mis-
# installed path containing a space would silently break the pasted command
# the same way an unchecked --prompt-file would. Verified REACHABLE (not
# speculative): copy board.sh + route.sh into a directory whose path contains
# a space and invoke the COPY, so $0's own directory is genuinely unclean.
SPACEDIR="$ROOT/dir with space/scripts"
mkdir -p "$SPACEDIR"
cp "$BOARD" "$DIR/route.sh" "$SPACEDIR/" && chmod +x "$SPACEDIR/board.sh" "$SPACEDIR/route.sh"
d12b="$("$SPACEDIR/board.sh" --roots "$ROOT" --dispatch --repo repo-a --order-id testorder1 --target-pane no $DSPTRAITS 2>&1)"; rc=$?
[ "$rc" -eq 2 ]; check "dispatch --order-id: refuses when board.sh's OWN directory is not shell-clean (a mis-installed path with a space)" $?
printf '%s' "$d12b" | grep -q 'command='; [ $? -ne 0 ]; check "dispatch --order-id: emits no command when its own directory is not shell-clean" $?
/bin/rm -rf "$ROOT/dir with space" 2>/dev/null
# --- 19. The dispatch skill's own engine line ------------------------------