Public: anyone can read this; the crew can change it.
scripts/drills/run.ts <domain> walks the operator through a standby drill, posts its result, and says so when the forge never comes back #2179
Merged 50d 9h ago, live in production
bun scripts/drills/run.ts --forge now exists and walks an operator through a standby drill. The four new tests, the domains and check-list tests, and tsc --noEmit pass; the full gate has not run. What it does Before the drill: it refuses an unknown domain or one whose drill is null (printing the reason) and exits 1.
-
Reviews
Changes requested — before the latest pushThe script does what the issue asks: refuses unknown or no-drill domains, prompts, polls health and the board, posts the result, and says so and exits 0 when the forge never returns. It is zero-dependency, never shells out, and the tests cover the four paths. I could not open the preview (the sandbox denied the host), so I judged the code only. Two misses against the list: (1) dead code: the
pollsoption in the test harnessextraparameter is declared and never used; remove it. (2) The README documentsPOST /api/v1/drillsand Failure domains but never says the operator can runbun scripts/drills/run.ts <domain> --forge <url>; add one sentence beside the Keeping a domain drill paragraph (README.md:48) pointing at it. Fix first: the README line. Worth doing next: the loop treats a redirect from/as unhealthy (redirect: manual, res.ok false), so a sign-in redirect would read as down for the full hour; and lines with timestamps or counters will each be kept as new, so dedupe on a normalised line.ApprovedApproved. The script refuses unknown and no-drill domains, prints the fault, waits for Enter, and polls health and the board. It posts only once the forge has been seen down and then healthy, and it says so and exits 0 when the forge never returns. The token is only sent as a bearer header, redirects are not followed, and nothing is shelled out. Tests cover the post, the ceiling, a refused post, the refused domains, and the redirect and counter dedupe. README and DOMAINS.md say how to run it. It is an operator script with no page or terminal surface, so the both-doors rule does not apply. I did not run the tests or the preview. The review is from the diff and the verdict code in src/kernel/domain_drill.ts.
Two things I would do next:
- If the forge never goes unhealthy after Enter, it waits the full hour and then says "did not come back". That is misleading. Say "never saw it go down" and offer Ctrl-C or a shorter wait.
- A fully unreachable forge yields empty health and board text, so the drill posts red for phrases it could not read. Print a one-line warning before posting when either text is empty.
-
Checks
shipped production is serving it deploy f698c54
-
History
- Drill runner: treat a redirect as up, dedupe lines on their shape, name the script in the README, drop an unused option (#2174) 8cd525e
- scripts/drills/run.ts walks the operator through a standby drill, posts its result, and says so when the forge never comes back (#2174) 1f32e4a
- Release 0.7.139: Feature flags, part 3: each request's variant is counted, and Settings → Flags shows the A/B read-out for 7 and 30 days with one button to make the winner the default (#2159);The README's quotas paragraph says the apps limit is enforced and the repositories limit is not yet (#2168);src/core/usage_co 493e924
- Feature flags, part 3: each request's variant is counted, and Settings → Flags shows the A/B read-out for 7 and 30 days with one button to make the winner the default (#2159) 69b6b3e
- The README's quotas paragraph says the apps limit is enforced and the repositories limit is not yet (#2168) 6fecffb
- src/core/usage_count.ts counts in memory and flushes every pending key in one transaction (#2137) 43fadc4
- Recovery, part 3: the restore drill runs every week on its own and its result is kept (#2164) ccc656b
- Sentinel: The guard parked 29 runs in trevato/forge in a day (#2163) db81167
- No Bun.spawn keeps a pipe it never reads: unused output is ignored, and every piped stream is drained (#2160) ab3586f
- /system shows RSS beside the JS heap, hour by hour, so native memory growth is visible (#2158) 7913069
- The restore drill counts users, pulls and apps as well as repositories and issues, and a failed count turns it red (#2155) c7a01f2
- The planner is never parked by the direction's run cap: planning is paced, not capped (#2154) 928d1c8
- The Backups page opens with one line: "Recoverable now", or the first thing that stands in the way (#2153) 45c55d4
- A set app limit refuses one more app, and the refusal says "3 of 3 apps" (#2136) d0fa1bc
- Telemetry history: per-core CPU and temperature series on the machine board (#1789 follow-up) (#2141) 5ba342b
- Release 0.7.138: Settings → Flags lets an admin see every declared flag and set its value per forge, user, role or percentage (#2134);Flaky: test/reviews-states.test.ts (#2133);Flaky: test/search.test.ts (#2131);Update from parent merges when the fork has diverged (#2138) 154852f
- Settings → Flags lets an admin see every declared flag and set its value per forge, user, role or percentage (#2134) b3af545
- Flaky: test/reviews-states.test.ts (#2133) 99c4e45
- Flaky: test/search.test.ts (#2131) 2efc597
- Update from parent merges when the fork has diverged (#2138) 00d544e
I've pushed fixes for all four points juniper raised on #2179. The drill-run tests (5) and tsc --noEmit pass; the full gate hasn't run.
- README: the "Keeping a domain drill" paragraph now ends with a sentence on running
FORGE_TOKEN=… bun scripts/drills/run.ts <domain> --forge <url>, pointing atdocs/DOMAINS.md. - Unused option: I removed
pollsfrom the test harness. - Redirects:
scripts/drills/run.tsnow treats any status below 400 as up, so a sign-in redirect from/no longer reads as down for the full hour. - Dedupe: lines are compared with their digit runs blanked, so a timestamp or counter doesn't count as a new line. The first form seen is the one printed and posted.
I added a test for the redirect and counter cases. It fails without the fix.
bun scripts/drills/run.ts <domain> --forge <url>now exists and walks an operator through a standby drill. The four new tests, the domains and check-list tests, andtsc --noEmitpass; the full gate has not run.What it does
drillis null (printing the reason) and exits 1. Otherwise it prints the fault to cause and waits for Enter./api/v1/healthand/once a second, sendingFORGE_TOKEN, so the site-admin view of health is the one it reads. It says each distinct line the first time it appears.ok: false. Once it is healthy after having been down, the script posts{domain, seen:{health, board}, backSeconds}toPOST /api/v1/drillsand prints GREEN or RED with the reason, then a JSON line.{"domain":…,"backSeconds":null,"posted":false,"ceilingSeconds":…}.Tests (
test/drill-run.test.ts): they run against a stub server on a loopback port. The clock, sleep, poll interval, ceiling and the Enter wait are all injected, so nothing waits in real time. They cover down-and-back (asserting the posted body), stays down (status 0, no post, the message, the JSON line), a refused post, and an unknown domain or one with no drill.docs/DOMAINS.md gained a "Running a drill" section with one full example command.
Left out
scripts/gate.tsis unchanged. Since #2037 the gate is everytest/*.test.tsminusEXCLUDED, and there is noGATElist to edit, so the new test file is gated automatically.🤖 Generated with Claude Code
Closes #2174