feat(board): FLY column and free-capacity lines, no process inspection

ORDRE counted pending orders only, so a repo with one order in flight and a
repo with no orders at all both printed 0 - the same digit for two opposite
facts. Measured 2026-08-23: two panes stood open and idle for 45 hours holding
finished orders, with full quota authorised, and no column on the board
reported it.

FLY counts orders/claimed/ - the same queue in its other state, never summed
with ORDRE and never a fourth axis. It does NOT mean a session is alive:
nothing un-claims an order when the claiming session dies, and one order on
the live mailbox had been claimed for 117 hours. The legend denies the
liveness reading in those words, pinned as a check on the legend text.

--plan now names free capacity as ledig_antall=N plus one ledig=<repo>
(<status>) line per repo with nothing owed, no pending order, nothing in
flight, a clean tree, at done or deferred. All four conditions are required:
measured on the real tree, 4 of 17 done/deferred repos were not free. Lines,
never blocks - the plan's second consumer discards a block with no tab=, so a
block would be visible to the operator and invisible to the driver.

Process inspection was considered and refused; the selftest asserts the
absence of pgrep/pkill/lsof structurally with a known-positive control. The
full argument, and the gap left open, are in
docs/2026-08-23-free-capacity-investigation.md.

board-selftest: 259 -> 281 checks, all green. npm test 11/11.

Order 20260823T162951Z-941745020-from-.claude

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hfbfr8ERC63kuAfWeHYHQb
This commit is contained in:
Kjell Tore Guttormsen 2026-08-23 19:07:00 +02:00
commit 3beef2a603
12 changed files with 532 additions and 25 deletions

View file

@ -2141,6 +2141,148 @@ check "--brief recovers the command too (route_cmd_for has one reader)" $?
/bin/rm -rf "$RG_ROOT" 2>/dev/null
# --- 24. FLY (claimed orders) and --plan's free-capacity reading ------------
# Order 20260823T162951Z (.claude, 2026-08-23): ORDRE counted PENDING orders
# only, so a repo with one order IN FLIGHT and a repo with no orders at all
# both printed 0 - the same digit for two opposite facts ("work is happening
# here" vs "nothing is waiting here"). Measured on the live tree the day the
# order was written: two tabs stood open and idle for 45 hours holding
# finished orders while no column on the board reported it.
#
# FLY is NOT a fourth axis and never claims a session is alive. It counts
# files in orders/claimed/ - the same order queue ORDRE already reads, in its
# other state. Measured counter-example, live mailbox 2026-08-23: wiki-advise
# held an order claimed for 117 hours. A claim is evidence that a session took
# the order, never proof one is still working it, and the legend says so.
FLY_ROOT="$(mktemp -d)"
mkfly() { # name status
mkrepo "$FLY_ROOT/$1"
{
echo "# STATE - $1"
echo ""
printf '## %s NESTE\n' "$HAND"
echo "<!-- board: status=$2; blocked-on=-; next-cost=Sonnet 5/high -->"
echo "<!-- route: path=known; verification=strong; reversibility=cheap; scope=local; rationale=x -->"
echo "Next step for $1."
} > "$FLY_ROOT/$1/STATE.md"
# COMMITTED, deliberately: `mkrepo` alone leaves STATE.md untracked, so every
# fixture repo would read DRT=1 - which silently satisfied the FLY column
# assertions below before the column existed (the regex matched DRT's 1 where
# it expected FLY's), and would make every repo permanently un-free under the
# clean-tree condition. A dirty fixture is created explicitly where one is
# wanted, never inherited.
git -C "$FLY_ROOT/$1" add -A >/dev/null 2>&1
git -C "$FLY_ROOT/$1" -c user.email=t@t -c user.name=t commit -qm init >/dev/null 2>&1
}
mkorder() { # mailbox state(pending|claimed) id
mkdir -p "$CLAUDE_COORD_DIR/$1/orders/claimed"
if [ "$2" = claimed ]; then f="$CLAUDE_COORD_DIR/$1/orders/claimed/$3.md"
else f="$CLAUDE_COORD_DIR/$1/orders/$3.md"; fi
printf -- '---\nfrom: d\nto: %s\norder-id: %s\nsubject: s\n---\nbody\n' "$1" "$3" > "$f"
}
# THE defect, isolated: identical ORDRE, opposite meanings.
mkfly fly-inflight planned; mkorder fly-inflight claimed 20260101T000000Z-1-from-d
mkfly fly-empty planned
# Both states at once, so the two counts are provably read from different dirs.
mkfly fly-mixed planned
mkorder fly-mixed pending 20260102T000000Z-2-from-d
mkorder fly-mixed pending 20260103T000000Z-3-from-d
mkorder fly-mixed claimed 20260104T000000Z-4-from-d
FLY_OUT="$("$BOARD" --roots "$FLY_ROOT" 2>/dev/null)"
printf '%s' "$FLY_OUT" | grep -q 'FLY'; check "table header carries a FLY column" $?
printf '%s' "$FLY_OUT" | grep -qE '^fly-mixed[[:space:]]+planned[[:space:]]+Sonnet 5/high[[:space:]]+0[[:space:]]+2[[:space:]]+1[[:space:]]'
check "ORDRE 2 and FLY 1 print side by side, never summed into 3" $?
printf '%s' "$FLY_OUT" | grep -qE '^fly-inflight[[:space:]]+planned[[:space:]]+Sonnet 5/high[[:space:]]+0[[:space:]]+0[[:space:]]+1[[:space:]]'
check "an order in flight reads ORDRE 0 / FLY 1, not ORDRE 0 alone" $?
printf '%s' "$FLY_OUT" | grep -qE '^fly-empty[[:space:]]+planned[[:space:]]+Sonnet 5/high[[:space:]]+0[[:space:]]+0[[:space:]]+0[[:space:]]'
check "known-positive: a repo with no orders at all still reads 0 in both" $?
printf '%s' "$FLY_OUT" | grep -q 'Next step for fly-mixed'
check "NESTE still renders after the second field insertion" $?
# The legend must refuse the liveness reading outright - a column that looked
# like "a session is running here" would be the process axis smuggled in as a
# file count, and wiki-advise's 117-hour claim is why that reading is false.
printf '%s' "$FLY_OUT" | grep -qi 'FLY = '
check "the legend defines FLY" $?
printf '%s' "$FLY_OUT" | grep -qiE 'FLY.*(ikke|aldri).*(lever|kj[^ ]*r|aktiv)'
check "the legend denies that FLY proves a session is alive" $?
# --- --plan: free capacity is NAMED, never turned into a tab ---------------
# The operator's actual question ("which repos are finished and can take more
# work") has an answer in fields the scan already reads, and it is not
# status=done alone: measured on the real tree 2026-08-23, 4 of 17 done/
# deferred repos were NOT free (2 held a pending order, 1 owed a reply, 1 had
# an uncommitted tree). All four conditions are required.
mkfly fly-free done
mkfly fly-busy-order done; mkorder fly-busy-order pending 20260105T000000Z-5-from-d
mkfly fly-busy-fly done; mkorder fly-busy-fly claimed 20260106T000000Z-6-from-d
mkfly fly-busy-mail done
mkdir -p "$CLAUDE_COORD_DIR/fly-busy-mail/inbox"
printf -- '---\nfrom: x\nto: fly-busy-mail\nsubject: m\nreply-expected: yes\n---\nbody\n' \
> "$CLAUDE_COORD_DIR/fly-busy-mail/inbox/20260107T000000Z-7-from-x.md"
mkfly fly-busy-dirty done
echo "uncommitted" > "$FLY_ROOT/fly-busy-dirty/scratch.txt"
mkfly fly-free-def deferred
FLY_PLAN="$("$BOARD" --roots "$FLY_ROOT" --plan 2>/dev/null)"
printf '%s\n' "$FLY_PLAN" | grep -qE '^ledig=fly-free \(done\)$'
check "plan names a genuinely free repo with its status" $?
printf '%s\n' "$FLY_PLAN" | grep -qE '^ledig=fly-free-def \(deferred\)$'
check "plan names a deferred repo as free, labelled deferred rather than merged into done" $?
printf '%s\n' "$FLY_PLAN" | grep -q '^ledig=fly-busy-order'; [ $? -ne 0 ]
check "a done repo holding a pending order is not free" $?
printf '%s\n' "$FLY_PLAN" | grep -q '^ledig=fly-busy-fly'; [ $? -ne 0 ]
check "a done repo with an order in flight is not free" $?
printf '%s\n' "$FLY_PLAN" | grep -q '^ledig=fly-busy-mail'; [ $? -ne 0 ]
check "a done repo owing a reply is not free" $?
printf '%s\n' "$FLY_PLAN" | grep -q '^ledig=fly-busy-dirty'; [ $? -ne 0 ]
check "a done repo with an uncommitted tree is not free" $?
# A count, so zero is an ANSWER and not an absence - the same rule fokus_utenfor
# already follows with its "(ingen)" placeholder.
printf '%s\n' "$FLY_PLAN" | grep -qE '^ledig_antall=2$'
check "plan states how many free repos it found" $?
# The plan's second consumer opens a tab per block; plan_parse discards a block
# with no tab=, so a free repo emitted as a BLOCK would be invisible to the
# driver. A single key=value line is visible to both and can never be opened.
printf '%s\n' "$FLY_PLAN" | grep -A2 '^ledig=fly-free ' | grep -q '^tab='; [ $? -ne 0 ]
check "a free repo is never emitted as a tab block" $?
printf '%s\n' "$FLY_PLAN" | grep -q '^repo=fly-free$'; [ $? -ne 0 ]
check "a free repo does not enter the tab list at all" $?
# A repo the plan DOES open a tab for may already hold a claimed order: the
# driver must be able to see that before typing into a live pane.
printf '%s\n' "$FLY_PLAN" | grep -A6 '^repo=fly-inflight$' | grep -qE '^fly=1$'
check "a planned repo with an order in flight carries fly=1 in its block" $?
printf '%s\n' "$FLY_PLAN" | grep -A6 '^repo=fly-empty$' | grep -q '^fly='; [ $? -ne 0 ]
check "known-positive: a planned repo with nothing in flight carries no fly= line" $?
# Zero free repos must still print the count line, or "none found" and "not
# computed" become the same output - Verifiseringslovens ansikt 4.
FLY_ROOT2="$(mktemp -d)"
FLY_SAVE="$FLY_ROOT"; FLY_ROOT="$FLY_ROOT2"
mkfly fly-only-planned planned
FLY_ROOT="$FLY_SAVE"
FLY_PLAN2="$("$BOARD" --roots "$FLY_ROOT2" --plan 2>/dev/null)"
printf '%s\n' "$FLY_PLAN2" | grep -qE '^ledig_antall=0$'
check "a tree with no free repo still states the count (zero is an answer)" $?
printf '%s\n' "$FLY_PLAN2" | grep -q '^ledig='; [ $? -ne 0 ]
check "a tree with no free repo emits no ledig= line" $?
/bin/rm -rf "$FLY_ROOT2" 2>/dev/null
# board.sh must not have grown a process-inspection path. The three axes are
# durable filesystem facts reproducible in this fixture tree; a pgrep/ps/lsof
# column would measure the operator's machine at one instant, could not be
# pinned here at all, and would make the engine decide a session is dead -
# which CLAUDE.md already forbids the order queue from doing.
grep -nE '(^|[^-[:alnum:]_])(pgrep|pkill|lsof)([^-[:alnum:]_]|$)' "$DIR/board.sh" | grep -qv '^[0-9]*:#'; [ $? -ne 0 ]
check "board.sh inspects no processes (no live pgrep/pkill/lsof)" $?
printf 'x\npgrep claude\n' > "$FLY_ROOT/known-positive.txt"
grep -qE '(^|[^-[:alnum:]_])pgrep([^-[:alnum:]_]|$)' "$FLY_ROOT/known-positive.txt"
check "known-positive: the process-inspection grep can find a planted pgrep call" $?
/bin/rm -rf "$FLY_ROOT" 2>/dev/null
echo ""
echo "board-selftest: $PASS passed, $FAIL failed"
[ "$FAIL" -eq 0 ] || exit 1