Skip to content

TOC-80 Remote nodes on the hub's page, API and alerts - #64

Merged
jensenbox merged 2 commits into
mainfrom
TOC-80-remote-nodes
Oct 28, 2026
Merged

jensenbox merged 2 commits into
mainfrom
TOC-80-remote-nodes

Conversation

@jensenbox

@jensenbox jensenbox commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Follow-up 6 of docs/design/federation.md: remote nodes on the hub's page, API and alerts.

What changes

  • Alerting for pushed outages. A receiver listed in [federation] alert_order fires an alert for an outage another node pushes, and resolves it with the same identity when the push says it ended. It opens a new alert only while every node ahead of it in the list is down by its node:<id> liveness heartbeat (unheard counts as down). Behind a node that is up it re-fires only alerts it already fired.
  • Late outages. One received already ended pages no one. One received open but more than the check's confirmation span plus push_interval and grace after the origin detected it fires, and every message says Reported late with the origin's detection time. Stored as alert.arrived_late_at (migration 0021).
  • Tocsin-kept heartbeats (node:<id>, upstream:<id>) never page from a push; each node watches those itself.
  • No stale up. GET /api/v1/federation/nodes gains liveness and checks for every node but this one: each check's health, since and last_result_at, with health and since null whenever the node's liveness is not up. The internal board lists the same nodes. The window is the liveness heartbeat, so the page and the alert gate use one signal.
  • Docs: alerting.md (new "Other nodes' outages"), api.md, storage.md, the design doc. schema/openapi.json regenerated. The CLI tests' schema version moves to 21.

Migrations

0020 (from TOC-81) and 0021 ride the next release, which is unreleased and needs Christian's go-ahead to tag.

Out of scope

  • Per-check nodes placement and the quorum merge into status::checks are follow-up 9 (TOC-83). Until then every node runs every check, so remote state is shown per node rather than merged into the hub's own check list.
  • A spoke outside alert_order still pages for its own checks, which the design says it should not. Filed as TOC-110; harmless while no spoke has notifiers.

Acceptance (from the ticket)

  • A remote check whose node stops pushing reads unknown, not up: federation_tests::a_remote_check_reads_unknown_while_its_node_is_not_heard_from (API and board, with the node down and never heard from).
  • An outage received already ended creates no alert delivery: an_outage_received_already_ended_alerts_no_one (store), a_pushed_outage_that_already_ended_pages_no_one (route).
  • One received open creates a fire and later its resolve with the same identity: a_pushed_outage_fires_and_its_end_resolves_the_same_alert.
  • The second node in alert_order alerts only while the first is down by its liveness: a_pushed_outage_pages_only_while_every_node_ahead_is_down, behind_a_node_that_is_up_a_pushed_outage_opens_no_alert.
  • Late: an_outage_that_arrived_late_says_when, a_pushed_outage_that_reaches_the_hub_late_says_so. Heartbeat exemption: a_pushed_outage_of_a_heartbeat_tocsin_keeps_pages_no_one.

I checked the tests bite: with the ahead-is-down gate, the already-ended skip, the late computation, the heartbeat exemption, and the liveness filter on remote checks each undone, the matching test failed.

Local: cargo fmt --check, clippy with and without tocsin/grpc, and the full workspace test run all pass.

After review

A medium-effort code review found ten things. Fixed in 4242a2d:

  • The pushing node read as down. Its liveness beat is recorded after the batch applies, so a push from a node ahead in alert_order that was not yet heard let the next node open duplicate alerts. The node that pushed now counts as up. New test: the_node_that_pushed_counts_as_up_before_its_heartbeat_is_heard.
  • "Reported late" used the alert's start. A re-fire keeps the alert's started_at, so the notice gave the wrong detection time and delay. It now uses the start of the outage the alert last fired for (StoredAlert.outage_started_at_ms, read through the outage row; no schema change), carried as Alert.late.
  • Resolves left out the late notice. It now appears on every message, as docs/alerting.md says.
  • The retain behind a node that is up was targets.clear() in effect, since fire_alerts re-fires every open alert regardless; it is now written that way.
  • docs/alerting.md claimed a returning hub does not page again for what its backup sent. Nodes do not share what they sent, so the first node in alert_order does page again for an outage still open when it returns. The doc now says that.

Each new or changed test was checked to fail with its fix undone.

Filed rather than fixed here: an outage pushed while the node ahead was up never pages if that node then goes down (TOC-111). Re-evaluating open remote outages when a node's liveness changes is its own piece of work and sits under the second-hub milestone.

Declined:

  • Partition where C cannot reach A but A reaches B, so nobody pages C's outage. A then stops hearing from C and its node:C liveness heartbeat (TOC-81) goes down and pages. The outage itself is not paged, but the partition is, and that is the signal to act on.
  • The late cutoff uses the receiver's check and push settings. Federated nodes run one configuration, and every push carries its config digest so drift shows on the node list. An unknown check gives a zero confirmation span, which errs towards saying "late", never towards hiding one.
  • A Router built per push. Only pushes carrying an open alerted outage build one, and it reads the live config. That path is rare enough that sharing serve.rs's router is not worth the coupling now.
  • Sequential store reads per remote node on the board. There are two or three nodes; the reads are cheap and the board polls slowly.

Local: cargo fmt --check, clippy with and without tocsin/grpc, OpenAPI unchanged, and the full workspace test run all pass.

https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE

A receiver in alert_order fires and resolves alerts for outages other
nodes push, opening new ones only while every node ahead of it is down
by its node:<id> liveness heartbeat. An outage received already ended
pages no one; one received open but late fires and its messages say
when the origin detected it (alert.arrived_late_at, migration 0021).
Heartbeats tocsin keeps (node:, upstream:) never page from a push.

The nodes API and the internal board show each remote node's liveness
and its checks, with health and since null (unknown) whenever the node
is not heard from within push_interval plus grace: never a stale up.

Claude-Session: https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE
Signed-off-by: Christian Jensen <christian@closient.com>
…ssage (TOC-80)

- The node that pushed a batch counts as up in the alert_order gate: its
  liveness beat is recorded only after the batch, so its first push read
  it as unheard and the next node opened duplicate alerts.
- "Reported late" names when the origin detected the outage (the outage's
  start, not the alert's, which a re-fire keeps) and appears on resolves
  too, as docs/alerting.md says.
- Behind a node that is up, clear the targets outright: fire_alerts
  re-fires every open alert whatever the targets.
- docs/alerting.md no longer claims a returning hub skips what its backup
  already paged for; nodes do not share what they sent.

Claude-Session: https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE
Signed-off-by: Christian Jensen <christian@closient.com>
@jensenbox
jensenbox merged commit 4dce835 into main Oct 28, 2026
16 checks passed
@jensenbox
jensenbox deleted the TOC-80-remote-nodes branch October 28, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant