fix(board): --brief's zero-debt branch no longer claims zero pending mail

Found in review of the previous commit, before catalog tags 0.22.0: once
n_owe counts OWED repos rather than raw pending, its ==0 branch could fire
while a repo still held FYI-only mail, making "Ingen repo har uhaandtert
innboks" false at the exact moment it printed. Fixed to state only the
debt claim, and to name any FYI-only mailboxes found instead of letting
their existence go unmentioned. No fixture in the shared test tree ever
reached n_owe==0 (it always carries a debtor), so this needed its own
isolated-root fixture to pin.

Still part of the 0.22.0 release -- amends that changelog entry rather
than bumping again, since no tag exists yet.

board-selftest.sh: 150 -> 152 checks.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGWMPskXBsTjMrrQ2GofFx
This commit is contained in:
Kjell Tore Guttormsen 2026-08-13 21:07:39 +02:00
commit 61aebad748
5 changed files with 80 additions and 10 deletions

View file

@ -1250,6 +1250,42 @@ check "the surviving repo still ranks correctly with an empty chain-root lookup"
/bin/rm -rf "$NOBLOCK_ROOT" "$NOBLOCK_COORD" 2>/dev/null
# --- 14. Zero-debt briefing must not claim zero pending mail ---------------
# n_owe now counts OWED repos (section 8's fix), so its ==0 branch can fire
# while a repo still holds FYI-only mail - a real, re-injected message the
# operator has not seen answered here. The branch's own first sentence used
# to say "Ingen repo har uhaandtert innboks" (no repo has unhandled inbox),
# which becomes FALSE the moment that happens; its second sentence ("ingen
# skylder svar") stays true. Isolated root: the shared fixture tree never
# reaches n_owe==0 (repo-a and friends always owe something), so this branch
# is otherwise never exercised by this suite.
NODEBT_ROOT="$(mktemp -d)"
NODEBT_COORD="$(mktemp -d)"
mkrepo "$NODEBT_ROOT/fyi-only-repo"
{
echo "# STATE - fyi-only-repo"
printf '## %s NESTE %s START HER\n' "$HAND" "$EMDASH"
echo "<!-- board: status=done; blocked-on=-; next-cost=Sonnet 5/high -->"
echo "Ferdig, ett varsel ligger i innboksen."
} > "$NODEBT_ROOT/fyi-only-repo/STATE.md"
mkdir -p "$NODEBT_COORD/fyi-only-repo/inbox"
{
echo "---"
echo "from: w"
echo "to: fyi-only-repo"
echo "reply-expected: no"
echo "---"
echo "fyi only"
} > "$NODEBT_COORD/fyi-only-repo/inbox/2026-msg1-from-w.md"
NODEBT_BRIEF="$(CLAUDE_COORD_DIR="$NODEBT_COORD" "$BOARD" --roots "$NODEBT_ROOT" --brief 2>/dev/null)"
printf '%s' "$NODEBT_BRIEF" | grep -qi 'ingen.*uhaandtert innboks'; [ $? -ne 0 ]
check "zero-debt briefing never claims no mail is pending when FYI mail exists" $?
printf '%s' "$NODEBT_BRIEF" | grep -q 'Ingen repo skylder'
check "zero-debt briefing still states the true claim: nobody owes a reply" $?
/bin/rm -rf "$NODEBT_ROOT" "$NODEBT_COORD" 2>/dev/null
echo ""
echo "board-selftest: $PASS passed, $FAIL failed"
[ "$FAIL" -eq 0 ] || exit 1