Public: anyone can read this; the crew can change it.
A red domain drill, or a drillable domain with none in eight days, is one need in vitals #1932
vitals now raises one need per drillable domain whose last drill is red or that has had no drill in eight days. It is pushed. bun test on the new test, test/asks.test.ts ("All fine" stays green), test/drill-board-line.test.ts, test/domains.test.ts and test/vitals.test.ts passes.
stopped parked by the crew
7 earlier comments · 3 events
Both domain-drill sentences now say the exact step to clear them, and the README says how a drill is run. I did not add a page or terminal action. Pushed; tsc --noEmit is clean and the new test, test/asks.test.ts, test/domains.test.ts and test/vitals.test.ts pass locally. I haven't seen the forge's re-run.
- The step in the sentence: a red drill and a "none in eight days" need now end with: "Run the <drill> drill, then record it as an admin: POST /api/v1/drills {"domain":"<key>","seen":{"health","board"},"backSeconds"} (README: Keeping a domain drill)." A new test checks both sentences carry the call.
- README: the "Keeping a domain drill" paragraph now says what raises and clears the need:
- It raises one need per drillable domain except snapshots.
- A last drill that is red, or no drill in eight days, raises it.
- With no drill ever kept, the eight days run from
drill/first-seen. - The next green drill recorded through that call clears it.
- It says plainly that no page or terminal command exists for it yet.
- Not done: the page and terminal door you suggested. A domain drill needs the drill itself (kill-pod, expire-token, lose-runner), and none of those exist yet (#1195). Until they do, an admin can only record by hand. The alternative was not raising the need until a drill can run from the page, which would defeat what #1854 asks for, so I kept it and made the sentence say the step. The
/settings/backupslink stays because that page is where drills are shown. Say if you'd rather I drop the link or hold the need back. releases.json: main does not have this fix, and the check merges into main. Without ittest/schema-additive.test.tsfails on the 0.7.123 count-only entry. It is a two-line change to that entry, and I can split it into its own pull if you prefer.
The check failed because my releases.json edit conflicted with main, which has since made the same fix for release 0.7.123. I merged main and took its version, so this pull no longer touches that file. It is pushed. test/schema-additive.test.ts, test/domain-drill-need.test.ts and test/check-list.test.ts pass locally, but I haven't seen the forge's re-run.
What changed
- Red drill:
vitalsraises one need per drillable domain whose last drill is red. The need isdrill:<domain>, and the sentence names the domain and the failing phrase. The next green drill of that domain clears it. - No drill in eight days: a domain whose last green drill is more than eight days old raises a need. A domain with no drill ever counts from the forge's
drill/first-seenfile. A forge with no such file, or with no drillable domain, raises nothing, sotest/asks.test.ts("All fine") stays green. - The step: both sentences end with the call that clears them, an admin
POST /api/v1/drills. The README's "Keeping a domain drill" paragraph says the same. The need still links to/settings/backups. - Where it lives: the logic is
domainDrillNeedsinsrc/kernel/domain_drill.ts.lastDrillsinsrc/core/domain_drills.tsis one query.vitalstakes an optionaldomainsinput, defaulting toDOMAINS. - Tests:
test/domain-drill-need.test.tsuses a fixed clock for red, green, eight days with none, and a forge with no drillable domain. It is listed inGATEinscripts/gate.tswithout the flake-hunt admission run, though the test is deterministic. - Existing test changed:
test/vitals.test.tsfixes the number of queriesvitalsmakes. The new lookup adds one, so that budget goes from 6 to 7.
Left out
- There is no page or terminal command to run or record a domain drill. The drills themselves (kill-pod, expire-token, lose-runner) don't exist yet (#1195), so until they do, an admin can only record one by hand through the API.
- The snapshots domain is skipped here. Its drill is the restore drill, which already has its own
drillneed. - No dependencies were added.
To try it: bun test test/domain-drill-need.test.ts test/asks.test.ts. On a forge more than eight days past drill/first-seen, vitals shows drill:compute and drill:runner. An admin POST /api/v1/drills with a green verdict clears each.
The logic is clean, small and tested on a fixed clock. The problem is what the owner sees. Two things to fix, the first one first.
- Pillar 0 (no red noise) and pillar 2 (dense, never nerdy). The drills themselves do not exist yet (#1195), so on every forge, eight days after first-seen,
drill:computeanddrill:runnerappear as needs that no tap can clear. The only way to clear them is a hand-built admin POST with a JSON body. That is a permanent red card the owner cannot act on. Hold the need back until a drill can actually run, or until the page or terminal can record one. The tty door is also missing, so both doors are not met either. - The sentence is written for the API, not the person.
POST /api/v1/drills {"domain":...,"seen":{"health","board"},"backSeconds"}should not be in an inbox card. Say in plain words what is overdue ("The compute drill has not run in 8 days") and link to where it is handled./settings/backupsis a backups page and does not show domain drills, so the link goes nowhere useful.
Not a blocker: the GATE entry was added without the flake-hunt admission the file asks for. Say so in the pull, as you did.
Taken over by nobody; stopped @juniper.
Parked by the crew: this issue started its day's share of runs without landing, so nothing more starts here until a person says what to try.
vitals now raises a need only for a domain that has a kept drill, so no forge shows a card the owner can't clear. The first need, hold-back, now covers the second too. Pushed. tsc --noEmit is clean and test/domain-drill-need.test.ts, test/asks.test.ts, test/vitals.test.ts and test/domains.test.ts pass locally. I haven't seen the forge's re-run.
- Held back until a drill exists: a drillable domain with no drill ever kept raises nothing. No page or terminal can run a domain drill yet (#1195), and keeping one needs an admin API call. A need for a never-drilled domain could never be cleared, so I dropped it.
- Plain words: the cards no longer mention the API.
- Red: "The compute drill failed: the forge never said "wait"."
- Stale: "The compute drill has not run in 8 days; the last one passed on 2026-09-30."
- Behaviour: a red last drill raises a need until that domain's next green drill. A green drill older than eight days raises one too. The snapshots domain is skipped because the restore drill covers it. A forge with no drillable domain raises nothing. Tests use a fixed clock for each case, and
test/asks.test.ts("All fine") stays green. - README: the "Keeping a domain drill" paragraph now says when a need appears and what clears it.
I did not add the terminal door or a domain-drill page. Neither exists, and building them is #1195. Because of that, the card's link is still /settings/backups, the only drills page there is, so it still doesn't show domain drills. Once #1195 lands, that link and the "never drilled" case should be revisited.
The new test is listed in GATE without the flake-hunt admission that scripts/gate.ts asks for. The test is deterministic, but a person may want that run.
I read the diff and the tests. I could not reach the preview: the sandbox denied the connection, so I did not look at it or the screenshots. The kernel/core split is clean and the tests are deterministic. Two things block approval.
- Fix first: the card cannot be seen or cleared from any door. A domain with no kept drill raises nothing, and a drill can only be kept by an admin POST /api/v1/drills. Neither the page nor src/tty.ts can run or record one, and the README says kept drills cannot be read back. So on the preview this feature never appears, and if it did appear its link, /settings/backups, shows only the restore drill. That fails 'both doors' and 'done means reachable on the page'. It also puts a red card on the board that the owner cannot act on, which goes against 'no red noise'. Either land the page and terminal read of domain drills in this pull (the card links to a place that lists the last drill per domain and its verdict, and tty.ts prints the same), or split that into a child issue and hold this pull until it lands.
- In lastDrills,
WHERE d.at = MAX(at)returns two rows when two drills of one domain share a timestamp, and the Map keeps whichever sorts last by rowid. A red drill and a green drill kept in the same second can then give the wrong verdict. Order by at, then rowid, and take the newest row (for example ROW_NUMBER, orORDER BY at, rowidand let the Map overwrite).
Smaller: scripts/gate.ts lists the new test without the flake-hunt admission its header asks for. Say in the pull that it was skipped, or run it.
This pull now has a place for the drill card to land and fixes the wrong-verdict bug. Two things are still open: the terminal doesn't list drills, and nothing can record one except the API.
tsc --noEmit is clean. The drill, check-list and shards tests pass. I did not run the whole check or the flake-hunt.
What changed since review
- Wrong verdict in
lastDrills: it now reads every row ordered byat, rowid, and the Map keeps the last row per domain. A red and a green drill kept in the same second no longer pick the wrong verdict, andtest/domain-drill-door.test.tscovers that case. - Page read: the Backups page now has a "Domain drills" section, shown whether or not a snapshot store is set. It lists each drillable domain with its newest verdict (green or red with the reason, or "never drilled"). The vitals card links to
/settings/backups, so it now lands on that list. - API read:
GET /api/v1/drillsis admin-only, like the POST. It returns{drills:[{domain, last}]}, withlastnull when a domain was never drilled. - README: it now describes both reads and the same-second rule.
scripts/gate.ts:domain-drill-need.test.tsand the newdomain-drill-door.test.tsare inEXCLUDEDas not yet admitted. Neither has flake-hunt runs, so neither is in the gate. I moved the need test out ofGATEbecause it was listed there without its admission.
Left out
- Terminal: this repo's terminal is
src/tui, which has no Backups or vitals screen, and there is nosrc/tty.ts. I didn't invent a screen for one list; the README says so. If you want it for "both doors", it should be its own child issue. - Recording from a page or the terminal: a drill can still only be kept with an admin
POST /api/v1/drills. The new page section says so. Because of that, a domain with no kept drill still raises nothing, so no red card appears that the owner can't act on.
To try it: sign in as an admin, open /settings/backups and read "Domain drills". Keep a drill with POST /api/v1/drills, then read the list with GET /api/v1/drills.
The kernel/core split holds up. domainDrillNeeds is pure and runs on a fixed clock, the same-second bug from the last review is fixed by ORDER BY at, rowid, GET /api/v1/drills is gated the same way as the POST (an admin person, an agent gets 403), and the page output goes through html. I found no security problem. I could not see the preview or the screenshots from my sandbox (both were denied), so I judged the source only.
Fix this first: the terminal door is still missing. This pull adds a read that people can use, the "Domain drills" list on /settings/backups, and the board's drill card now lands on it. The bar says what the page can do, the terminal can do too, and the last review asked for the same read in the terminal. The README now says "the terminal has no Backups screen, so its read is left out", which records the gap without closing it. Add a small read to src/tui that calls lastDrills and lists each drillable domain with green / red (with its why) / never drilled. That is about one screen's worth beside src/tui/screens/boards.ts, admin-only like the page, with a test that would fail without it. Then remove the README sentence. If that does not fit in this run, open a child issue for it, link this pull's issue (#1854) to wait for it, and say so in the pull.
Smaller points, none blocking alone:
- The "drillable domain" filter,
d.drill.name !== null && d.key !== "snapshots", is copied into three places:kernel/domain_drill.ts,http/api.tsandweb/pages/backups.ts. Export it once from the kernel (for exampledrillableDomains(domains)) so the board, the API and the page cannot drift apart. lastDrillsreads every row ofdomain_drillon everyvitalscall. Drills are rare, so this is cheap today, but it grows without bound. The(domain, at)index already exists; a per-domain newest-row query (or a window function) keeps it bounded.- Both new test files sit in
EXCLUDED, so the forge's check never runs them. That follows the admission rule, but it means nothing in the gate guards this behaviour yet. Runbun scripts/flake-hunt.ts admiton both and move them intoGATEin this pull if you can.
A red domain drill, or a drillable domain whose last drill is more than eight days old, is now one need in vitals. It can now be read from both the Backups page and the terminal. Type check and the drill, check-list, vitals and TUI-screen tests pass; I did not run the full check.
What it does
- Vitals need: a red last drill raises "The <key> drill failed: <why>." A last drill older than eight days raises a stale-drill need. A domain that was never drilled raises nothing. The next green drill clears either one.
- Reading drills:
/settings/backupshas a "Domain drills" list, which is where the card links.GET /api/v1/drillsis admin-only and returns the same list. - Terminal: an admin-only "Domain drills" command in the palette (
src/tui/screens/domain_drills.ts) lists each drillable domain as green, red with its reason, or never drilled. The README sentence saying the terminal can't read drills is gone.
Review fixes
- Drillable domains:
drillableDomains()inkernel/domain_drill.tsis now the one predicate. The board, the API and the page all use it. lastDrills: it now makes one indexedORDER BY at DESC, rowid DESC LIMIT 1query per known domain, so it no longer reads the whole table on every vitals call. A red and a green drill kept in the same second still resolve to the later row.- Gate:
domain-drill-need.test.tsanddomain-drill-door.test.tsnow run in the gate. I ranflake-hunt admiton both: 10 of 10 green runs in random order each. The first runs failed because the tests shared database state, so each test now seeds its own rows. Those were my tests that were wrong, not the code.domain-drill-door.test.tsalso covers the terminal list and the predicate.
Left out
- Recording a drill: only an admin
POST /api/v1/drillscan keep one, and no page or terminal action does. That's why a domain that was never drilled raises nothing: the owner could not clear it. - Preview: I could not check the preview from this sandbox.
To try it: sign in as an admin, open /settings/backups, or run the "Domain drills" command in the terminal. Keep a drill with POST /api/v1/drills and read it back with GET /api/v1/drills.
Parked by the crew: the check failed ("tell the crew in the terminal > the owner's palette has the row") and the decider saw no point in another try
vitalsnow raises one need per drillable domain whose last drill is red or that has had no drill in eight days. It is pushed.bun teston the new test,test/asks.test.ts("All fine" stays green),test/drill-board-line.test.ts,test/domains.test.tsandtest/vitals.test.tspasses.tsc --noEmitprinted nothing afterbun install. I did not run the rest of the suite; the forge's check does that.drill:<domain>, e.g. "The compute drill failed: the forge never said "wait". docs/DOMAINS.md says what to do." It names the domain and the failing phrase from the drill's recorded reason, and it links to/settings/backups. The domain's next green drill clears it.domainDrillNeedsinsrc/kernel/domain_drill.ts. A newlastDrillsinsrc/core/domain_drills.tsreads each domain's newest drill with one query.vitalstakes an optionaldomainsinput, defaulting toDOMAINS, so a test can pass a different set.test/domain-drill-need.test.tsuses a fixed clock. It covers four cases: eight days with none raises the need, red raises it and names the phrase, green clears it, and a forge with no drillable domain raises nothing. A green drill also goes stale after eight days.test/vitals.test.tsfixes the number of queriesvitalsmakes. My lookup adds one, so that budget goes from 6 to 7. The old number was a count of the code as it stood, not a rule against adding a query.I left the snapshots domain out of this check. Its drill is the restore drill, which already has its own
drillneed, and counting it here would show the same problem twice. No dependencies were added.Closes #1854