Watchdog notice reader: the journal owns "sent"; only exit 75 is retried

Fix batch for Soul pass s1 (spec r3):
- Delete prune-on-absence and its test. Absence from Idunn's store no longer
  deletes a journal entry, so an empty or restored store never re-sends.
- discord-dm exits 75 only when no message can have been sent (arguments,
  token, DM channel open, non-2xx on the message POST). The reader records
  failed for 75 only; any other non-success without a message id is unknown
  and is never re-posted.
- Subject grammar is Idunn's require_id; the notice puts it in backticks.
- Times are bounded to the Date range; notice text is built before the
  running entry is written.

Builds and passes on Linux. On Windows the two tests that SIGKILL the reader
cannot pass (process.kill does not deliver a signal there).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 21:54:23 +02:00
commit 1f001e11d2
4 changed files with 161 additions and 49 deletions

View file

@ -31,9 +31,18 @@ node tools/watchdog-notice.mjs status --journal-store J
- J is Bifrost's journal, `bifrost.watchdog_notice_execution.v1`, keyed
`<incident_key>#opened` or `<incident_key>#closed`. A `running` entry found at
start becomes `unknown` and is never sent again. A `failed` entry is retried on
later runs with the same nonce, up to five attempts. Terminal entries are
deleted once Idunn no longer lists the incident.
later runs with the same nonce, up to five attempts. The journal is never
pruned: what Bifrost has sent is Bifrost's memory, whatever P holds.
- The bridge (`bifrost-bridge.mjs discord-dm`) exits 75 only when it knows no
message was sent: argument or token errors, a failure opening the DM channel,
or a non-2xx answer to the message POST. The reader records `failed` for
exit 75 only. Any other non-success without a message id (another exit code,
a signal, the spawn timeout, unreadable output) is `unknown`: never sent again,
counted by the exit status.
- The exit status is non-zero while any entry is `unknown` or out of attempts, or
while P holds a record of this schema that breaks its contract. systemd shows
that; `status` lists the entries.
- Notice text is built from `condition`, `subject` and ISO UTC times only.
- Notice text is built from `condition`, `subject` and ISO UTC times only. The
subject follows Idunn's `require_id` (1-256 bytes of `[A-Za-z0-9-_.:/]`) and
is placed in inline code. A time outside the ECMAScript Date range refuses the
record.