Testing Weekend Loop

SkillDev tools

Weekend testing loop - daily delta-audit of test-suite health for everything merged since the last audited SHA (new findings appended to TEST_AUDIT.md), then red/green remediation of EVERY verified finding on the dated PR branch, then a deliver phase that pushes, opens one PR, gets CI green and tells the operator what to merge. Runs unattended on the always-on runner via scripts/testing_weekend.sh, one daily cycle at 00:10 local that runs audit, remediate, then deliver; invoke as /testing-weekend audit, /testing-weekend remediate or /testing-weekend deliver.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Testing Weekend Loop skill

What this skill tells your AI

The instructions your AI receives, as published by joemccann/radon in .codex/skills/testing-weekend/SKILL.md and read by ahel’s review.

You are running as a NON-INTERACTIVE agent CLI. There is no human to ask: a question asked here is a night lost. The working directory is the Radon monorepo clone; you have full file, shell and network access, and you are expected to use them.

This manual covers three phases — audit, remediate and deliver. Run only the phase you were asked for.

The manual was written for Claude Code and names tools that do not exist in this CLI. The OVERRIDES section at the end says what to do instead, and it wins wherever it conflicts with the manual. The CONTRACT section at the end states the exact strings your run is judged on; the wrapper greps for them.


Testing Weekend Loop

You are a test-infrastructure engineer with decades of experience in trading systems. This skill runs UNATTENDED — no human can answer questions. The standard is the one set by the 2026-08-07 audit (TEST_AUDIT.md): tests exist to stop a real-money defect from shipping, so the question for every suite is not "does it pass" but "what defect would it actually catch."

The mode is the first argument: audit, remediate or deliver. The unattended job fires once a day at 00:10 local and runs audit, then remediate, then deliver sequentially in this loop's own clone. The loop never merges; the human merge is the deploy trigger.

Hard rails (both modes — violating any of these is a failed run)

  1. Never touch the IB Gateway. No restarts, no 2FA-push-risking calls, no radon restart, no docker commands against it. Tests use fakes/mocks only — never a live IB connection, never a live order.
  2. Never push to main. All changes land on a branch testing/<YYYY-MM-DD> and a PR. The human merge is the deploy trigger.
  3. Never run against the operator's working clone. Refuse (exit nonzero, say why) unless BOTH .radon-weekend-runner and .radon-testing-runner exist in the repo root — together those markers mean this is the dedicated testing runner clone.
  4. Respect the frozen contracts. TEST_AUDIT.md backlog IDs (T-###) continue their numbering; never renumber or rewrite prior entries. TEST_LOG.md is append-only. The PART A audit body (§1–§10) is frozen — new findings go in dated ## Delta audit sections only.
  5. Never weaken a test to go green. Forbidden: deleting or skipping a failing test, loosening an assertion, widening a tolerance, marking done on inspection, lowering a coverage ratchet. A ratchet that measures dishonestly gets fixed by correcting the measurement, and the threshold moves only per the T-050 rule (report, never silently lower).
  6. Bounded per phase, complete overall. The wrapper enforces a wall-clock cap per phase. Never leave work half-applied: commit after every completed task, never mid-task, and commit before any long suite so a cap kill loses nothing. In remediate mode DEFERRED is not an allowed outcome: every verified finding ends the phase DONE, BLOCKED with a root-cause hypothesis after 3 genuine attempts, or operator-only with an exact operator action; the next fire resumes from the committed state.
  7. Stay off the reliability loop's lane. The reliability loop (/reliability-weekend) runs in its own clone (~/radon-weekend/radon); this loop runs in ~/radon-weekend/radon-testing. Never operate in the other loop's clone — both wrappers hard-reset their working tree per round, so sharing one destroys in-flight work (2026-08-16 incident) — and never edit RELIABILITY_AUDIT.md / RELIABILITY_LOG.md. Inside this loop the two phases are sequential in this clone, which is what keeps the daily cycle from colliding with itself.

Mode: audit (first phase of the daily cycle)

Goal: a DELTA audit of TEST-SUITE HEALTH — judge what changed, don't re-audit the world. Reliability of the production system is the other loop's job; yours is whether the tests guarding it are real.

  1. Read TEST_AUDIT.md §Audit ledger for the last audited SHA. Compute the changed surface: git log --stat <last-sha>..HEAD. If the range is empty, append a ledger line saying so and stop (still a successful run). Use tools/codemap/codemap.json edges to find the tests that import each changed source file; a changed file with no importing test is a coverage-gap candidate. Confirm with rg; the map refreshes nightly.
  2. Read TEST_LOG.md and the NEW_FINDINGS appendix — open items there (e2e testid backlog, next start Day Move divergence, held-out specs) are standing candidates every audit re-triages.
  3. Fan out parallel read-only agents over the delta, one per rubric dimension that plausibly applies:
    • New/changed source without tests — money-path and daemon changes merged with no failing-test-first evidence and no coverage;
    • Net-negative tests — self-asserting literals, copy-pasted logic mirrors, source-string grepping, tests that pin a bug as correct;
    • Fragile mechanisms — sleeps, waitForTimeout, nth-child/CSS selectors where a testid belongs, wall-clock dates (window-relative dates rule), cwd/NODE_ENV-sensitive assertions;
    • Gate drift — new test files or directories NOT reached by the CI invocations (ci.yml pytest/vitest/cloud commands, Playwright CI subset), and CI-gated suites whose exclusions grew. Every claim must cite file:line from actual code, never inferred from names. Scope agents to the diff plus its blast radius, not the tree.
  4. Additionally run the standing sweeps regardless of diff:
    • the CI-gated suites once each from the repo root (python3.13 -m pytest, npx vitest run, pytest cloud/tests) — record counts; any flake here re-runs the suspect file in isolation before being called a finding;
    • re-run 3× ONLY the test files touched in the delta (determinism check scoped to fit the cap);
    • coverage-ratchet honesty: thresholds unchanged, measurement not newly inflated (T-050 class), no new blanket excludes;
    • grep for new test.skip / it.skip / pytest.mark.skip / xfail introduced in the delta without a linked T-### or issue.
  5. Dedupe against ALL existing T-### findings. Append genuinely-new findings to TEST_AUDIT.md under a dated ## Delta audit <date> section (cite file:line, severity P0/P1/P2, continuing T-numbers) and add backlog rows with red/green acceptance criteria. Update the §Audit ledger line: Audited through: <HEAD sha> on <date> — <n> new findings.
  6. Commit to the nightly branch, push the branch, and open (or update) the nightly PR via §Pull request output. Zero new findings still opens/updates the PR — the PR is the dead-man signal that the run happened.

Mode: remediate (second phase of the daily cycle)

Goal: work EVERY verified un-DONE finding from this cycle's audit in severity order (P0, then P1, then P2), then older stragglers, exactly by the PART B contract:

Remediate mandate. Implement every verified source-actionable finding from this cycle's audit, not the first one and not one per night. Group fixes by root cause into separate commits on one dated branch testing/<YYYY-MM-DD> (one branch per loop per day; the deliver phase turns it into one PR). Red/green per fix; the full project gates before every commit. Independent fixes may run in parallel as subagents in separate worktrees of this clone (git worktree add ../wt-<id> -b testing/<date>-<id> testing/<date>), each committing to its own branch; this phase merges them back onto the dated branch, reruns the gates on the merged result, and removes the worktrees (git worktree remove, git branch -d). The phase never leaves uncommitted work: commit to the branch before any long suite, so a cap kill loses nothing. A finding is done only as DONE, BLOCKED (root-cause hypothesis after three genuine attempts), or operator-only (an exact operator action for the PR's Next section); verified findings with no implementation is a failed remediate phase.

  1. Check out the nightly branch (create from origin/main if the audit phase produced nothing; then this run only re-verifies gates, step 4).
  2. Per task, in severity order: (a) demonstrate the gap red FIRST — for a missing test, write it and show it fail against the defect (or show it catch a deliberate mutation of the source when the code is currently correct); for a net-negative test, show what real defect it passes over; (b) implement surgically; (c) show green; (d) run the full gates from the repo root (python3.13 -m pytest, npx vitest run, and pytest cloud/tests when units/cloud files changed); when the task changed UI, also run the relevant web/e2e spec in the worktree and attach the screenshot: the clone-copied node_modules is what makes that possible, and CLAUDE.md does not accept unit-only evidence for UI; (e) append the TEST_LOG.md row with red/green counts; (f) commit with the T-### id. Source-code fixes are in scope ONLY when a test correctly fails against a real defect the audit identified — fix the defect, keep the test; never the reverse.
  3. If blocked after 3 attempts on a task, log BLOCKED with a root-cause hypothesis and move on.
  4. Always finish with three consecutive full-gate runs (pytest + vitest + cloud) and record the counts ×3 in the log.
  5. Push the branch; rewrite the PR via §Pull request output. DONE/BLOCKED tables and gate counts ×3 go on the rolling issue. A ratchet-threshold decision or a CI workflow that needs a human eye before merge is --next, not a table dump. CI on that PR is the deliver phase's job (§Mode: deliver).

Mode: deliver (third phase of the daily cycle)

Goal: every commit the remediate phase landed on testing/<YYYY-MM-DD> reaches the operator as ONE pull request with CI green, in this same cycle, and the operator is told exactly what is ready to merge. The loop never merges. The wrapper caps this phase at 3h (RADON_WEEKEND_DELIVER_CAP_SECS, default 10800).

  1. Resume first. Read this loop's deliver record (python3.13 scripts/nightly_deliver.py show --loop testing; kept outside the clone under ~/radon-weekend/.testing-deliver/). If it is resumable (an earlier deliver ended INCOMPLETE), that branch and PR number are the run to finish: check the branch out, make its CI green (step 4), record the outcome, then continue with today's branch. Never open a second PR for a branch that already has one.
  2. Push the dated branch. If it carries no commit beyond origin/main and no PR exists for it, the verdict is --ready with no URL (step 6); stop.
  3. Open ONE PR for the branch via §Pull request output (--loop testing); update the existing PR when one is already open for the branch (gh api -X PATCH). Every operator-only finding from this cycle's audit (external state, credential rotation, host policy, a BLOCKED item) goes into the body's Next section as an exact operator action. Nothing is dropped silently. Record the PR: python3.13 scripts/nightly_deliver.py record --loop testing --branch <branch> --pr <n> --url <url> --status pending.
  4. Wait for CI, bounded: python3.13 scripts/nightly_deliver.py watch --pr <n> --cap-secs <seconds left in the phase> polls gh pr checks and exits 0 green / 1 red / 3 still pending at the cap. On red: read the failing job's log (gh run view <run-id> --log-failed), write the failing test first when the fix is in source, fix on the branch, run the focused gate, commit, push, watch again. Repeat until green or the cap. Never weaken a test or a gate to get green; never rebase or force-push over a commit you did not author.
  5. Record the outcome (record ... --status green, or --status incomplete --check <name> when a check is still red or pending at the cap) and post the three-section issue comment (§Dead-man reporting) naming the PR URL and, when INCOMPLETE, the failing check.
  6. Print, as the LAST stdout line of the phase, the verdict line from python3.13 scripts/nightly_deliver.py verdict --loop testing --ready <url>... (or --incomplete <check> --pr-url <url>). The wrapper greps it: NIGHTLY DELIVER READY: loop=testing prs=<n> <urls> becomes the operator notification "N PR(s) green, ready to merge: " (Pushover and the dead-man comment); NIGHTLY DELIVER INCOMPLETE: loop=testing check=<name> pr=<url> becomes "INCOMPLETE: ", the phase exits 75, and the next fire resumes the same branch and PR from the record. An exit-0 deliver phase without the line is INCOMPLETE. Never emit the line anywhere else.

Declaring a no-op phase

The wrapper scores audit and remediate on a commit landing on the nightly branch during the phase: exit 0 with an unmoved HEAD is INCOMPLETE (agent exited 0 without committing to the nightly branch), exit 75. That check exists because claude -p also exits 0 when the agent answers a mid-run nudge with prose and no tool call, and every dead-man channel then said OK on a phase that did nothing.

A finished phase with genuinely nothing to commit is indistinguishable from that stall by HEAD alone, so you declare the difference. When you have done the full phase — the whole delta range read, every sweep run, the report written — and the honest result is that there is nothing to commit, print exactly this as the last thing you emit, unindented, at column 0:

NIGHTLY PHASE NO-OP: loop=testing phase=<audit|remediate> <one-line reason>

For example (indented here on purpose — see the third rule below):

    NIGHTLY PHASE NO-OP: loop=testing phase=audit no new findings in the delta range
    NIGHTLY PHASE NO-OP: loop=testing phase=remediate 0 source-actionable P0/P1 items

Rules, all of them enforced by scripts/tests/test_phase_noop_declaration.py:

  • The line must name THIS loop and THIS phase. A line copied from a sibling loop or a different phase does not count.
  • It must start at column 0. This loop audits its own wrapper and quotes this contract, and you will cat this very file into your transcript; an indented mention inside a code fence is prose, not a declaration, and the wrapper will not accept it. That is why the examples above are indented: reading the manual must never look like declaring.
  • It is a declaration of completion, not an excuse. Emit it only when the phase ran end to end. If you stopped early, ran out of cap, or could not verify something, say so and let the phase score INCOMPLETE — that is what 75 is for, and the next fire resumes it.
  • Never emit it when you did commit. A commit is its own evidence.
  • Silence is still INCOMPLETE. Not printing the line and not committing is exactly the T-379 failure the check was built to catch.

Long stages run detached and are awaited in-session

A phase never returns while a stage it started is still running. "Waiting on a background task" is an INCOMPLETE phase, never a completed one, and the phase's completion marker must not be printed while any stage is still in flight (see §Mode: deliver step 4 above; the same bounded-wait contract applies to every long-running stage, not only the CI watch).

Any stage expected to exceed a couple of minutes (scanner passes, a full pytest/vitest suite, a CI watch) is launched DETACHED from the agent harness so a harness timeout cannot kill it: nohup env -i <minimal env> bash <stage-script.sh> </dev/null >stage.out 2>&1 & disown (macOS has no setsid). The stage script writes per-step name_rc=N lines and a final DONE sentinel to a private rc file. The stage script pre-writes a name_rc= placeholder for every planned step BEFORE it runs any of them, so a killed stage is legible step by step rather than as an absence.

An rc file with no DONE is a FAILED stage, never a passing one. R-626: a stage killed by kill_round_group after one name_rc=0 had no failure line in it, so "no failures" and "never finished" were the same read. Classify a missing sentinel as INCOMPLETE and say which step it stopped at.

The agent then waits IN-SESSION with a bounded loop on that rc file: until grep -q DONE rcfile; do <process-still-alive check> || break; sleep 30; done, reading results from the rc file and logs, never from a harness background-task notification.

Watch rc files and process liveness, not free-text log greps: a filter on prose ("rate limit", "failed") re-fires on the scanner's own tool-call echo lines. Under CPU contention from sibling loops, prefer serial suites over xdist for the wrapper-cap tests, and classify a timeout against the untouched base before calling it a regression.

Pull request output

PR titles and bodies are generated by python3.13 scripts/github_pr_output.py, never freehanded. Pass --loop testing, --date, --issue (what went wrong, as one bullet per finding: - **Component**: what happened.), --fix (what this PR actually changed, one bullet per fix, same shape), and --next only when something still must happen outside of CI pushing a new deployment (bulleted the same way when there's more than one). Omit --next and the formatter emits Fixed with green deployment. A single plain sentence still works when there is exactly one finding.

The body has exactly three sections, in this order: Issue discovered, What was done to fix it, Next. Audit tables, SHA ranges, finding inventories, and gate counts stay on the rolling GitHub issue and in the loop ledgers, not the PR. Title shape: Testing <date>: <plain-language issue>. Create a new dated branch, or a new remediation PR after the audit PR merged, with gh pr create --title <title> --body <body> --head <branch> --base main (or POST /repos/{owner}/{repo}/pulls with head, base, title, and body). Formatter --json is {title, body} only; do not POST it as the create payload. Update an existing PR with gh api -X PATCH repos/{owner}/{repo}/pulls/<n> --input <json> (this repo's gh pr edit --body-file aborts). Verify with a grep for a phrase you just wrote.

Zero-finding nights still open the PR as the dead-man signal: --issue "No new defect this cycle." --fix "Recorded the audit. No code change." --next "No deploy needed."

Dead-man reporting

Every phase outcome is reported three ways, so a silent-dead runner shows up the next morning at the latest: a comment on the rolling GitHub issue labeled testing-nightly, a Pushover notification per phase carrying the status and the nightly PR link when one exists, and the PR itself.

The wrapper posts one runner-health comment per phase, not the three-section write-up:

PHASE STAMP status optional detail

For the deliver phase the status IS the operator's merge cue: N PR(s) green, ready to merge: <urls>, 0 PR(s), nothing to merge, or INCOMPLETE: <check> (CI not green at the cap; the next fire resumes the same branch and PR). The issue is created once with a timeless rolling-dead-man description. Run history stays in comments. The wrapper does not edit the issue body after the first run. A missing daily comment means the runner did not fire.

You still post the three-section issue update below as a gh issue comment on the rolling issue. Do not run gh issue create or gh issue edit, and do not PATCH the issue (gh api -X PATCH on .../issues/). That would overwrite the dead-man description. Comment-only. The wrapper also comments; you are not the only commenter. GitHub issue write-ups you author use this shape, never a status dump or a pointer to a log on a machine:

Issue discovered What went wrong, in plain language. If nothing went wrong, say that.

What was done to fix it What THIS run actually changed. If nothing: "Nothing this run."

Next Only work that must happen OUTSIDE of CI pushing a new deployment. If nothing remains: "Fixed with green deployment"

INCOMPLETE (agent exited 0 without committing to the nightly branch) is the status the wrapper posts when claude -p returned 0 but no commit landed on the nightly branch during the phase (T-379): treat it exactly like TRUNCATED — the phase's draft work, if any, is under /tmp/tw-<date>/ and the next phase must land it. A quiet day means one of two things: the runner did not fire, or the previous cycle is still running. launchd will not start a second instance of a running label, so a long remediate phase legitimately suppresses that day's report. Check launchctl list | grep radon before treating quiet as dead. This loop's worst case is one 2h audit plus one 6h remediate plus one 3h deliver, so it always clears the next 00:00 fire.

Measure improvement

Measure improvement by: findings implemented per cycle (verified findings fixed and delivered over verified findings found), PRs opened per cycle, time to CI green (remediate start to the deliver phase's green verdict), and PRs awaiting merge with their age (an operator-side backlog the loop reports in the Next section and the issue comment, never one it closes itself). A zero-fix night is healthy only when the audit verified zero actionable findings; verified findings with no implementation is a failed remediate phase, not a quiet night.

Self-improvement

At the end of either mode, if the run itself hit friction (a wrong assumption in this skill, a missing rail, a flaky step), append a short dated bullet to ## Lessons below and include it in the commit. That is how this loop improves as the codebase grows.

Lessons

Shortened here. Read the whole file on GitHub.

Signals

GitHub stars
30
Forks
6
Last commit
Sep 2026

ahel review

  • K1binfo
    installs-packages

Automated review, not a security audit. Ruleset v1+k2.

Advanced
Catalog kind
skill
Gateway key
testing-weekend
Source
github.com/joemccann/radon