feat(engine): make a bulk close state what Rule 7 says must be stated

coord-done.sh was the third script that acts on pending messages and the only
one that did not learn the field. --all archives every pending message in one
call, including the ones whose sender declared it expects a reply - the exact
outcome Rule 7 exists to prevent, now reachable with no friction and no trace.

The behavior stays. The receiver keeps both terminal states by design (section
20), and a bulk close is legitimate; refusing would move a decision that belongs
to the operator into the script. What was wrong was the silence: Rule 7 requires
leaving a message unanswered to be STATED, and a command reporting only a total
made the thing that has to be stated invisible.

So --all now names the number it closed without a reply, and only then - a line
that always fires is one nobody reads. A named close stays quiet, because naming
a message is already deliberate, one message at a time.

coord-selftest 151 -> 156.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016iJoZVmU2guTEZcMghk88z
This commit is contained in:
Kjell Tore Guttormsen 2026-07-31 15:48:42 +02:00
commit 5754d67a6b
5 changed files with 78 additions and 5 deletions

View file

@ -642,6 +642,43 @@ sed -n '2,/^---$/p' "$(ls "$RDIR"/rsender/inbox/*.md 2>/dev/null | head -1)" | g
check "reply-expected: a reply defaults to expecting one in turn" $?
CLAUDE_COORD_DIR="$RDIR" "$SEND" --to rx --from rsender --fyi --subject "u" --message "U" >/dev/null 2>&1
check "reply-expected: --fyi is accepted alongside the ordinary send flags" $?
# 28. coord-done is the THIRD script that acts on pending messages, and closing
# one silently is exactly what the field makes possible: --all archives every
# pending message in a single call, including the ones whose sender declared it
# expects a reply. The behavior stays - the receiver keeps both terminal states
# by design (section 20), and a bulk close is legitimate. What must not stay is
# the SILENCE: Rule 7 requires leaving a message unanswered to be stated, and a
# one-command path that reports only a total makes the very thing that has to be
# stated invisible to the operator. So --all names the number it closed without
# a reply. A count, not a refusal: the decision belongs to the operator, and the
# script owes them the fact, not a veto.
DDIR="$(mktemp -d)"
CLAUDE_COORD_DIR="$DDIR" "$SEND" --to dr --from d1 --subject q1 --message "ASK-1" >/dev/null
CLAUDE_COORD_DIR="$DDIR" "$SEND" --to dr --from d2 --subject q2 --message "ASK-2" >/dev/null
CLAUDE_COORD_DIR="$DDIR" "$SEND" --to dr --from d3 --fyi --subject n1 --message "NOTE-1" >/dev/null
dout="$(CLAUDE_COORD_DIR="$DDIR" "$DONE" --repo dr --all 2>&1)"
printf '%s' "$dout" | grep -q '3 message(s) archived'
check "done: --all still archives every pending message" $?
printf '%s' "$dout" | grep -q '2 of them expected a reply'
check "done: --all reports how many it closed without replying" $?
[ -z "$(ls "$DDIR"/dr/inbox/*.md 2>/dev/null)" ]
check "done: --all leaves the inbox drained" $?
# Silence is correct when there is nothing to state: a bulk close of notices owes
# the operator no warning, and a line that always fires is one nobody reads.
CLAUDE_COORD_DIR="$DDIR" "$SEND" --to dq --from d4 --fyi --subject n2 --message "NOTE-2" >/dev/null
qout="$(CLAUDE_COORD_DIR="$DDIR" "$DONE" --repo dq --all 2>&1)"
[ "$(printf '%s' "$qout" | grep -c 'expected a reply')" -eq 0 ] && printf '%s' "$qout" | grep -q '1 message(s) archived'
check "done: closing only notices says nothing extra" $?
# Naming a message explicitly is already a deliberate act, one message at a time.
# The warning belongs to the bulk path, which is the one that hides the choice.
CLAUDE_COORD_DIR="$DDIR" "$SEND" --to dn --from d5 --subject q3 --message "ASK-3" >/dev/null
dnb="$(basename "$(ls "$DDIR"/dn/inbox/*.md 2>/dev/null | head -1)")"
nout="$(CLAUDE_COORD_DIR="$DDIR" "$DONE" --repo dn "$dnb" 2>&1)"
[ "$(printf '%s' "$nout" | grep -c 'expected a reply')" -eq 0 ]
check "done: a named close is deliberate already and stays quiet" $?
/bin/rm -rf "$DDIR" 2>/dev/null
/bin/rm -rf "$RDIR" 2>/dev/null
echo "----"