From d56b2fef173e8dcf2abb410ac204fcc0bdab1cbe Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 29 Jul 2026 17:22:50 +0000 Subject: [PATCH] test: derive the persona count instead of hardcoding seventeen Final audit of the v2 work found the recurring bug class in its last hiding place: the tests that guard against hand-maintained rosters were themselves pinned to a roster size. Four assertions compared against a literal 17. Simulated an eighteenth persona: four tests failed purely on the count, so adding a team member would have broken the suite for no reason and trained whoever hit it to edit the number rather than ask why. The count now derives from profiles/, skipping the coordinators, the same way every roster the CLI prints derives from them after the previous change. Verified both directions. An eighteenth persona that is generated passes 209/209. An eighteenth persona added without regenerating fails four tests that name it: the missing subagent, the regeneration diff, and the handoff brief absent from its command and its agent. The suite scales with the roster and still catches drift. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_019j5DHEZsoeCGRueTbNLuTb --- tests/run.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index f48a180..525ec10 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -842,10 +842,19 @@ else printf " \033[33m!\033[0m skipped (no python3): plugin.json / hooks.json JSON validity\n" fi +# Count the personas rather than hardcoding a number. A literal 17 here would +# make every roster assertion below fail the day an eighteenth persona lands, +# which is the same hand-maintained-list problem these tests exist to catch. +PERSONA_COUNT=0 +for _p in "$REPO_DIR"/profiles/*.md; do + case "$(basename "$_p" .md)" in coordinator*) continue ;; esac + PERSONA_COUNT=$((PERSONA_COUNT + 1)) +done agent_files=("$REPO_DIR"/agents/*.md) agent_count=${#agent_files[@]} [[ -e "${agent_files[0]}" ]] || agent_count=0 -if [[ "$agent_count" == "17" ]]; then ok "17 persona subagents generated"; else fail "17 persona subagents generated (got $agent_count)"; fi +if [[ "$agent_count" == "$PERSONA_COUNT" ]]; then ok "every persona has a generated subagent" +else fail "every persona has a generated subagent (expected $PERSONA_COUNT, got $agent_count)"; fi assert_contains "akira agent carries model tier" "model: claude-fable-5" "$(cat "$REPO_DIR/agents/akira.md")" assert_contains "iris agent carries model tier" "model: claude-opus-4-8" "$(cat "$REPO_DIR/agents/iris.md")" assert_contains "agents marked as generated" "GENERATED from profiles" "$(cat "$REPO_DIR/agents/robin.md")" @@ -910,11 +919,11 @@ fi # surfaces must carry it. hcount=$(grep -l '^## Handoff Brief$' "$REPO_DIR"/commands/*.md 2>/dev/null | wc -l | tr -d ' ') assert_count_eq() { if [[ "$2" == "$3" ]]; then ok "$1"; else fail "$1 (expected $3, got $2)"; fi; } -assert_count_eq "every slash command carries the handoff brief" "$hcount" "17" +assert_count_eq "every slash command carries the handoff brief" "$hcount" "$PERSONA_COUNT" hcount=$(grep -l '^## Handoff Brief$' "$REPO_DIR"/agents/*.md 2>/dev/null | wc -l | tr -d ' ') -assert_count_eq "every subagent still carries the handoff brief" "$hcount" "17" +assert_count_eq "every subagent still carries the handoff brief" "$hcount" "$PERSONA_COUNT" hcount=$(grep -l '^## Handoff Brief$' "$REPO_DIR"/profiles/*.md 2>/dev/null | wc -l | tr -d ' ') -assert_count_eq "every persona profile defines a handoff brief" "$hcount" "17" +assert_count_eq "every persona profile defines a handoff brief" "$hcount" "$PERSONA_COUNT" run_cmd use akira >/dev/null 2>&1 assert_file_has "use carries the handoff brief into the global pin" "$CLAUDE_MD" "^## Handoff Brief" run_cmd reset >/dev/null 2>&1