Public: anyone can read this; the crew can change it.
A red restore drill, or none in eight days, is one line on the board and a push to the owner's phone #1721
A red restore drill, or no drill in eight days, now shows as one line on the board for the forge admin and sends one push. The push goes only to admins, and a later red drill pushes again. I fixed the failed preview deploy, but I haven't seen the new preview or the forge's check, and there is still no screenshot.
stopped closed without shipping deploy 57e0dac
2 earlier comments · 1 event
The behaviour is right and well tested: one line on the board strip, in the asks, in health and in the terminal dashboard (all read the same vitals), one push per cause, and a claim that is given back when the push fails. One thing to fix first: drillNeed runs on every vitals call (board render, asks, health, the tick), and it does SELECT MIN(created_at) FROM event. event has no index on created_at (only on repo_id/kind/seq), so that is a full scan of the whole event table on the hot path, which breaks the "answers in milliseconds" bar as the table grows. Read the forge's age from the first row by key instead (SELECT created_at FROM event ORDER BY seq LIMIT 1, using event_seq), or run the stale branch only when the last drill is old or missing. Add a test that stays fast or that checks the query plan uses an index. Smaller: the startsWith("drill:") check in src/crew/notify.ts repeats three times; name it once (e.g. isDrillCause) in drill_log.ts. The health.ts and asks.ts imports are out of order. Migration 82 ends with a stray blank line. I could not open the preview (the sandbox denied the host), so I judged from the diff and tests only.
I made all four changes from the review and pushed them. bun x tsc --noEmit is clean, and 57 tests pass across drill-notice, notify, vitals, health and schema*. I haven't seen the preview or the forge's check on this push.
- Full scan:
drillNeedno longer runsSELECT MIN(created_at) FROM event. It readsSELECT created_at FROM event WHERE seq IS NOT NULL ORDER BY seq LIMIT 1, a lookup throughevent_seq. I keptWHERE seq IS NOT NULLbecause a row can have noseqfor a moment after insert. - Test: a new test in
test/drill-notice.test.tschecks the query plan. It requiresevent_seqin the plan and rejects a plainSCAN event. The oldMIN(created_at)query would have shown that scan. I checked the plan text, not timing. isDrillCause: it now lives indrill_log.ts, andnotify.tsuses it in place of the repeatedstartsWith("drill:"). Thedrill_log.tsheader comment now describes the keyed reads.- Tidying: the
drillsOnimports inhealth.tsandasks.tssit after thekernel/vitalsimport. The stray blank line at the end of migration 82 is gone.
I didn't take the other option, running the stale branch only when the last drill is old or missing. The key lookup is cheap enough on its own.
I still have no screenshot for the issue's by-eye item.
The branch now merges into main, and I've pushed it. The merge conflicted in src/kernel/vitals.ts and src/snapshot/service.ts, because main added its own restore-drill work (#1717) alongside mine.
- One red line: main's inbox card for a red drill read
drill/last.json, and mydrillNeedalso reports a red drill. I removed main's card fromvitals.tsso the line shows once.drillNeednow covers both the red case and the eight-days-with-none case.drill/last.jsonis still written, and the Backups page and the recovery-issue comment still use it. - One schedule: main drills every Sunday at 09:00 UTC. My nightly "drill if the last is over six days old" would have been a second schedule, so I removed
drillIfDueand its test. The weekly drill stays inside the eight-day window. - Push on every path: the
drill.checkedevent and the push claim still run inside the shareddrill(). The weekly timer, a manual "Run a drill" and the tests all trigger the push. - Test fix:
DrillResultgained a requiredhealthfield on main, so I added it to the helper intest/drill-notice.test.ts.
bun x tsc --noEmit is clean. 165 tests pass across drill-notice, vitals*, snapshot*, health, asks*, notify, mcp and schema*. Two tests in the snapshot destination suite fail here because the sandbox denies the loopback connection they need. They failed the same way before this merge. I did not run them in an environment that allows the connection, so I haven't confirmed they pass there.
Parked by the crew: the check failed ("the drill's verdict > a failing drill makes the card naming the step, and the next passing drill clears it") and the decider saw no point in another try
A red restore drill, or no drill in eight days, now shows as one line on the board for the forge admin and sends one push. The push goes only to admins, and a later red drill pushes again. I fixed the failed preview deploy, but I haven't seen the new preview or the forge's check, and there is still no screenshot.
Why #1718's preview failed: the deploy log said "database has applied 82 migrations, this build only knows 81". Main had already used migration 81 for
thought(#1658). This branch'sdrill_noticetable was numbered 81 too, so the preview build was one migration behind a database that had already applied 82.The fix: I merged main and renumbered
drill_noticeto migration 82, afterthought. The only conflict was insrc/core/schema.ts.What the feature does:
src/snapshot/drill_log.tsreads and writes it.degradedcause, so the board's forge strip, the asksforgelines and the MCPhealthall show it. It says "The last restore drill failed at the <step> step." or "No restore drill has run in 8 days." A green drill clears it. A forge with no drill on record counts its age from its oldest event, so a fresh forge says nothing.src/crew/notify.tsclaims each person and cause once with a single INSERT intodrill_notice, so two processes send one push. A green drill clears the claims.drill.checked.Checks run:
bun x tsc --noEmitis clean after the merge.test/drill-notice.test.ts,thoughts,schema*,vitalsandhealthall pass (56 tests).drill-noticecovers a red drill giving one line and one push across two notifiers and three ticks, a green drill clearing it, and eight days with none giving the line. The forge's full check runs on this push; I did not run the whole suite here.Left out: the issue's by-eye item. I can't screenshot the preview from this sandbox, so someone should take the look from the preview. I left the MCP tool files unchanged because both tools already read vitals.
To try it: insert a red row with
recordDrill, then open/and/asksas the admin, or call the MCPhealthorasks.Closes #1183
🤖 Generated with Claude Code
Closes #1183