feat(board): render the day plan as a third rendering of the same scan
The table says what the state of every repo is; the briefing says who is waiting. Neither says which repos to open a tab for today, in what order, and with which command - so a day plan was assembled by hand every morning from a table that deliberately takes no position. --plan is built on exactly the argument --brief was: a lookup over data the scan already holds, zero model calls, and route.sh already derives the per-repo command. The order IS the position it takes, and the only one - there is no cutoff, so nothing is hidden. The rule most likely to be "fixed" into a defect: repos owing mail rank first regardless of status. Excluding blocked or done is a claim about a repo's OWN next step, which by definition cannot be moved, while owing an answer is the other axis entirely - and answering is often what unblocks it. Measured on the real tree, two of 26 planned repos were done with an unhandled inbox, so the fixture tree pins done-with-debt and blocked-with-debt rather than the general rule alone. Repos with no board line rank last and are LABELLED, because the table already prints a note about them and dropping them silently would repeat that defect. key=value rather than prose, because the plan has two consumers: the operator, and a separate repo driving a terminal from it. Prose would make the rendered format an API no test here could hold stable for a consumer living in another repo. dir= is absolute because a new pane inherits its anchor's directory; command_missing= carries both no-command causes, because a driver reading ^command= would type a blank line into a live pane. route_cmd_for() becomes the single reader of the route-line grammar, shared with --brief, distinguishing the two failure causes by exit code rather than by an empty string. --brief output is unchanged. Driving a terminal from the plan stays OUT of this repo, on the measurement in docs/ghostty-orchestration-measurement.md rather than on taste. board-selftest: 51 -> 86 checks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011eKRzhD1RqY2MxvDEkrJAM
This commit is contained in:
parent
5d9c76763d
commit
6d0fe14d0f
10 changed files with 485 additions and 31 deletions
|
|
@ -428,6 +428,199 @@ CLAUDE_BRIEF_FILE="$OUTFILE" BOARD_ROOTS="$ROOT/does-not-exist" \
|
|||
grep -q 'FORRIGE BRIEFING' "$OUTFILE"
|
||||
check "empty render never overwrites the previous briefing" $?
|
||||
|
||||
# --- 10. Day-plan rendering (--plan) ---------------------------------------
|
||||
# A THIRD rendering of the same scan, on exactly the argument --brief was built
|
||||
# on. The table answers "what is the state of every repo"; the briefing answers
|
||||
# "who is waiting on me"; the plan answers "which repos do I open a tab for
|
||||
# today, in what order, with which command". It has TWO consumers - the operator
|
||||
# pasting commands, and a separate driver repo consuming the plan - which is why
|
||||
# it renders key=value blocks rather than prose: prose would make the FORMAT an
|
||||
# API that no test in this repo could hold stable.
|
||||
#
|
||||
# repo-blocked-owes: blocked AND owing mail. The exclusion of `blocked` is about
|
||||
# a repo's OWN next step, which by definition cannot be moved; answering a
|
||||
# message is a different axis, and is often precisely what unblocks it. Without
|
||||
# this fixture the debt-first rule and the status exclusion never meet, and
|
||||
# whichever one was written second would silently win.
|
||||
mkrepo "$ROOT/repo-blocked-owes"
|
||||
{
|
||||
echo "# STATE - repo-blocked-owes"
|
||||
printf '## %s NESTE %s START HER\n' "$HAND" "$EMDASH"
|
||||
echo "<!-- board: status=blocked; blocked-on=repo-a; next-cost=Opus 5/high -->"
|
||||
printf 'Venter p%s repo-a, men skylder to svar.\n' "$EMDASH"
|
||||
} > "$ROOT/repo-blocked-owes/STATE.md"
|
||||
mkdir -p "$CLAUDE_COORD_DIR/repo-blocked-owes/inbox"
|
||||
for n in 1 2; do
|
||||
echo "msg" > "$CLAUDE_COORD_DIR/repo-blocked-owes/inbox/2026-msg$n-from-w.md"
|
||||
done
|
||||
|
||||
# repo-done-owes: done AND owing mail. Same rule as repo-blocked-owes, but this
|
||||
# is the shape that actually occurs - measured on the real tree at 0.16.0, two
|
||||
# of the 26 planned repos were `done` with an unhandled inbox, and none were
|
||||
# blocked-with-debt. A repo whose own work is finished can still owe an answer.
|
||||
mkrepo "$ROOT/repo-done-owes"
|
||||
{
|
||||
echo "# STATE - repo-done-owes"
|
||||
printf '## %s NESTE %s START HER\n' "$HAND" "$EMDASH"
|
||||
echo "<!-- board: status=done; blocked-on=-; next-cost=Sonnet 5/high -->"
|
||||
printf 'Arbeidet er ferdig %s men innboksen er ikke gjort opp.\n' "$EMDASH"
|
||||
} > "$ROOT/repo-done-owes/STATE.md"
|
||||
mkdir -p "$CLAUDE_COORD_DIR/repo-done-owes/inbox"
|
||||
echo "msg" > "$CLAUDE_COORD_DIR/repo-done-owes/inbox/2026-msg1-from-w.md"
|
||||
|
||||
PLAN="$("$BOARD" --roots "$ROOT" --plan 2>/dev/null)"; rc=$?
|
||||
check "--plan exits 0" "$rc"
|
||||
|
||||
printf '%s' "$PLAN" | grep -q '^# PLAN '
|
||||
check "plan carries a header naming what it is" $?
|
||||
|
||||
# Machine-readable by construction: the driver repo reads these keys.
|
||||
printf '%s' "$PLAN" | grep -q '^tab=1$'
|
||||
check "plan numbers tabs starting at 1" $?
|
||||
|
||||
# Debt outranks everything, most-owed first. repo-a owes 3, repo-blocked-owes 2,
|
||||
# repo-owes and repo-typo 1 each.
|
||||
[ "$(printf '%s\n' "$PLAN" | grep -A1 '^tab=1$' | grep '^repo=' | cut -d= -f2)" = "repo-a" ]
|
||||
check "the repo owing the most messages is tab 1" $?
|
||||
|
||||
n_a="$(printf '%s\n' "$PLAN" | grep -n '^repo=repo-a$' | cut -d: -f1)"
|
||||
n_bo="$(printf '%s\n' "$PLAN" | grep -n '^repo=repo-blocked-owes$' | cut -d: -f1)"
|
||||
n_ow="$(printf '%s\n' "$PLAN" | grep -n '^repo=repo-owes$' | cut -d: -f1)"
|
||||
[ -n "$n_a" ] && [ -n "$n_bo" ] && [ -n "$n_ow" ] \
|
||||
&& [ "$n_a" -lt "$n_bo" ] && [ "$n_bo" -lt "$n_ow" ]
|
||||
check "debt group is ordered by message count, descending" $?
|
||||
|
||||
# The status exclusion is about a repo's own next step, never about its debt.
|
||||
printf '%s' "$PLAN" | grep -q '^repo=repo-blocked-owes$'
|
||||
check "a BLOCKED repo that owes mail is still planned (debt is the other axis)" $?
|
||||
|
||||
printf '%s\n' "$PLAN" | grep -A4 '^repo=repo-blocked-owes$' | grep -q '^why=inbox:2$'
|
||||
check "a blocked repo in the plan says debt, not status, is why it is there" $?
|
||||
|
||||
# Debt before live work: repo-h is in-progress and owes nothing.
|
||||
n_h="$(printf '%s\n' "$PLAN" | grep -n '^repo=repo-h$' | cut -d: -f1)"
|
||||
[ -n "$n_h" ] && [ "$n_ow" -lt "$n_h" ]
|
||||
check "every repo owing mail is planned before any that owes none" $?
|
||||
|
||||
# repo-a is BOTH in-progress and owing. It must appear exactly once - a repo
|
||||
# listed twice is two tabs for one repo, which is the plan failing at its job.
|
||||
[ "$(printf '%s\n' "$PLAN" | grep -c '^repo=repo-a$')" -eq 1 ]
|
||||
check "a repo qualifying under two rules is planned exactly once" $?
|
||||
|
||||
printf '%s\n' "$PLAN" | grep -A3 '^repo=repo-a$' | grep -q '^why=inbox:3$'
|
||||
check "why= names the rule that put the repo in the plan" $?
|
||||
|
||||
# in-progress outranks planned among the repos owing nothing.
|
||||
n_g="$(printf '%s\n' "$PLAN" | grep -n '^repo=repo-g$' | cut -d: -f1)"
|
||||
[ -n "$n_g" ] && [ "$n_h" -lt "$n_g" ]
|
||||
check "live work (in-progress) is planned before merely planned work" $?
|
||||
|
||||
# Excluded classes. A tab for a done or deferred repo is noise; a tab for a
|
||||
# blocked repo that owes nothing cannot be moved at all.
|
||||
printf '%s' "$PLAN" | grep -q '^repo=repo-wt$'; [ $? -ne 0 ]
|
||||
check "plan excludes a done repo that owes nothing" $?
|
||||
|
||||
# ...but the exclusion is conditional on owing nothing, and the header says so.
|
||||
# Read the other way, the plan's own header would call these entries a bug.
|
||||
printf '%s' "$PLAN" | grep -q '^repo=repo-done-owes$'
|
||||
check "a DONE repo that owes mail is still planned" $?
|
||||
printf '%s\n' "$PLAN" | grep -A4 '^repo=repo-done-owes$' | grep -q '^status=done$'
|
||||
check "a done repo in the plan still reports its real status" $?
|
||||
printf '%s\n' "$PLAN" | grep -m1 '^# Utelatt' | grep -q 'skylder svar'
|
||||
check "the header states the exclusions are conditional on owing nothing" $?
|
||||
printf '%s' "$PLAN" | grep -q '^repo=repo-d$'; [ $? -ne 0 ]
|
||||
check "plan excludes a deferred repo" $?
|
||||
printf '%s' "$PLAN" | grep -q '^repo=plug-x$'; [ $? -ne 0 ]
|
||||
check "plan excludes a blocked repo that owes nothing" $?
|
||||
printf '%s' "$PLAN" | grep -q '^repo=repo-c$'; [ $? -ne 0 ]
|
||||
check "plan excludes a repo with no STATE.md and no debt" $?
|
||||
|
||||
# A repo with no board line has no declared next step, but dropping it SILENTLY
|
||||
# is what the table's own MERK line exists to prevent. It is planned last and
|
||||
# labelled, never omitted.
|
||||
printf '%s' "$PLAN" | grep -q '^repo=repo-b$'
|
||||
check "a repo lacking a board line is planned, not silently dropped" $?
|
||||
printf '%s\n' "$PLAN" | grep -A3 '^repo=repo-b$' | grep -q '^why=uavklart$'
|
||||
check "a repo with unknown status is labelled uavklart, not guessed into a rule" $?
|
||||
n_b="$(printf '%s\n' "$PLAN" | grep -n '^repo=repo-b$' | cut -d: -f1)"
|
||||
[ -n "$n_b" ] && [ "$n_g" -lt "$n_b" ]
|
||||
check "uavklart repos rank below every repo that declared a status" $?
|
||||
|
||||
# The command comes from route.sh, same single copy of the rubric the briefing
|
||||
# uses - advisor flag included, since that is a property of the ROW.
|
||||
printf '%s' "$PLAN" | grep -q '^command=claude --model sonnet --effort high --advisor opus$'
|
||||
check "plan derives the exact startup command from the repo's route line" $?
|
||||
|
||||
# Both no-command causes must degrade to a marker. A bare `command=` would be
|
||||
# the shape of a runnable command carrying nothing - worse than none, because a
|
||||
# driver reading `^command=` would type an empty line into a live pane.
|
||||
printf '%s' "$PLAN" | grep -q '^command=$'; [ $? -ne 0 ]
|
||||
check "plan never emits an empty command= line" $?
|
||||
|
||||
printf '%s\n' "$PLAN" | grep -A6 '^repo=repo-typo$' | grep -q '^command_missing='
|
||||
check "unparseable route line degrades to command_missing=, not to a guess" $?
|
||||
printf '%s\n' "$PLAN" | grep -A6 '^repo=repo-a$' | grep -q '^command_missing='
|
||||
check "repo owing mail but lacking a route line is marked, never guessed at" $?
|
||||
|
||||
# Same argument as the briefing: the 38-char cut is the TABLE column's property.
|
||||
printf '%s' "$PLAN" | grep -q '^neste=.*check-versions'
|
||||
check "plan prints the full NESTE line, not the 38-char table excerpt" $?
|
||||
|
||||
# The driver cds into this, so a relative or missing path lands a session in the
|
||||
# wrong repo - constraint 2 of the Ghostty measurement, in field form.
|
||||
pdir="$(printf '%s\n' "$PLAN" | grep -m1 '^dir=' | cut -d= -f2-)"
|
||||
[ -n "$pdir" ] && [ -d "$pdir" ] && [ "${pdir#/}" != "$pdir" ]
|
||||
check "dir= is an absolute path that exists" $?
|
||||
|
||||
# Every block must be complete: a driver that reads a block missing dir= or
|
||||
# command= has no safe default, and guessing one types into a live pane.
|
||||
n_tab="$(printf '%s\n' "$PLAN" | grep -c '^tab=')"
|
||||
n_rep="$(printf '%s\n' "$PLAN" | grep -c '^repo=')"
|
||||
n_dir="$(printf '%s\n' "$PLAN" | grep -c '^dir=')"
|
||||
n_why="$(printf '%s\n' "$PLAN" | grep -c '^why=')"
|
||||
n_sta="$(printf '%s\n' "$PLAN" | grep -c '^status=')"
|
||||
n_nes="$(printf '%s\n' "$PLAN" | grep -c '^neste=')"
|
||||
n_cmd="$(printf '%s\n' "$PLAN" | grep -c '^command=')"
|
||||
n_cms="$(printf '%s\n' "$PLAN" | grep -c '^command_missing=')"
|
||||
[ "$n_tab" -gt 0 ] && [ "$n_rep" -eq "$n_tab" ] && [ "$n_dir" -eq "$n_tab" ] \
|
||||
&& [ "$n_why" -eq "$n_tab" ] && [ "$n_sta" -eq "$n_tab" ] \
|
||||
&& [ "$n_nes" -eq "$n_tab" ] && [ $(( n_cmd + n_cms )) -eq "$n_tab" ]
|
||||
check "every planned block carries every field exactly once" $?
|
||||
|
||||
# Numbering must be dense: a driver opening tab 4 of 3 is a real failure mode.
|
||||
seq_ok=0
|
||||
printf '%s\n' "$PLAN" | grep '^tab=' | cut -d= -f2 > "$ROOT/tabs.txt"
|
||||
# An empty tab list satisfies "every number is its index" vacuously, which is
|
||||
# the check passing by finding nothing rather than by reading the numbering.
|
||||
[ -s "$ROOT/tabs.txt" ] || seq_ok=1
|
||||
i=0; while read -r t; do i=$((i+1)); [ "$t" = "$i" ] || seq_ok=1; done < "$ROOT/tabs.txt"
|
||||
check "tab numbers are dense and consecutive" "$seq_ok"
|
||||
|
||||
# Read-only, same as every other rendering. Reading IS delivering in this
|
||||
# engine, so a plan that consumed a backlog would be the core defect.
|
||||
p4="$(snap "$CLAUDE_COORD_DIR")"
|
||||
"$BOARD" --roots "$ROOT" --plan >/dev/null 2>&1
|
||||
[ "$p4" = "$(snap "$CLAUDE_COORD_DIR")" ]
|
||||
check "plan writes nothing to the mailbox (reading is delivering)" $?
|
||||
|
||||
# The scan and the mailbox are two populations. An orphan mailbox has no repo to
|
||||
# cd into, so it cannot BE a tab - but dropping it makes the plan claim a
|
||||
# completeness it knows it lacks. It is reported as commentary.
|
||||
printf '%s' "$PLAN" | grep -q 'orphan-surface'
|
||||
check "plan surfaces a pending mailbox with no repo in the scan tree" $?
|
||||
printf '%s' "$PLAN" | grep -q '^repo=orphan-surface$'; [ $? -ne 0 ]
|
||||
check "orphan mailbox is commentary, never a tab block (there is no dir to cd to)" $?
|
||||
|
||||
# Comment lines are '#'-prefixed so a consumer can drop them with one rule.
|
||||
printf '%s\n' "$PLAN" | grep -vE '^#|^$|^[a-z_]+=' | grep -q .; [ $? -ne 0 ]
|
||||
check "every plan line is a comment, a blank, or a key=value pair" $?
|
||||
|
||||
printf '%s' "$PLAN" | iconv -f UTF-8 -t UTF-8 >/dev/null 2>&1
|
||||
check "plan output is valid UTF-8" $?
|
||||
|
||||
"$BOARD" --help 2>/dev/null | grep -q '\-\-plan'
|
||||
check "--help documents --plan" $?
|
||||
|
||||
echo ""
|
||||
echo "board-selftest: $PASS passed, $FAIL failed"
|
||||
[ "$FAIL" -eq 0 ] || exit 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue