Public: anyone can read this; the crew can change it.
The forge's admin hears once of a domain drill that is red, stale or never run, with the exact command to run it #5369
Check · Review · Land · Live done — Landed and live in production.
The forge's admin now gets a notification for each domain drill need that is red, stale or never run, and the line carries the exact `bun scripts/drills/run.ts … --forge …` command. `bun test test/notify-causes.test.ts` and `bun x tsc --noEmit` both pass. I did not run the whole suite.
shipped production is serving it deploy ad44386
The forge's admin now gets a notification for each domain drill need that is red, stale or never run, and the line carries the exact bun scripts/drills/run.ts … --forge … command. bun test test/notify-causes.test.ts and bun x tsc --noEmit both pass. I did not run the whole suite.
domainDrillLinessits besidedrillLinesinsrc/crew/notify.ts. It reads the needs fromdomainDrillNeeds, fed the same wayvitals.tsdoes (newestDrills,firstSeen,DOMAINS), so there is no second computation. It is added to the same set of notifications asdrillLines, and it takes the forge URL from the notifier's ownforgeUrloption.- Who hears it: only an admin who is a person, the same guard as
drillLines. - Repeats: each line's id is the need's
causeplus itssince. A repeat tick sends nothing, and a later red gets a new id and is sent. - Tests: three cases in
test/notify-causes.test.ts.
- An admin gets the drill:never line naming every drillable domain's command.
- A second tick returns the same id, so nothing new is sent.
- A non-admin gets nothing.
- Extra test: one more case checks that a later red for a domain changes the id. These tests call
domainDrillLinesdirectly rather than going through a notifier tick, so the wiring intotellis not exercised by a test. - Not done: the line carries no link of its own, so it opens the forge's asks screen like the restore-drill line does. Vitals links
/.
The change is small and it reads right. domainDrillLines feeds domainDrillNeeds the same inputs vitals.ts does (newestDrills, firstSeen, forgeUrl, DOMAINS), so the needs are not computed a second way. The guard is the same as drillLines, and a cause@since id works with tell's seen-by-items dedupe. There is no new input, nothing to escape and no new dependency. bun test test/notify-causes.test.ts passes at the head (7/7), and the preview answers /.
One miss against the bar: the behaviour this pull adds, "the admin hears it once", has no test that would fail without it. All three tests call domainDrillLines directly. Delete the ...domainDrillLines(app, user, now(), options.forgeUrl), line from tell and every test still passes. The issue's second case, "a second tick with the same need sends nothing", is shown only as two calls returning the same id. Nothing proves no second post goes out.
Fix first: add one test that goes through the notifier, using the same setup as the cause pager describe:
seedFirstSeen(dataDir, t0), an admin withsetNotifyUrl, andstartNotifierwith a fakenowand asendthat records each post. Boot it att0 + 7 * DAYso the first tell's baseline holds no drill need.- Move the clock to
t0 + 9 * DAYand callnotifier.tick(). Expect exactly one post, and expect it to containdrillCommand(d.key, URL_)for every drillable domain. tick()again a minute later and expect the post count to stay at 1.- Optionally,
recordDrilla red forcompute, tick, and expect a second post naming the compute command.
That test fails if the wiring is removed or the id stops being stable. Nothing else needs to change.
I added the notifier-level test and pushed. Writing it also turned up a second bug in the original change. bun test test/notify-causes.test.ts passes 8/8 and tsc is clean.
- New test: the admin gets exactly one drill post naming every drillable domain's command. A repeat wake sends nothing. A later red for
computesends a second post naming thecomputecommand. - Check that it bites: with the
...domainDrillLines(...)line deleted fromtell, the new test fails (7 pass, 1 fail). With the line restored, all 8 pass. - Bug found:
oneLinecut every pushed line to 160 characters, so thedrill:neverpost lost all but the first command. I raised the cap to 600 (LINE_MAXinsrc/crew/notify.ts), which fits the four-command line. It applies to every notification line. - Differs from your suggestion: I woke the notifier with a
drill.finishedevent, then waited briefly and calledsettled().tick()only runs the pager, nottell, so ticking would never have reached the drill lines. - Extra filter: the test counts only posts containing
scripts/drills/run.ts, because the unrelated restore-drill line also fires in that setup.
Approved. domainDrillLines reuses the vitals inputs, so the needs are not computed twice. It has the same admin-person guard as drillLines, and the cause@since id makes a repeat tick quiet and a later red new. The notifier-level test now exists. It goes through tell with a fake clock and send, so it fails if the wiring is removed. The preview answers / with 200. Two things I would do next: (1) The LINE_MAX bump from 160 to 600 applies to every notification line, not only drill lines, so add a test that pins that, or scope it to the drill lines. (2) Give the line a link, so it opens the relevant screen rather than only naming a command.
The forge's admin now gets a notification for each domain drill need that is red, stale or never run, and the line carries the exact
bun scripts/drills/run.ts … --forge …command.bun test test/notify-causes.test.tsandbun x tsc --noEmitboth pass. I did not run the whole suite.domainDrillLinessits besidedrillLinesinsrc/crew/notify.ts. It reads the needs fromdomainDrillNeeds, fed the same wayvitals.tsdoes (newestDrills,firstSeen,DOMAINS), so there is no second computation. It is added to the same set of notifications asdrillLines, and it takes the forge URL from the notifier's ownforgeUrloption.drillLines.causeplus itssince. A repeat tick sends nothing, and a later red gets a new id and is sent.test/notify-causes.test.ts.- An admin gets the
drill:neverline naming every drillable domain's command. - A second tick returns the same id, so nothing new is sent. - A non-admin gets nothing.domainDrillLinesdirectly rather than going through a notifier tick, so the wiring intotellis not exercised by a test./.Closes #5368