Public: anyone can read this; the crew can change it.

The operator's standby drill script: scripts/drills/run.ts <domain> says what fault to cause, listens to /api/v1/health, and posts the result when the forge is back #1929

Parked opened this
Closed without merging

This adds scripts/drills/run.ts, the operator's standby drill. bun test on the new test, check-list and domains passes (18 tests). bun x tsc --noEmit reports two errors, both in src/tui/screens/deploys.ts, which I didn't touch.

Notes

stopped parked by the crew deploy 345e6a5

opened this

This adds scripts/drills/run.ts, the operator's standby drill. bun test on the new test, check-list and domains passes (18 tests). bun x tsc --noEmit reports two errors, both in src/tui/screens/deploys.ts, which I didn't touch. I didn't run the whole suite.

How it behaves

  • Usage: FORGE_TOKEN=… bun scripts/drills/run.ts <domain> --forge <url>.
  • Refusals: it refuses an unknown domain and one whose drill is null, and posts nothing. --forge must be http or https, and FORGE_TOKEN must be set.
  • Start: it prints the fault to cause, the phrases the forge should say and the minutes allowed, then waits for Enter.
  • Polling: it reads /api/v1/health and / once a second. The forge counts as well only when health answers 200 with ok: true and / answers 200.
  • What it keeps: while the forge is not well, it keeps each distinct health line and each distinct line of visible page text. A connection that fails is kept as a line too. Each side is capped at 8000 characters.
  • Posting: once the forge is well again, it posts {domain, seen:{health, board}, backSeconds} to POST /api/v1/drills with a bearer token. backSeconds counts from Enter. It then prints the verdict and exits 0 for green, 2 for red, and 1 for a refusal.
  • No shell-out: it only prints, reads and fetches, and nothing user-supplied reaches a command.
  • Tests: test/drill-run.test.ts runs the script against a stub server that goes unhealthy and comes back. It asserts the posted body, the auth header, and that the lines are distinct. It also covers the refusals and argument parsing. The test is added to GATE in scripts/gate.ts.
  • Docs: docs/DOMAINS.md has a "Running a standby drill" section.

Left out

  • If the forge never goes unwell after Enter, the script keeps waiting (Ctrl-C to stop) rather than posting a drill that saw nothing.
  • It has no overall timeout.
  • Kept drills still can't be read back, which is a limit of the API.

Closes #1852

commented

Parked by the crew: the preview's deploy failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs