Release sweep script (suites, smoke, soak, hidden-screen windows); agents write spec tests; experimental push rule; shared Coderstanding data

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
RobinFiredrake 2026-12-01 13:19:52 -06:00
parent 64d14febf4
commit 0365eb657b
3 changed files with 88 additions and 6 deletions

View file

@ -21,8 +21,9 @@ TableTarot is a **major** project (Robin, 2026-12-01). Rules: `~/AI/Rules/coding
- **Into `experimental`: no gate.** The agent tests only its own code, then merges.
- **Dev gate** (`experimental` → `dev`): the user tries it and says OK, then one full
`tools/run_tests.sh` run plus the spec checks.
- **Release sweep** (`dev` → `main`): `tools/run_tests.sh --sweep` (every suite, 5× the budget)
plus the spec health report.
- Pushing `experimental`, `dev` or `main` needs the user's OK. Own work branches: push freely.
- **Release sweep** (`dev` → `main`): `tools/release_sweep.sh` (exhaustive, 5× the budget: every
suite, a smoke run, a soak run, real-window runs on a hidden screen) plus the spec health report.
- Merging into and pushing `experimental`: no need to ask. Pushing `dev` or `main` needs the
user's OK. Own work branches: push freely.
- **Specs are required** (Coderstanding app `tabletower`). Plan new behaviour as a spec Draft
branch first; only the user approves specs. Check: `coderstanding specs tabletower --lines`.

View file

@ -281,7 +281,8 @@ that works on any theme (solid background, stronger text, thicker borders, no ef
Six Godot workers (`tests/run_suites.gd`) share the suites, longest first; what doesn't fit is
listed as NOT RUN (exit code 2). A full run takes ~12 s on an idle machine (2026-11-25). One
line per suite; a failing suite prints 8 lines; a compile error shared by many suites prints
once. A suite is a Node with `run()`, ending in `finish()`. It extends `TestBase`
once. Release sweep: `tools/release_sweep.sh` (75 s; ~22 s on 2026-12-01).
A suite is a Node with `run()`, ending in `finish()`. It extends `TestBase`
(`tests/testbase.gd`, no UI: `require_sample()`, `_check`, `_eq`, `_frames`, `_wipe`) or
`AppTestBase` (`tests/app_testbase.gd`: `main`, `start_main()`; pass false to start on an
empty spread). The suites' demo spread has tables of 12 rows at most. Suites share a process,
@ -307,14 +308,16 @@ that works on any theme (solid background, stronger text, thicker borders, no ef
sweep (`CLAUDE.md`). Worktree for `experimental`: `~/Repos/Worktrees/TableTower/experimental`.
Co-Authored-By line on commits.
- **Agents:** only for large, separate jobs. Worktree briefs start with `git reset --hard <branch>`,
own specific files, keep public APIs as delegators, don't touch tests. The user's computer has
own specific files, keep public APIs as delegators. They write tests from the spec lines they
touch, link them to the lines, and run only their own test file (major-project rule, 2026-12-01). The user's computer has
been crashing: an interrupted agent's work stays in `.claude/worktrees/`; resume it with
SendMessage ("don't reset"), then cherry-pick its commit and `git worktree remove -f -f`.
- **Token savings:** read only this page at the start; read the other docs on demand; keep tool
output short (the test runner already does); avoid viewing full-size screenshots (crop/resize).
- **Coderstanding** (structure scanner, tours) is installed: `coderstanding` on PATH (venv
`~/.local/share/coderstanding/venv`), app `tabletower`, data and tours in
`~/.local/share/coderstanding/tabletower`, viewer http://127.0.0.1:8517/. Tours teach the
`~/.local/share/coderstanding/tabletower`, shared with Digit: the data home is the private repo
`digit/coderstanding-data`; run its `./sync.sh` after changing specs, tours or scans. Viewer http://127.0.0.1:8517/. Tours teach the
user (new to coding): plain words, explain basics. Specs are required (major project):
`coderstanding specs tabletower --lines`. Update: pull
https://forgejo.smhub.duckdns.org/digit/coderstanding and `pip install` it into that venv.

78
tools/release_sweep.sh Executable file
View file

@ -0,0 +1,78 @@
#!/usr/bin/env bash
# The release sweep: run before `dev` goes into `main`. Exhaustive, unlike the dev gate.
#
# Runs, in one shared time limit of 5x the suite budget (BUDGET_SECS in run_tests.sh):
# 1. every test suite (run_tests.sh --sweep)
# 2. a headless smoke run of the app with the sample spread
# 3. a soak run: the example board rolled many times, every choice answered at random
# 4. real-window runs (desktop and phone view) on a hidden virtual screen, with screenshots
# A step fails on its own failure or on a SCRIPT ERROR. Steps that don't fit the time are NOT RUN.
# Step 4 is NOT RUN while SteamVR or a Steam game runs (GPU runs then can crash the PC).
#
# Usage: tools/release_sweep.sh
# Exit codes: 0 all passed, 1 a step failed, 2 over the time limit (nothing failed).
set -u
cd "$(dirname "$0")/.." || exit 1
GODOT="${GODOT:-$HOME/apps/Godot_v4.7.2-stable_linux.x86_64}"
SWEEP_MULTIPLIER=5
budget_secs=$(grep -oP '^readonly BUDGET_SECS=\K[0-9]+' tools/run_tests.sh)
limit_secs=$(( budget_secs * SWEEP_MULTIPLIER ))
SHOTS="${SWEEP_SHOTS:-/tmp/tabletarot-sweep}"
mkdir -p "$SHOTS"
start_ms=$(date +%s%3N)
left_secs() { echo $(( limit_secs - ($(date +%s%3N) - start_ms) / 1000 )); }
failed=()
not_run=()
LOG="$(mktemp)"
trap 'rm -f "$LOG"' EXIT
# run_step NAME COMMAND...: runs at low priority in the time that is left.
run_step() {
local name="$1"; shift
local left; left=$(left_secs)
if (( left < 2 )); then not_run+=("$name"); echo "NOT RUN $name (no time left)"; return; fi
nice -n 10 timeout -s KILL "$left" "$@" >"$LOG" 2>&1
local code=$?
if (( code == 137 )); then not_run+=("$name"); echo "NOT RUN $name (stopped at the time limit)"
elif (( code != 0 )) || grep -q "SCRIPT ERROR" "$LOG"; then
failed+=("$name"); echo "FAIL $name"; grep -E "FAIL|SCRIPT ERROR|ERROR" "$LOG" | head -8
else echo "ok $name"; fi
}
# 1. Suites: run_tests.sh prints its own report.
left=$(left_secs)
timeout -s KILL "$left" tools/run_tests.sh --sweep | grep -vE "^ok "
case ${PIPESTATUS[0]} in
0) ;;
2|137) not_run+=("suites") ;;
*) failed+=("suites") ;;
esac
# 2. Smoke run.
run_step "smoke" "$GODOT" --headless --audio-driver Dummy --path . --quit-after 120 -- --sample
# 3. Soak run: exit code 1 means a roll hit an error or the action limit.
run_step "soak" "$GODOT" --headless --audio-driver Dummy --path . -s res://tools/simulate_board.gd -- \
--board=examples/logic_demo.json --start=start --runs=500 --quiet
# 4. Real windows on a hidden screen (never on the user's desktop).
if pgrep -x vrserver >/dev/null || pgrep -f "SteamLaunch" >/dev/null; then
not_run+=("windows"); echo "NOT RUN windows (SteamVR or a game is running)"
else
socket="tabletarot-sweep-$$"
kwin_wayland --virtual --no-lockscreen --socket "$socket" --width 1600 --height 1000 >/dev/null 2>&1 &
kwin_pid=$!
for _ in $(seq 50); do [[ -S "$XDG_RUNTIME_DIR/$socket" ]] && break; sleep 0.1; done
window_run=(env WAYLAND_DISPLAY="$socket" "$GODOT" --display-driver wayland --audio-driver Dummy --path . --)
run_step "window desktop" "${window_run[@]}" --sample --screenshot="$SHOTS/desktop.png"
run_step "window phone" "${window_run[@]}" --sample --mobile --screenshot="$SHOTS/phone.png"
kill "$kwin_pid" 2>/dev/null
echo "Screenshots: $SHOTS"
fi
took="$(( ($(date +%s%3N) - start_ms) / 1000 ))s of ${limit_secs}s"
(( ${#not_run[@]} )) && echo "NOT RUN: ${not_run[*]}"
if (( ${#failed[@]} )); then echo "RELEASE SWEEP FAILED: ${failed[*]} ($took)"; exit 1; fi
if (( ${#not_run[@]} )); then echo "RELEASE SWEEP OVER TIME ($took)"; exit 2; fi
echo "RELEASE SWEEP PASSED ($took)"