feat(coord,board): flag mailboxes no session has ever read (WP1d detection half)
coord-count.sh gains a fourth TSV column: "-" when a mailbox has .origin (a real session has read it via SessionStart), otherwise the age in whole days of the oldest pending message. .origin is only written by coord-inbox.sh's non---repo path, so its absence means the mailbox is never reached by normal injection — a genuine dead letter, not merely slow. board.sh's --brief surfaces mailboxes past the 3-day threshold as a new "ALDRI LEST" section, mirroring the existing orphan-mailbox listing. This is WP1d's detection half only (per .claude's coord bestilling 2026-08-14); the action half (report-to-sender / retract) is unapproved design, not built here. coord-selftest.sh: 191 -> 197 checks. board-selftest.sh: 175 -> 178 checks (net +3; section 16 adds 3 new fixtures on top of the existing 175 baseline, some pre-existing counts shift with the trailing column). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0194eV8b6BXNv6aKLovP8TP6
This commit is contained in:
parent
44fb34ab72
commit
19c0c1010b
6 changed files with 211 additions and 18 deletions
|
|
@ -437,8 +437,8 @@ grep -Fxq "$bigbc" "$SEENF" 2>/dev/null; check "seen: a read that completed does
|
|||
TAB="$(printf '\t')"
|
||||
cnt="$("$COUNT" 2>/dev/null)"; rc=$?
|
||||
[ "$rc" -eq 0 ]; check "count: exits 0" $?
|
||||
printf '%s\n' "$cnt" | grep -q "^count-a${TAB}2${TAB}2$"; check "count: reports a mailbox with its pending total and its debt" $?
|
||||
printf '%s\n' "$cnt" | grep -q "^count-b${TAB}1${TAB}1$"; check "count: reports every mailbox that has pending mail" $?
|
||||
printf '%s\n' "$cnt" | grep -q "^count-a${TAB}2${TAB}2${TAB}0$"; check "count: reports a mailbox with its pending total and its debt" $?
|
||||
printf '%s\n' "$cnt" | grep -q "^count-b${TAB}1${TAB}1${TAB}0$"; check "count: reports every mailbox that has pending mail" $?
|
||||
|
||||
# Drained mailboxes are absent, not zero: the caller asks "who is owed a reply",
|
||||
# and a list of zeroes answers a different question at every reader's expense.
|
||||
|
|
@ -602,9 +602,12 @@ reply-expected: no
|
|||
FORGE-BODY
|
||||
FORGE
|
||||
rc1="$(CLAUDE_COORD_DIR="$RDIR" "$COUNT" 2>/dev/null)"
|
||||
printf '%s\n' "$rc1" | grep -q "^ry${TAB}2${TAB}2$"
|
||||
# ry's two fixtures are hand-dated 2026-01-01 (not "now"), so the age column is
|
||||
# whatever that works out to be at test time, not 0 - only pending/debt/format
|
||||
# are pinned here; origin-age has its own dedicated section (31).
|
||||
printf '%s\n' "$rc1" | grep -qE "^ry${TAB}2${TAB}2${TAB}[0-9]+\$"
|
||||
check "reply-expected: a message without the field counts as debt" $?
|
||||
printf '%s\n' "$rc1" | grep -q "^rx${TAB}2${TAB}1$"
|
||||
printf '%s\n' "$rc1" | grep -q "^rx${TAB}2${TAB}1${TAB}0$"
|
||||
check "count: the second column is pending, the third is debt" $?
|
||||
|
||||
# Pending and debt are different numbers, and a mailbox holding only notices is
|
||||
|
|
@ -614,7 +617,7 @@ check "count: the second column is pending, the third is debt" $?
|
|||
# put two different numbers under one name with no way to reconcile them.
|
||||
mkdir -p "$RDIR/rz"
|
||||
CLAUDE_COORD_DIR="$RDIR" "$SEND" --to rz --from rsender --fyi --subject "n2" --message "ONLY-FYI" >/dev/null
|
||||
printf '%s\n' "$(CLAUDE_COORD_DIR="$RDIR" "$COUNT" 2>/dev/null)" | grep -q "^rz${TAB}1${TAB}0$"
|
||||
printf '%s\n' "$(CLAUDE_COORD_DIR="$RDIR" "$COUNT" 2>/dev/null)" | grep -q "^rz${TAB}1${TAB}0${TAB}0$"
|
||||
check "count: a mailbox holding only notices is listed with zero debt" $?
|
||||
|
||||
# The reader is told which terminal state the sender expects - per message, in a
|
||||
|
|
@ -843,7 +846,7 @@ CLAUDE_COORD_DIR="$DDIR" "$SEND" --to "../evil" --from d1 --subject x --message
|
|||
[ $? -eq 2 ]; check "send: path-traversal through a dot prefix still rejected" $?
|
||||
|
||||
dout="$(CLAUDE_COORD_DIR="$DDIR" "$COUNT" 2>/dev/null)"
|
||||
printf '%s\n' "$dout" | grep -q "^\.dotrepo${TAB}1${TAB}1$"
|
||||
printf '%s\n' "$dout" | grep -q "^\.dotrepo${TAB}1${TAB}1${TAB}0$"
|
||||
check "count: sees a dot-prefixed mailbox instead of skipping it" $?
|
||||
|
||||
# sweep uses the same enumeration as coord-count.sh, so an aged FYI inside a
|
||||
|
|
@ -859,6 +862,58 @@ CLAUDE_COORD_DIR="$DDIR" "$DONE" --repo .dotrepo --all >/dev/null
|
|||
[ -z "$(ls "$DDIR/.dotrepo/inbox"/*.md 2>/dev/null)" ]; check "done: drains a dot-prefixed repo's inbox directly (unaffected by the bug)" $?
|
||||
/bin/rm -rf "$DDIR" 2>/dev/null
|
||||
|
||||
# 31. .origin-age flagging (WP1d, .claude 2026-08-14): coord-inbox.sh only
|
||||
# writes .origin from a REAL session's own SessionStart (REPO_PATH resolved via
|
||||
# git rev-parse, never when --repo is passed explicitly - section 23). A
|
||||
# mailbox lacking .origin has therefore NEVER been read by any session's normal
|
||||
# injection; pending mail sitting there is a genuine dead letter, not merely
|
||||
# slow. coord-count.sh's fourth column reports this per mailbox: "-" when
|
||||
# .origin exists (not a candidate, regardless of message age), otherwise the
|
||||
# age in whole days of the OLDEST pending message - the worst case, since that
|
||||
# is how long the problem has existed. board.sh flags anything >= 3 at that
|
||||
# threshold; coord-count.sh only ever reports the raw age, never judges it.
|
||||
OADIR="$(mktemp -d)"
|
||||
|
||||
# (a) .origin present: never gets an age, no matter how old the mail is.
|
||||
CLAUDE_COORD_DIR="$OADIR" "$SEND" --to oa-claimed --from oas --subject "c1" --message "CLAIMED" >/dev/null
|
||||
printf '%s\n' "/tmp/oa-claimed" > "$OADIR/oa-claimed/.origin"
|
||||
age_it "$OADIR" oa-claimed CLAIMED "$(date -u -v-10d +%Y%m%dT%H%M%SZ)"
|
||||
printf '%s\n' "$(CLAUDE_COORD_DIR="$OADIR" "$COUNT" 2>/dev/null)" | grep -q "^oa-claimed${TAB}1${TAB}1${TAB}-$"
|
||||
check "origin-age: a mailbox with .origin reports '-' regardless of message age" $?
|
||||
|
||||
# (b) No .origin, message just sent: age is 0, not yet flagged.
|
||||
CLAUDE_COORD_DIR="$OADIR" "$SEND" --to oa-fresh --from oas --subject "f1" --message "FRESH" >/dev/null
|
||||
printf '%s\n' "$(CLAUDE_COORD_DIR="$OADIR" "$COUNT" 2>/dev/null)" | grep -q "^oa-fresh${TAB}1${TAB}1${TAB}0$"
|
||||
check "origin-age: a fresh message in an unclaimed mailbox reports age 0" $?
|
||||
|
||||
# (c) No .origin, message 10 days old: past the 3-day threshold.
|
||||
CLAUDE_COORD_DIR="$OADIR" "$SEND" --to oa-old --from oas --subject "o1" --message "STALE" >/dev/null
|
||||
age_it "$OADIR" oa-old STALE "$(date -u -v-10d +%Y%m%dT%H%M%SZ)"
|
||||
oa_stale="$(CLAUDE_COORD_DIR="$OADIR" "$COUNT" 2>/dev/null | awk -F"$TAB" '$1=="oa-old"{print $4}')"
|
||||
[ -n "$oa_stale" ] && [ "$oa_stale" -ge 9 ] 2>/dev/null
|
||||
check "origin-age: an unclaimed mailbox with old mail reports its age in days, past the threshold" $?
|
||||
|
||||
# (d) Oldest message wins when a mailbox has several: the reported age is the
|
||||
# worst case (how long this has been a problem), not the most recent arrival.
|
||||
CLAUDE_COORD_DIR="$OADIR" "$SEND" --to oa-multi --from oas --subject "m1" --message "MULTI-OLD" >/dev/null
|
||||
CLAUDE_COORD_DIR="$OADIR" "$SEND" --to oa-multi --from oas --subject "m2" --message "MULTI-NEW" >/dev/null
|
||||
age_it "$OADIR" oa-multi MULTI-OLD "$(date -u -v-10d +%Y%m%dT%H%M%SZ)"
|
||||
oa_multi="$(CLAUDE_COORD_DIR="$OADIR" "$COUNT" 2>/dev/null | awk -F"$TAB" '$1=="oa-multi"{print $4}')"
|
||||
[ -n "$oa_multi" ] && [ "$oa_multi" -ge 9 ] 2>/dev/null
|
||||
check "origin-age: reports the OLDEST pending message's age, not the newest" $?
|
||||
|
||||
# (e) A message whose filename does not match the timestamp grammar (pre-0.x
|
||||
# or hand-crafted) must never crash the count and must never be misread as
|
||||
# ancient - fail-safe, not fail-open, matching coord-sweep.sh's identical rule.
|
||||
mkdir -p "$OADIR/oa-garbage/inbox"
|
||||
echo "not from the grammar" > "$OADIR/oa-garbage/inbox/not-a-timestamp-from-x.md"
|
||||
oa_g_out="$(CLAUDE_COORD_DIR="$OADIR" "$COUNT" 2>/dev/null)"; oa_g_rc=$?
|
||||
[ "$oa_g_rc" -eq 0 ]; check "origin-age: a filename outside the timestamp grammar never crashes the count" $?
|
||||
printf '%s\n' "$oa_g_out" | grep -q "^oa-garbage${TAB}1${TAB}1${TAB}-$"
|
||||
check "origin-age: an unreadable timestamp reports '-', never a fabricated age" $?
|
||||
|
||||
/bin/rm -rf "$OADIR" 2>/dev/null
|
||||
|
||||
echo "----"
|
||||
echo "PASS=$PASS FAIL=$FAIL"
|
||||
[ "$FAIL" -eq 0 ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue