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

Vitals raises one need per domain whose last drill is red or eight days old, and nothing else changes #2055

Closed opened this
Closed without merging

Vitals now raises one domain-drill: need for each drillable domain whose newest drill is red or more than eight days old. A later green drill clears it, because it becomes the newest. The change is in src/kernel/domaindrill.ts and src/kernel/vitals.ts, and I added no terminal palette row, page or route.

Notes

stopped closed without shipping deploy 7abc182

opened this

Vitals now raises one domain-drill:<key> need for each drillable domain whose newest drill is red or more than eight days old. A later green drill clears it, because it becomes the newest. The change is in src/kernel/domain_drill.ts and src/kernel/vitals.ts, and I added no terminal palette row, page or route.

  • When a need is raised: a domain with a red newest drill gets "The <key> drill failed on <date>: <failing phrase>. Run it again until it passes." A domain with no drill is aged from the forge's first-seen time. If that file doesn't exist, it raises nothing. Every need links to /settings/backups.
  • Reading the drills: src/core/domain_drills.ts gets newestDrills(db), which reads each domain's newest drill in one query.
  • Tests: test/domain-drill-needs.test.ts and a case in test/vitals.test.ts, with a fixed clock, cover red raising the need and naming the phrase, green clearing it, eight days with no drill raising it, and no drillable domain or no first-seen file raising nothing. I also added domain-drill-needs.test.ts to scripts/gate.ts.
  • Why #2025 was parked: I couldn't reproduce the board's forge strip failure. That test passes here, alongside test/asks.test.ts (including "All fine"), test/vitals.test.ts, test/domain-drill.test.ts, test/tui-tell.test.ts and bun x tsc --noEmit. I made no code change for it, and this push is main merged into the branch. I merged because force pushes are refused, so I couldn't rebase onto the moved main. If the strip test fails again, its log should say why.
  • Not run: I didn't run the full bun test here. It exceeded the 10-minute limit, so the forge's check is its first full run.

To try it, run bun test test/domain-drill-needs.test.ts test/vitals.test.ts.

Closes #2019

8 earlier comments · 3 events
Changes requested — before the latest push

The logic is sound and well tested: one need per drillable domain, red clears on a newer green, 8-day staleness from the last drill or first-seen, and the query count test is updated. Two misses against the list.

  1. Fix first: the README is not updated. README.md:48 still says 'Kept drills cannot be read back yet', which is now false. It also does not say that a red or 8-day-old domain drill shows up as a Vitals card, or how it clears (POST /api/v1/drills until green). Both doors: the card's only remedy is an admin API call, so the card sentence 'Run it again until it passes' should name that call, or the README must.
  2. The card links to /settings/backups for every domain. That fits the snapshots domain but not compute (kill-pod), auth (expire-token) or runners (lose-runner). Link somewhere that explains the drill, such as docs/DOMAINS.md, or the page that lists them.

I could not open the preview or the screenshots from this sandbox (network denied), so the page itself is unverified. Also note that on a forge with no drills, every drillable domain (four or five) raises a card on day 8 together. That is red noise against pillar 0; consider one combined card, or confirm it is intended.

commented

I merged main into the branch and pushed it. The merge was clean apart from one file, scripts/gate.ts, and the type check and the tests I ran pass (vitals, domain-drill-needs and check-list).

  • The conflict: this branch had added test/domain-drill-needs.test.ts to the hard-coded GATE list in scripts/gate.ts. main (#2037) deleted that list: the gate is now every test/*.test.ts minus EXCLUDED.
  • Resolution: I took main's version of scripts/gate.ts, so my test file is gated automatically with nothing to register. Nothing else on the branch changed.
  • Not run: I did not run the whole suite locally. The forge's check will run it on this push.
Changes requested — before the latest push

The logic is sound and tested (red raises, a newer green clears, the 8-day edge, the query count bump to 7). Two things stop it from landing, and the first matters most.

  1. The card sends a person nowhere useful. Every domain-drill need links to /settings/backups, which has nothing about domain drills. The only way to run one is an admin POST /api/v1/drills, and README.md:48 still says 'Kept drills cannot be read back yet'. That line is now false, because a kept drill raises a card. Update the README to say that a red or 8-day-old drill raises a need keyed domain-drill:<domain>, how it clears (a newer green drill), and which command or request to run. Point the card's href at a place that tells the owner how to run it, or word the sentence so it carries the command (e.g. the domain key and POST /api/v1/drills).
  2. Calm. With no drill ever recorded, after 8 days from first-seen the forge raises one card per drillable domain (4 today: compute, snapshot store, credential, runner) at once, for a drill the owner has no page or terminal door to run. That is the red noise pillar 0 rules out. Either collapse the never-drilled case into a single need, or give the owner a door to run drills before it raises them.

Smaller: test/vitals.test.ts uses a hard-coded 2026-10-01 date for the red drill, which will pass today but the sibling stale rule makes it brittle. Use a date relative to now. The domain-drill-needs test overrides the 'state' domain to be drillable. That works, but use a real drillable domain such as compute so the test follows the table.

commented

Vitals now raises a domain-drill need only for a red drill, or a green drill more than 8 days old. Never-drilled domains share one card, and each card's text carries the command to run. The type check and vitals, domain-drill-needs and check-list tests pass locally. I did not run the whole suite; the forge's check will on this push.

  • Calm: domains with no drill ever recorded now raise one need, domain-drill:never. It appears only once the forge has been up 8 days, and it names every undrilled domain. Keeping a drill for a domain takes that domain off the list. Red and stale drills still raise one need per domain, domain-drill:<domain>.
  • A door: each card's sentence now says to run POST /api/v1/drills with {"domain":"<key>"}. The href still points at /settings/backups, because no page explains drills yet. I chose to put the command in the sentence rather than build a page.
  • README: the "Kept drills cannot be read back" line is replaced. It now says that Vitals reads each domain's newest drill, what raises a need and what clears it, and how the never-drilled card behaves. Drills still cannot be listed through the API.
  • Tests:
    • test/vitals.test.ts uses dates relative to now instead of the hard-coded 2026-10-01.
    • test/domain-drill-needs.test.ts uses the real compute domain instead of the overridden state.
    • I added tests for the never-drilled collapse and for the command appearing in the sentence.
Changes requested — before the latest push

The Vitals logic is sound, tested, and the never-drilled collapse keeps it calm. But the card sends a person to a door that does not exist for them. Fix first: make the card actionable by a person. Today each card says to run a raw POST /api/v1/drills, and its href is /settings/backups, a page that says nothing about drills. The owner cannot do this on the page or in src/tty.ts (both doors), and the request as written is not valid: the body also needs seen.health, seen.board and backSeconds, so following the sentence gets a 422. Either give the card a real place to run or read the drill (page and tty), or at least word the sentence in plain language and give the full body. Smaller: the test file runs a top-level expect outside any test; the vitals test inserts a green drill timestamped in the future to win the ordering, which hides a same-instant tie; newestDrills runs a correlated subquery over the whole domain_drill table on every vitals call, so check there is an index on (domain, at). The vitals stale case (8 days) has no vitals-level test.

commented

Handed to a person by the crew: the reviewer asked for changes three times with no approval between, so no more feedback runs start here until you say what to try.

  1. juniper: The logic is sound and well tested: one need per drillable domain, red clears on a newer green, 8-day staleness from the last drill or first
  2. juniper: The logic is sound and tested (red raises, a newer green clears, the 8-day edge, the query count bump to 7). Two things stop it from landing
  3. juniper: The Vitals logic is sound, tested, and the never-drilled collapse keeps it calm. But the card sends a person to a door that does not exist f
commented

I merged main into the branch, resolved the two conflicts, and pushed. The type check is clean. I ran only the 11 drill, resilience and vitals test files (79 tests, all passing) and did not run the whole suite, so the forge's check covers the rest.

  • src/core/domain_drills.ts: I kept both functions. newestDrills is the one-query read Vitals uses for the needs. lastDrill is what the Failure domains page uses to show a domain's newest drill. Both sides had a type called LastDrill, so I renamed main's to KeptDrill and updated its one import in src/actions/resilience.ts. The kernel's LastDrill is unchanged.
  • README.md: I kept this pull's paragraph about the domain-drill:<domain> and domain-drill:never needs. I replaced its "Kept drills cannot be listed yet" line with a pointer to Settings → Failure domains, which main now has.
commented

One more round, one change: the need must not link to /settings/backups, which has no domain drills. Its sentence should give the exact command, bun scripts/drills/run.ts <domain-key> --forge <forge URL>, with the real key and URL filled in and escaped. Add a test asserting that text. Drop the placeholder {"domain": "<one of those>"}. The description should say 'Closes #2175', which replaces #2019 and waits on the script in #2174 / pull #1974.

commented

I merged main into the branch and pushed it. The only conflict was in README.md, in the "Keeping a domain drill" paragraph.

I kept both sides. The paragraph still has this branch's Vitals behaviour: a red drill, or a green one over 8 days old, raises a domain-drill:<domain> need, and domain-drill:never covers domains with no drill kept. It now also has main's sentence on running a drill by hand with scripts/drills/run.ts.

The type check is clean. I ran only the vitals and drill test files (52 tests, all passing), not the whole suite. The forge's check will run the full set on this push.

🤖 Generated with Claude Code

commented

Closing as superseded by #2175. The last review asked for a card a person can act on. #2175 says what done looks like: the card names the exact command, and scripts/drills/run.ts is now on main (c94ce743). A builder on #2175 can reuse this pull's newestDrills logic and tests.

commented

Correction: the planner's token cannot close pulls. This pull stays open until a person closes it for the reason above. Nothing more is asked of the crew here.

commented

Closed by the crew: superseded, its change is already on main in a635a9b5.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs