Spec: monitoring — keep the operator continuously aware of fleet health, and surface every fault with a safe response (P5) #18

Closed
opened 2026-07-24 15:25:33 +00:00 by ben · 1 comment
Owner

Parent

Wayfinder map: Matou/ourcloud#7 — monitoring's definition was locked on ticket #9 (2026-07-21). This child spec inherits the map's cross-feature constraints (clan substrate behind the clan seam; the enroll seam's post-enrollment fleet-reporting face; Netbird mesh; tiered recovery; the cross-cutting UX rulings — advice never veto (ADR 0015), members not users (ADR 0034), logging is cross-cutting with drill-in everywhere (ADR 0027)) and links back to it as the parent artifact. Grilled 2026-07-24 (/grill-ux-with-docs) in auto-accept mode; Ben signed off both gates the same day (ADRs 0069/0070, DDRs 0071/0072 accepted). The three ✎ screen-states the grill forced were wireframed the same day.

Flow: docs/ux/flows/p5-monitoring.mermaid.
Wireframes: docs/ux/wireframes/p5-monitoring/ (P5-S1, ✎ P5-S1x, P5-S2, ✎ P5-S2x, P5-S3, P5-S4, ✎ P5-S4x).
Decisions: ADR 0069 (monitor orchestrator = control-plane single test seam), ADR 0070 (two signal sources + monitoring-owned classifier; advised actions are clan ops), DDR 0071 (absence of signal is never silently healthy), DDR 0072 (the respond ladder is advice-not-veto with honest degradation).

Problem Statement

An operator — low-skill, low-time — cannot sit and watch a fleet of machines. Services members depend on (chat, files, video, git) run across devices that come and go, in buildings the operator may not be in. When something degrades or fails, the operator needs to learn about it in plain language, understand what is safe to do, and either fix it in one click or hand it off — without systems expertise, and without ever being falsely reassured. Left to raw tools this means: reading dashboards of metrics they can't interpret; guessing whether a quiet machine is asleep-as-normal or dead; being paged for every laptop that closes its lid, until real alerts are ignored; being told a service "restarted ✓" when it crashed again a minute later; and being offered a plausible-looking one-click fix for a problem no one-click fix can safely touch. None of that should require expertise, none of it should train the operator to distrust the alerts, and — above all — the system must never show green for a machine it has simply stopped hearing from.

Solution

Monitoring is the fleet's always-current status surface plus the life of an alert, all driven by the community's own control plane over the mesh, so a closed browser never misses anything.

Always current — the status surface (P5-S1). The control plane continuously aggregates health, metrics and heartbeats over the mesh and classifies severity by rule — info (expected), warning (degraded redundancy), critical (a service down, a backup failing). No anomaly is required to see the truth: every device and every service shows its state now, with backups' last-good in the same view.

Absence of signal is never a silent green (P5-S1x). When a device stops heartbeating, the silence is judged against that node's own pattern: an always-on node gone dark is critical and raises an alert; an intermittent node quiet on its known pattern is info and raises nothing. A device the system has simply stopped hearing from is never shown as healthy.

Notify → drill in → respond. When an anomaly crosses a threshold the operator is notified in the operator app and at the alert contact (email/phone set at founding, configured in monitoring), with a plain-language diagnosis and — when one is safe — a single advised action (P5-S2). When no safe automatic fix exists, monitoring says so and offers none rather than fabricating one (P5-S2x). The operator can drill in to the timeline, events and logs (P5-S3, Open/Download from every surface), then respond (P5-S4): apply the advised one-click fix (restart service / re-apply config / rebalance, each logged, then the fleet re-aggregates), acknowledge it as expected (optionally tuning the device's expected pattern), or escalate to rescue. Advice, never a veto.

Honest degradation (P5-S4x). A fix that was applied but did not hold is reported as a re-raise, never a success, with an escalating-specificity re-diagnosis ("chat has crashed 7× this week; a restart has failed to hold twice today"), and escalate to rescue is the natural next rung. Monitoring's job ends at the hand-off.

User Stories

Acceptance criteria are Given/When/Then, sourced from the flow nodes and edges of p5-monitoring.mermaid, including the error, empty and partial branches.

Always-current status surface (P5-S1)

  1. As an operator, I want a single always-current view of every device and service, so that I can see my community's health at a glance without running anything.

    • Given a fleet with devices and services, When I open the overview, Then P5-S1 shows each device with its status and each service (Files, Chat, Video, Git) with its state, plus backups' last-good — all current without any anomaly required.
    • Given the control plane aggregating over the mesh, When state changes, Then the surface reflects the new state on its own (the aggregation loop is continuous), not only when I act.
  2. As an operator, I want each condition classified by severity, so that I can tell an expected quiet from a real outage without interpreting metrics.

    • Given the fleet state, When severity is classified, Then each item is info (expected — e.g. an intermittent device asleep), warning (degraded redundancy), or critical (a service down, a backup failing), by rule and never authored by me.
    • Given an intermittent device asleep on its own normal pattern, When it is shown, Then it is classified info with a note that this is expected for the device; given a service down (e.g. chat on rimu), Then it is classified critical.
  3. As an operator, I want the resting all-healthy state to be a real shown state, so that "everything is fine" is something I can positively see rather than an empty screen.

    • Given every device healthy and every service up with backups verified, When I open the overview, Then P5-S1 shows the healthy fleet (all-green, backups ✓ last night) as a first-class state, not a blank or error page.

Device gone silent (P5-S1x) — DDR 0071

  1. As an operator, I want a machine we've stopped hearing from to never be shown as healthy, so that a powered-off or crashed node can't hide behind "no news is good news".

    • Given a device whose heartbeats have stopped, When the aggregation loop notices, Then P5-S1x classifies the silence rather than ignoring it, and the device is never shown healthy on the strength of an absent signal.
    • Given a silent device, When P5-S1x is shown, Then it names which device, how long it has been silent (last-heartbeat time and duration), and the pattern the silence was judged against.
  2. As an operator, I want an always-on node gone dark to raise a critical alert, so that a real outage reaches me fast.

    • Given an always-on node (no intermittent tag, no observed quiet window) silent past its threshold, When the silence is classified, Then it is critical and an alert is raised (edge P5-S1x → P5-S2, notify).
  3. As an operator, I want an intermittent node quiet on its own known pattern to stay quiet, so that laptops and personal-machine VMs doing exactly what's expected don't train me to ignore alerts.

    • Given an intermittent-tagged node silent within its known pattern (e.g. asleep 22:00–06:00), When the silence is classified, Then it is info, no alert is raised, and the status surface keeps watching (edge P5-S1x → P5-S1).
    • Given an intermittent node with no established pattern yet (newly added), When it first goes silent, Then the silence leans to a warning (never to silence), and acknowledging it can tune the pattern so a repeated expected silence stops warning.

Notify (P5-S2)

  1. As an operator, I want to be notified in plain language with one recommended action when something crosses a threshold, so that I know what happened and what to do without reading logs.

    • Given an anomaly crosses a threshold with a safe fix available, When I am notified, Then P5-S2 states the problem in plain language ("Chat is down… members can't send messages right now") and names one recommended, safe action ("restart it — this usually fixes it, and it's safe").
    • Given a notification, When it is delivered, Then it reaches both the operator app and the alert contact (email/phone) from founding (P1-S2).
  2. As an operator, I want the notification to let me act or open the dashboard, so that I can fix fast or investigate.

    • Given P5-S2, When I choose the recommended action, Then it is applied (and the flow proceeds as a Respond, P5-S4); When I choose Open dashboard / drill in, Then the device/service detail opens (P5-S3).

Notify — no safe automatic action (P5-S2x) — DDR 0072

  1. As an operator, I want to be told honestly when there's no safe one-click fix, so that I'm never handed a fabricated button that could make things worse.
    • Given an anomaly monitoring can diagnose but has no fix it is confident is safe for, When I am notified, Then P5-S2x delivers the diagnosis only and names no advised action.
    • Given P5-S2x, When I respond, Then the offered path is to drill in (P5-S3) or open the dashboard — never a manufactured one-click fix (advice never veto, ADR 0015, read as: the system may withhold advice, not invent it).

Drill in (P5-S3)

  1. As an operator, I want to drill into a service's detail — timeline, events and logs — so that I can understand a problem before I act.
    • Given a notification or a status item, When I drill in, Then P5-S3 shows the service detail: where it runs and its backup, a last-24h health strip, a curated events timeline, and its current status.
    • Given any status surface or alert, When I need the raw logs, Then Open logs and Download logs are available (the standing rule — logs reachable from every surface, ADR 0027), with curated timeline/events in front and raw log lines behind the buttons.

Respond (P5-S4)

  1. As an operator, I want to apply the advised one-click fix and have it logged, so that I can resolve common faults without systems knowledge.

    • Given P5-S4 with an advised fix, When I apply it (restart service / re-apply config / rebalance), Then the action runs, is logged, and the fleet re-aggregates; on success the alert resolves and monitoring returns to watching (edge P5-S4 → P5-S1).
    • Given the advised fix, When it runs, Then it is expressed as a clan operation (restart / re-apply the current known-good revision / a service's out-of-band rebalance), inheriting the change-flow discipline, not a bespoke mutation path.
  2. As an operator, I want to acknowledge expected behaviour without changing anything, so that a known-normal condition can be closed without a needless fix.

    • Given P5-S4 for an expected condition (e.g. an intermittent device asleep), When I acknowledge it, Then no fleet change is made, the alert closes, and monitoring keeps watching (edge P5-S4 → P5-S1).
    • Given I acknowledge an expected silence, When I choose to, Then I can tune the device's expected pattern so the same silence classifies info next time (feeds DDR 0071's classifier).
  3. As an operator, I want to escalate anything bigger than a one-click fix, so that a serious problem reaches the rescue tools instead of being poked at.

    • Given P5-S4, When the problem is bigger than a one-click fix, Then I can escalate and monitoring hands off to rescue (edge P5-S4 → P8-S1 Service rescue); monitoring's responsibility ends at the hand-off.
  4. As an operator, I want repeated consequences of an unreliable device surfaced with growing specificity, so that I understand a pattern rather than seeing the same isolated alert.

    • Given a device causing repeated faults, When consequences recur, Then they surface with escalating specificity (e.g. "your database failed over twice this week because of this device") — advice, never a veto (ADR 0015); the operator is never blocked from keeping the device.

Fix didn't hold (P5-S4x) — DDR 0072

  1. As an operator, I want a fix that didn't hold reported as a re-raise, not a success, so that I'm never told a problem is solved when it isn't.

    • Given an advised fix was applied but the fault re-raised, When P5-S4x is shown, Then it states the re-raise plainly ("Chat restarted — but went down again 2 min later. The advised fix didn't hold") and never shows a success confirmation.
    • Given a re-raise, When P5-S4x is shown, Then it carries the failed-fix evidence (what was tried, when, and the outcome) attached to the re-diagnosis.
  2. As an operator, I want the re-diagnosis to grow more specific and point me to escalation, so that a fix that keeps failing leads somewhere instead of looping.

    • Given a fix that failed to hold, When monitoring re-diagnoses, Then the diagnosis carries escalating specificity (naming the pattern — "crashed on start 7× this week; restart failed to hold twice today"), and escalate to rescue is presented as the advised next rung.
    • Given P5-S4x, When I choose escalate, Then monitoring hands off to rescue (P8) with the failed-fix evidence attached (edge P5-S4x → P8-S1).

Alert contact

  1. As an operator, I want an alert contact (email/phone) that receives alerts alongside the app, so that I hear about outages even when I'm not in the app.
    • Given founding captured an alert contact (P1-S2), When an alert is raised, Then it is delivered to that contact as well as the operator app.
    • Given I want to change the alert contact, When I configure it, Then it is set in monitoring (not in Settings — ticket #9); v1 supports one community-level contact.

Implementation Decisions

  • monitor — a Go package in the control plane, and the single test seam (ADR 0069). The continuous loop that aggregates fleet health, classifies severity, raises/clears alerts, delivers notifications, and offers the advised fixes lives on the gateway and only there. It is the fourth orchestrator in the per-feature placement pattern (founding→helper, join→agent, provision/update→control plane, monitor→control plane). The Vue dashboard is thin UI over it; the operator app receives notifications and renders status but runs no monitoring logic. Because the loop runs server-side, a closed browser interrupts nothing and a gateway restart resumes from persisted alert state and the next tick — no snapshot-resume machinery.
  • Two signal sources, one monitoring-owned classifier (ADR 0070). Liveness comes from the enroll seam's existing post-enrollment FleetReporting.Report heartbeat (agent version, uptime, clan connection up/degraded/down, VM health) — monitoring reads the stored latest report and its history (history is what makes a node's own pattern knowable). Correctness comes from re-running the same per-service HealthCheck provisioning gates on once at deploy (ADRs 0061/0062) — monitoring re-runs it on a schedule and invents no second definition of "healthy". Severity (info/warning/critical) is computed by monitor, by rule, from per-service health + node liveness/history + capability tags (intermittent) + current coverage/HA gaps. The expected-vs-unexpected-silence rule (DDR 0071) lives in this classifier.
  • The alert is a monitoring-owned resource with a mostly-monotonic state machine. States: watching (none) → raised (notified, with severity, diagnosis, and — when safe — one advised action) → resolved | acknowledged | escalated; with raised variants for no-safe-action (S2x) and absence-of-signal (S1x), and a fix-didn't-hold re-raise (S4x) that records the attempted fix and an escalating-specificity re-diagnosis. The P5-S1 status surface and the notifications are queries/projections over the standing alerts, never a separate store (shaped like the enroll seam's RequestView).
  • Advised actions are clan operations (ADR 0070). restart service → the seam's explicit-restart mechanism; re-apply config → Deploy of the current known-good exact revision (idempotent reconcile); rebalance → a catalogue service's out-of-band reconciler op (the S13 clanService pattern). Each is logged and re-aggregated; all inherit the change-flow discipline (scoped, exact-revision, classified failures).
  • One new outbound port: Notifier. Delivery to the alert contact (email/phone) alongside the operator app is the only genuinely new egress. It is an interface faked in seam tests; its concrete channel is needs_human_decision (see Further Notes).
  • No seam amendment — a first. Monitoring is pure composition over the two confirmed seams: FleetReporting.Report already carries liveness and ADRs 0061/0062 already provide for the steady-state health-check re-run, so neither enroll nor clan changes. If implementation finds the stored heartbeat history needs an explicit read accessor, that is a control-plane-internal helper, not a seam change.
  • Cross-feature couplings (for the slice-map): monitoring reads provisioning's per-service health model and its active / active-service-failed states (ADR 0061) — a service that failed provisioning's gate is a standing fault from go-active; backups' run failures and staleness surface as monitoring alerts (CONTEXT: Backup run — "never a silent red row"); the escalate edge is monitoring→rescue's only hand-off (P8); shell reserves a nav-chrome slot for the standing raised-alert count (the P4b indicator-slot pattern, ADR 0068 — shell renders the slot, monitoring supplies the content); founding (P1-S2) seeds the alert contact monitoring later uses.

Testing Decisions

  • What makes a good test here: assert external behaviour, not internals — that a given fleet state + heartbeat history + health-check results produces the right severity, the right notification content and channel, the right alert-state transition (raise / resolve / acknowledge / escalate / re-raise), and that an advised action issues the right clan operation. Never assert the classifier's internal shape or the loop's scheduling mechanics.
  • THE seam (one, the highest — ADR 0069): drive monitor headlessly in-process against fakes: a fake heartbeat source replaying FleetReporting.Report streams with controllable gaps; fake per-service HealthChecks that pass/fail on command; a fake fleet-state provider (capability tags incl. intermittent, observed heartbeat pattern, coverage/HA gaps); a fake clock (expected-vs-unexpected silence, "failed twice this week", thresholds are all time-dependent); a fake Notifier (assert what was delivered and its severity, sending nothing); and a fake clan.Clan (assert the advised action issues the right op and the loop re-aggregates). Above the seam: nothing — Vue renders alert states, it does not decide them.
  • Every acceptance criterion above executes at this seam: severity classification across info/warning/critical; the expected-vs-unexpected-silence rule incl. the not-yet-patterned learning-window lean-to-alarm (DDR 0071); alert raise/notify/resolve/acknowledge/escalate; the no-safe-action notify (S2x); the failed-fix re-raise with escalating specificity (S4x); and that each advised action maps to a clan op and is logged.
  • Below the seam: one thin HTTP round-trip test against the real control-plane binary, mirroring provisioning's (ADR 0058) and founding's stdio / device-add's socket round-trips.
  • Prior art to copy: provisioning's control-plane orchestrator-as-seam and fake harness (ADR 0058); the enroll seam's monotonic resource-state-machine testing (the alert lifecycle is shaped like RequestView); the S13 prototype's clan fakes (spikes/S13-clan-orchestration/).
  • One testing addition beyond the grill (mirroring founding, device-add and provisioning): a non-gating real-lab monitoring smoke — on the clan-lab fleet, make a real service fail (and a real node go silent), and observe monitoring raise the alert with the right severity and then clear it after the advised fix — as fake-drift insurance. Explicitly not an acceptance gate; the seam tests are.

Out of Scope

  • Historical metrics / trend dashboards / capacity planning. P5-S3 shows a last-24h health strip and a curated timeline only; time-series exploration UI is not in v1.
  • Operator-authored alert rules or thresholds. Severity is system-classified by rule; the operator tunes a device's expected pattern (via acknowledge) but does not author alert rules. Thresholds are system-defined in v1.
  • Deploy-time health gating. That is provisioning's, once, at deploy (ADR 0061); monitoring re-runs and watches the same check forever after. The boundary (ticket #9) stands.
  • Members. Members never see monitoring — it is an operator surface (ADR 0034).
  • The summoning mechanism. A critical unexpected-silence whose only fix is physical (someone must attend a dark node) is where a future summon-the-operator path would attach; deferred (migration-spec §12), carried as needs_human_decision, not designed here.
  • The Notifier concrete delivery channel. The interface is in scope and faked in tests; the wiring to a real email path (the community mail service) and a real SMS path (an external provider) is needs_human_decision.
  • Rescue actions themselves. Monitoring escalates to rescue (P8) and stops; break-glass work is rescue's spec.

Further Notes

  • Seam re-confirmed at spec time. The monitor control-plane single seam (ADR 0069) was signed off at the grill's two gates on 2026-07-24 and is re-confirmed here as the sole seam every acceptance criterion executes at — consistent with founding, device-add and provisioning re-confirming their seams at spec time.
  • The one agent-judgement number. DDR 0071's learning-window lean-to-alarm for a not-yet-patterned intermittent device (warn rather than stay quiet until the pattern is known) is the single value that was an agent judgement rather than derived from an existing decision; Ben kept it at sign-off. Worth re-visiting once real fleets produce pattern data.
  • needs_human_decision carried forward: the Notifier delivery channel (email via the community mail service; SMS via an external provider), and the deferred summoning mechanism for a physical-only critical silence.
  • Triage: filed no-triage (not ready-for-agent) — mirroring provisioning #17. The live swarm must not pick up a whole feature spec as an agent task; monitoring joins the Phase-2 slice-map with the other feature specs, and to-tickets will emit the implementable tasks afterward.
## Parent Wayfinder map: https://git.matou.nz/Matou/ourcloud/issues/7 — monitoring's definition was locked on ticket #9 (2026-07-21). This child spec inherits the map's cross-feature constraints (clan substrate behind the `clan` seam; the `enroll` seam's post-enrollment fleet-reporting face; Netbird mesh; tiered recovery; the cross-cutting UX rulings — advice never veto (ADR 0015), members not users (ADR 0034), logging is cross-cutting with drill-in everywhere (ADR 0027)) and links back to it as the parent artifact. Grilled 2026-07-24 (`/grill-ux-with-docs`) in auto-accept mode; Ben signed off both gates the same day (ADRs 0069/0070, DDRs 0071/0072 `accepted`). The three ✎ screen-states the grill forced were wireframed the same day. Flow: `docs/ux/flows/p5-monitoring.mermaid`. Wireframes: `docs/ux/wireframes/p5-monitoring/` (P5-S1, ✎ P5-S1x, P5-S2, ✎ P5-S2x, P5-S3, P5-S4, ✎ P5-S4x). Decisions: ADR 0069 (`monitor` orchestrator = control-plane single test seam), ADR 0070 (two signal sources + monitoring-owned classifier; advised actions are `clan` ops), DDR 0071 (absence of signal is never silently healthy), DDR 0072 (the respond ladder is advice-not-veto with honest degradation). ## Problem Statement An operator — low-skill, low-time — cannot sit and watch a fleet of machines. Services members depend on (chat, files, video, git) run across devices that come and go, in buildings the operator may not be in. When something degrades or fails, the operator needs to learn about it in plain language, understand what is safe to do, and either fix it in one click or hand it off — without systems expertise, and without ever being falsely reassured. Left to raw tools this means: reading dashboards of metrics they can't interpret; guessing whether a quiet machine is asleep-as-normal or dead; being paged for every laptop that closes its lid, until real alerts are ignored; being told a service "restarted ✓" when it crashed again a minute later; and being offered a plausible-looking one-click fix for a problem no one-click fix can safely touch. None of that should require expertise, none of it should train the operator to distrust the alerts, and — above all — the system must never show green for a machine it has simply stopped hearing from. ## Solution Monitoring is the fleet's always-current status surface plus the life of an **alert**, all driven by the community's own control plane over the mesh, so a closed browser never misses anything. **Always current — the status surface (P5-S1).** The control plane continuously aggregates health, metrics and heartbeats over the mesh and classifies severity by rule — **info** (expected), **warning** (degraded redundancy), **critical** (a service down, a backup failing). No anomaly is required to see the truth: every device and every service shows its state now, with backups' last-good in the same view. **Absence of signal is never a silent green (P5-S1x).** When a device stops heartbeating, the silence is judged against *that node's own pattern*: an always-on node gone dark is critical and raises an alert; an intermittent node quiet on its known pattern is info and raises nothing. A device the system has simply stopped hearing from is never shown as healthy. **Notify → drill in → respond.** When an anomaly crosses a threshold the operator is notified in the operator app *and* at the alert contact (email/phone set at founding, configured in monitoring), with a plain-language diagnosis and — when one is safe — a single advised action (P5-S2). When no safe automatic fix exists, monitoring says so and offers none rather than fabricating one (P5-S2x). The operator can drill in to the timeline, events and logs (P5-S3, Open/Download from every surface), then respond (P5-S4): apply the advised one-click fix (restart service / re-apply config / rebalance, each logged, then the fleet re-aggregates), acknowledge it as expected (optionally tuning the device's expected pattern), or escalate to rescue. Advice, never a veto. **Honest degradation (P5-S4x).** A fix that was applied but did not hold is reported as a re-raise, never a success, with an escalating-specificity re-diagnosis ("chat has crashed 7× this week; a restart has failed to hold twice today"), and escalate to rescue is the natural next rung. Monitoring's job ends at the hand-off. ## User Stories Acceptance criteria are Given/When/Then, sourced from the flow nodes and edges of `p5-monitoring.mermaid`, including the error, empty and partial branches. ### Always-current status surface (P5-S1) 1. As an operator, I want a single always-current view of every device and service, so that I can see my community's health at a glance without running anything. - Given a fleet with devices and services, When I open the overview, Then P5-S1 shows each device with its status and each service (Files, Chat, Video, Git) with its state, plus backups' last-good — all current without any anomaly required. - Given the control plane aggregating over the mesh, When state changes, Then the surface reflects the new state on its own (the aggregation loop is continuous), not only when I act. 2. As an operator, I want each condition classified by severity, so that I can tell an expected quiet from a real outage without interpreting metrics. - Given the fleet state, When severity is classified, Then each item is info (expected — e.g. an intermittent device asleep), warning (degraded redundancy), or critical (a service down, a backup failing), by rule and never authored by me. - Given an intermittent device asleep on its own normal pattern, When it is shown, Then it is classified info with a note that this is expected for the device; given a service down (e.g. chat on rimu), Then it is classified critical. 3. As an operator, I want the resting all-healthy state to be a real shown state, so that "everything is fine" is something I can positively see rather than an empty screen. - Given every device healthy and every service up with backups verified, When I open the overview, Then P5-S1 shows the healthy fleet (all-green, backups ✓ last night) as a first-class state, not a blank or error page. ### Device gone silent (P5-S1x) — DDR 0071 4. As an operator, I want a machine we've stopped hearing from to never be shown as healthy, so that a powered-off or crashed node can't hide behind "no news is good news". - Given a device whose heartbeats have stopped, When the aggregation loop notices, Then P5-S1x classifies the silence rather than ignoring it, and the device is never shown healthy on the strength of an absent signal. - Given a silent device, When P5-S1x is shown, Then it names which device, how long it has been silent (last-heartbeat time and duration), and the pattern the silence was judged against. 5. As an operator, I want an always-on node gone dark to raise a critical alert, so that a real outage reaches me fast. - Given an always-on node (no intermittent tag, no observed quiet window) silent past its threshold, When the silence is classified, Then it is critical and an alert is raised (edge P5-S1x → P5-S2, notify). 6. As an operator, I want an intermittent node quiet on its own known pattern to stay quiet, so that laptops and personal-machine VMs doing exactly what's expected don't train me to ignore alerts. - Given an intermittent-tagged node silent within its known pattern (e.g. asleep 22:00–06:00), When the silence is classified, Then it is info, no alert is raised, and the status surface keeps watching (edge P5-S1x → P5-S1). - Given an intermittent node with no established pattern yet (newly added), When it first goes silent, Then the silence leans to a warning (never to silence), and acknowledging it can tune the pattern so a repeated expected silence stops warning. ### Notify (P5-S2) 7. As an operator, I want to be notified in plain language with one recommended action when something crosses a threshold, so that I know what happened and what to do without reading logs. - Given an anomaly crosses a threshold with a safe fix available, When I am notified, Then P5-S2 states the problem in plain language ("Chat is down… members can't send messages right now") and names one recommended, safe action ("restart it — this usually fixes it, and it's safe"). - Given a notification, When it is delivered, Then it reaches both the operator app and the alert contact (email/phone) from founding (P1-S2). 8. As an operator, I want the notification to let me act or open the dashboard, so that I can fix fast or investigate. - Given P5-S2, When I choose the recommended action, Then it is applied (and the flow proceeds as a Respond, P5-S4); When I choose Open dashboard / drill in, Then the device/service detail opens (P5-S3). ### Notify — no safe automatic action (P5-S2x) — DDR 0072 9. As an operator, I want to be told honestly when there's no safe one-click fix, so that I'm never handed a fabricated button that could make things worse. - Given an anomaly monitoring can diagnose but has no fix it is confident is safe for, When I am notified, Then P5-S2x delivers the diagnosis only and names no advised action. - Given P5-S2x, When I respond, Then the offered path is to drill in (P5-S3) or open the dashboard — never a manufactured one-click fix (advice never veto, ADR 0015, read as: the system may withhold advice, not invent it). ### Drill in (P5-S3) 10. As an operator, I want to drill into a service's detail — timeline, events and logs — so that I can understand a problem before I act. - Given a notification or a status item, When I drill in, Then P5-S3 shows the service detail: where it runs and its backup, a last-24h health strip, a curated events timeline, and its current status. - Given any status surface or alert, When I need the raw logs, Then Open logs and Download logs are available (the standing rule — logs reachable from every surface, ADR 0027), with curated timeline/events in front and raw log lines behind the buttons. ### Respond (P5-S4) 11. As an operator, I want to apply the advised one-click fix and have it logged, so that I can resolve common faults without systems knowledge. - Given P5-S4 with an advised fix, When I apply it (restart service / re-apply config / rebalance), Then the action runs, is logged, and the fleet re-aggregates; on success the alert resolves and monitoring returns to watching (edge P5-S4 → P5-S1). - Given the advised fix, When it runs, Then it is expressed as a `clan` operation (restart / re-apply the current known-good revision / a service's out-of-band rebalance), inheriting the change-flow discipline, not a bespoke mutation path. 12. As an operator, I want to acknowledge expected behaviour without changing anything, so that a known-normal condition can be closed without a needless fix. - Given P5-S4 for an expected condition (e.g. an intermittent device asleep), When I acknowledge it, Then no fleet change is made, the alert closes, and monitoring keeps watching (edge P5-S4 → P5-S1). - Given I acknowledge an expected silence, When I choose to, Then I can tune the device's expected pattern so the same silence classifies info next time (feeds DDR 0071's classifier). 13. As an operator, I want to escalate anything bigger than a one-click fix, so that a serious problem reaches the rescue tools instead of being poked at. - Given P5-S4, When the problem is bigger than a one-click fix, Then I can escalate and monitoring hands off to rescue (edge P5-S4 → P8-S1 Service rescue); monitoring's responsibility ends at the hand-off. 14. As an operator, I want repeated consequences of an unreliable device surfaced with growing specificity, so that I understand a pattern rather than seeing the same isolated alert. - Given a device causing repeated faults, When consequences recur, Then they surface with escalating specificity (e.g. "your database failed over twice this week because of this device") — advice, never a veto (ADR 0015); the operator is never blocked from keeping the device. ### Fix didn't hold (P5-S4x) — DDR 0072 15. As an operator, I want a fix that didn't hold reported as a re-raise, not a success, so that I'm never told a problem is solved when it isn't. - Given an advised fix was applied but the fault re-raised, When P5-S4x is shown, Then it states the re-raise plainly ("Chat restarted — but went down again 2 min later. The advised fix didn't hold") and never shows a success confirmation. - Given a re-raise, When P5-S4x is shown, Then it carries the failed-fix evidence (what was tried, when, and the outcome) attached to the re-diagnosis. 16. As an operator, I want the re-diagnosis to grow more specific and point me to escalation, so that a fix that keeps failing leads somewhere instead of looping. - Given a fix that failed to hold, When monitoring re-diagnoses, Then the diagnosis carries escalating specificity (naming the pattern — "crashed on start 7× this week; restart failed to hold twice today"), and escalate to rescue is presented as the advised next rung. - Given P5-S4x, When I choose escalate, Then monitoring hands off to rescue (P8) with the failed-fix evidence attached (edge P5-S4x → P8-S1). ### Alert contact 17. As an operator, I want an alert contact (email/phone) that receives alerts alongside the app, so that I hear about outages even when I'm not in the app. - Given founding captured an alert contact (P1-S2), When an alert is raised, Then it is delivered to that contact as well as the operator app. - Given I want to change the alert contact, When I configure it, Then it is set in monitoring (not in Settings — ticket #9); v1 supports one community-level contact. ## Implementation Decisions - **`monitor` — a Go package in the control plane, and the single test seam (ADR 0069).** The continuous loop that aggregates fleet health, classifies severity, raises/clears alerts, delivers notifications, and offers the advised fixes lives on the gateway and only there. It is the **fourth** orchestrator in the per-feature placement pattern (founding→helper, join→agent, provision/update→control plane, monitor→control plane). The Vue dashboard is thin UI over it; the operator app receives notifications and renders status but runs no monitoring logic. Because the loop runs server-side, a closed browser interrupts nothing and a gateway restart resumes from persisted alert state and the next tick — no snapshot-resume machinery. - **Two signal sources, one monitoring-owned classifier (ADR 0070).** Liveness comes from the `enroll` seam's existing post-enrollment `FleetReporting.Report` heartbeat (agent version, uptime, clan connection up/degraded/down, VM health) — monitoring reads the stored latest report *and its history* (history is what makes a node's own pattern knowable). Correctness comes from re-running the same per-service `HealthCheck` provisioning gates on once at deploy (ADRs 0061/0062) — monitoring re-runs it on a schedule and invents no second definition of "healthy". Severity (info/warning/critical) is computed by `monitor`, by rule, from per-service health + node liveness/history + capability tags (intermittent) + current coverage/HA gaps. The expected-vs-unexpected-silence rule (DDR 0071) lives in this classifier. - **The alert is a monitoring-owned resource with a mostly-monotonic state machine.** States: *watching* (none) → *raised* (notified, with severity, diagnosis, and — when safe — one advised action) → *resolved* | *acknowledged* | *escalated*; with *raised* variants for no-safe-action (S2x) and absence-of-signal (S1x), and a *fix-didn't-hold* re-raise (S4x) that records the attempted fix and an escalating-specificity re-diagnosis. The P5-S1 status surface and the notifications are queries/projections over the standing alerts, never a separate store (shaped like the `enroll` seam's `RequestView`). - **Advised actions are `clan` operations (ADR 0070).** restart service → the seam's explicit-restart mechanism; re-apply config → `Deploy` of the current known-good exact revision (idempotent reconcile); rebalance → a catalogue service's out-of-band reconciler op (the S13 clanService pattern). Each is logged and re-aggregated; all inherit the change-flow discipline (scoped, exact-revision, classified failures). - **One new outbound port: `Notifier`.** Delivery to the alert contact (email/phone) alongside the operator app is the only genuinely new egress. It is an interface faked in seam tests; its concrete channel is `needs_human_decision` (see Further Notes). - **No seam amendment — a first.** Monitoring is pure composition over the two confirmed seams: `FleetReporting.Report` already carries liveness and ADRs 0061/0062 already provide for the steady-state health-check re-run, so neither `enroll` nor `clan` changes. If implementation finds the stored heartbeat history needs an explicit read accessor, that is a control-plane-internal helper, not a seam change. - **Cross-feature couplings (for the slice-map):** monitoring reads provisioning's per-service health model and its *active / active-service-failed* states (ADR 0061) — a service that failed provisioning's gate is a standing fault from go-active; backups' run failures and staleness surface as monitoring alerts (CONTEXT: *Backup run* — "never a silent red row"); the escalate edge is monitoring→rescue's only hand-off (P8); shell reserves a nav-chrome slot for the standing raised-alert count (the P4b indicator-slot pattern, ADR 0068 — shell renders the slot, monitoring supplies the content); founding (P1-S2) seeds the alert contact monitoring later uses. ## Testing Decisions - **What makes a good test here:** assert external behaviour, not internals — that a given fleet state + heartbeat history + health-check results produces the right *severity*, the right *notification content and channel*, the right *alert-state transition* (raise / resolve / acknowledge / escalate / re-raise), and that an advised action issues the *right `clan` operation*. Never assert the classifier's internal shape or the loop's scheduling mechanics. - **THE seam (one, the highest — ADR 0069):** drive `monitor` headlessly in-process against fakes: a fake heartbeat source replaying `FleetReporting.Report` streams with controllable gaps; fake per-service `HealthCheck`s that pass/fail on command; a fake fleet-state provider (capability tags incl. intermittent, observed heartbeat pattern, coverage/HA gaps); a fake clock (expected-vs-unexpected silence, "failed twice this week", thresholds are all time-dependent); a fake `Notifier` (assert *what* was delivered and its severity, sending nothing); and a fake `clan.Clan` (assert the advised action issues the right op and the loop re-aggregates). Above the seam: nothing — Vue renders alert states, it does not decide them. - **Every acceptance criterion above executes at this seam:** severity classification across info/warning/critical; the expected-vs-unexpected-silence rule incl. the not-yet-patterned learning-window lean-to-alarm (DDR 0071); alert raise/notify/resolve/acknowledge/escalate; the no-safe-action notify (S2x); the failed-fix re-raise with escalating specificity (S4x); and that each advised action maps to a `clan` op and is logged. - **Below the seam:** one thin HTTP round-trip test against the real control-plane binary, mirroring provisioning's (ADR 0058) and founding's stdio / device-add's socket round-trips. - **Prior art to copy:** provisioning's control-plane orchestrator-as-seam and fake harness (ADR 0058); the `enroll` seam's monotonic resource-state-machine testing (the alert lifecycle is shaped like `RequestView`); the S13 prototype's clan fakes (`spikes/S13-clan-orchestration/`). - **One testing addition beyond the grill (mirroring founding, device-add and provisioning):** a **non-gating real-lab monitoring smoke** — on the clan-lab fleet, make a real service fail (and a real node go silent), and observe monitoring raise the alert with the right severity and then clear it after the advised fix — as fake-drift insurance. Explicitly **not** an acceptance gate; the seam tests are. ## Out of Scope - **Historical metrics / trend dashboards / capacity planning.** P5-S3 shows a last-24h health strip and a curated timeline only; time-series exploration UI is not in v1. - **Operator-authored alert rules or thresholds.** Severity is system-classified by rule; the operator tunes a device's *expected pattern* (via acknowledge) but does not author alert rules. Thresholds are system-defined in v1. - **Deploy-time health gating.** That is provisioning's, once, at deploy (ADR 0061); monitoring re-runs and *watches* the same check forever after. The boundary (ticket #9) stands. - **Members.** Members never see monitoring — it is an operator surface (ADR 0034). - **The summoning mechanism.** A critical unexpected-silence whose only fix is physical (someone must attend a dark node) is where a future summon-the-operator path would attach; deferred (migration-spec §12), carried as `needs_human_decision`, not designed here. - **The `Notifier` concrete delivery channel.** The interface is in scope and faked in tests; the wiring to a real email path (the community mail service) and a real SMS path (an external provider) is `needs_human_decision`. - **Rescue actions themselves.** Monitoring escalates to rescue (P8) and stops; break-glass work is rescue's spec. ## Further Notes - **Seam re-confirmed at spec time.** The `monitor` control-plane single seam (ADR 0069) was signed off at the grill's two gates on 2026-07-24 and is re-confirmed here as the sole seam every acceptance criterion executes at — consistent with founding, device-add and provisioning re-confirming their seams at spec time. - **The one agent-judgement number.** DDR 0071's learning-window *lean-to-alarm* for a not-yet-patterned intermittent device (warn rather than stay quiet until the pattern is known) is the single value that was an agent judgement rather than derived from an existing decision; Ben kept it at sign-off. Worth re-visiting once real fleets produce pattern data. - **`needs_human_decision` carried forward:** the `Notifier` delivery channel (email via the community mail service; SMS via an external provider), and the deferred summoning mechanism for a physical-only critical silence. - **Triage:** filed `no-triage` (not `ready-for-agent`) — mirroring provisioning #17. The live swarm must not pick up a whole feature spec as an agent task; monitoring joins the Phase-2 slice-map with the other feature specs, and `to-tickets` will emit the implementable tasks afterward.
Author
Owner

Closed in the 2026-08-27 other-state sweep (Ben's ruling) — child spec complete: 7/7 monitoring slices done, all 17 derived tickets closed.

Closed in the 2026-08-27 `other`-state sweep (Ben's ruling) — child spec complete: 7/7 monitoring slices done, all 17 derived tickets closed.
ben closed this issue 2026-08-27 04:43:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#18
No description provided.