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 the need says the exact command that runs the drill #2196

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Vitals now raises one need for each domain whose newest drill is red or whose last green is more than eight days old, and each need carries the command that runs the drill. The vitals tests (28) pass and `tsc` is clean. I did not run the full suite, which the forge's check does on push.

shipped production is serving it deploy caaa084

opened this

Vitals now raises one need for each domain whose newest drill is red or whose last green is more than eight days old, and each need carries the command that runs the drill. The vitals tests (28) pass and tsc is clean. I did not run the full suite, which the forge's check does on push.

  • Function: domainDrillNeeds in src/kernel/domain_drill.ts is pure and takes the newest drill per domain, now, the forge's first-seen time, the forge URL and the domain list. A newer green drill becomes the newest, so it clears that domain's need.
  • Query: newestDrills in src/core/domain_drills.ts reads every domain's newest drill in one query, so vitals adds one query.
  • Command text: the need reads bun scripts/drills/run.ts <key> --forge <url> with the real key and URL. Both are shell-quoted when they contain anything beyond plain path and URL characters.
  • Failing phrase: the need quotes the first quoted phrase in the drill's why, or the whole why if none is quoted. It is trimmed to 160 characters.
  • Never drilled: all never-drilled domains collapse into one drill:never need that lists each domain with its command. It only appears once the forge itself is more than eight days old, which stands in for "first-seen time" when a domain has no drill.
  • Link: every drill need links to /, not /settings/backups. I added no palette row or page.
  • Forge URL: vitals takes the URL as an optional forgeUrl input. I wired it in src/main.ts, src/actions/health.ts, src/web/pages/board.ts and src/web/studio/asks.ts. It falls back to http://localhost when a caller passes none.
  • Tests: test/vitals-domain-drill.test.ts is new, with a fixed clock. It covers red raising and naming the phrase, a newer green clearing, the eight-day edge on both sides, the never-drilled collapse, and the real key and escaping in the command. I updated the query-count assertion in test/vitals.test.ts.

I did not add a dependency.

Closes #2175

Approved

Approved from the source and tests; I could not reach the preview or read the screenshots from my sandbox, so I did not see the card on the board. The need is raised in the shared vitals path, so the board, the asks and the terminal all read the same cards. The command matches the real scripts/drills/run.ts <domain> --forge <url> usage and is shell-quoted, and the 8-day edge, red, cleared and never-drilled cases are tested. The newest-drill query is a single query, and the query-count test is updated to match.

Two things I would do next:

  1. The command needs FORGE_TOKEN (the script exits without it), but the card does not say so. Prefix the command with FORGE_TOKEN=… or add a clause, so a person can paste it and have it work.
  2. Once the forge is 8 days old, every domain that has never been drilled becomes a card at once. Check that this is one calm line on the board, and not red noise. Also fix the stray ". and" in the comment in test/vitals.test.ts, and add a README line about the drill cards.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs