agent: heartbeat-ingest — fleet reporting feeds the production heartbeat stream over HTTP #208

Closed
opened 2026-07-30 23:20:23 +00:00 by ben · 1 comment
Owner

Parent

Monitoring spec #18. Gap audit 2026-07-30 (post #191–#195 sweep of the composition roots and both app shells). Filed per the #191–#195 precedent: a close-out blocker of #183 found while preparing the run, confirmed by Ben.

What's true today

  • The production heartbeat stream is built, composed, and read by the aggregation loop — and fed by nothing: no fleet-reporting route exists on the control plane. A sink with no inlet.
  • The consequence is B·6's premise fails: pull a box's power and nothing notices, because no beat ever arrived to go silent. DDR 0071's discipline (never read silence against a resting fleet) is composed and waiting for a real signal that cannot arrive.

What to build

The fleet-reporting ingest route — device-authenticated, fed by the enrolled agent's reporting face on its cycle — writing into the already-composed production stream. The agent reports over HTTP; the aggregation loop sees each node's Latest refresh within a cycle and a restart re-fills within one (ADR 0107's posture, already built downstream).

Acceptance criteria

  • Given an enrolled device, When its agent reports, Then the node's Latest reflects the beat within a report cycle
  • Given a device whose power is pulled, When beats stop against a live fleet, Then the silence classifies and the monitor raises (the respond ladder from there is already real)
  • Given an unenrolled or unauthenticated caller, Then the ingest refuses

Task manifest

task: agent:heartbeat-ingest
implements_seam: "monitor's FleetReporting face (spec #18) over HTTP, feeding the composed heartbeat stream"
interface: "enrolled agents keep the fleet aware"
seam: "an integration test: agent reports over the wire → aggregation classifies presence and silence"
acceptance:
  - given: an enrolled agent; when: it reports and later goes silent; then: Latest refreshes, then the silence classifies against a live fleet
depends_on: [agent:device-transport]
out_of_scope: [new alert semantics (the ladder is real), per-service checks (provision:brand-and-health)]
needs_human_decision: []

Blocked by

Blocks

#183 — leg B·6 (the pulled plug must be noticed).

## Parent Monitoring spec #18. Gap audit 2026-07-30 (post #191–#195 sweep of the composition roots and both app shells). Filed per the #191–#195 precedent: a close-out blocker of #183 found while preparing the run, confirmed by Ben. ## What's true today - The production heartbeat stream is built, composed, and read by the aggregation loop — and fed by nothing: no fleet-reporting route exists on the control plane. A sink with no inlet. - The consequence is B·6's premise fails: pull a box's power and nothing notices, because no beat ever arrived to go silent. DDR 0071's discipline (never read silence against a resting fleet) is composed and waiting for a real signal that cannot arrive. ## What to build The fleet-reporting ingest route — device-authenticated, fed by the enrolled agent's reporting face on its cycle — writing into the already-composed production stream. The agent reports over HTTP; the aggregation loop sees each node's Latest refresh within a cycle and a restart re-fills within one (ADR 0107's posture, already built downstream). ## Acceptance criteria - [ ] Given an enrolled device, When its agent reports, Then the node's Latest reflects the beat within a report cycle - [ ] Given a device whose power is pulled, When beats stop against a live fleet, Then the silence classifies and the monitor raises (the respond ladder from there is already real) - [ ] Given an unenrolled or unauthenticated caller, Then the ingest refuses ## Task manifest ```yaml task: agent:heartbeat-ingest implements_seam: "monitor's FleetReporting face (spec #18) over HTTP, feeding the composed heartbeat stream" interface: "enrolled agents keep the fleet aware" seam: "an integration test: agent reports over the wire → aggregation classifies presence and silence" acceptance: - given: an enrolled agent; when: it reports and later goes silent; then: Latest refreshes, then the silence classifies against a live fleet depends_on: [agent:device-transport] out_of_scope: [new alert semantics (the ladder is real), per-service checks (provision:brand-and-health)] needs_human_decision: [] ``` ## Blocked by - #207 ## Blocks #183 — leg B·6 (the pulled plug must be noticed).
Author
Owner

Done in 841c393 (on origin/main).

The composed heartbeat stream (#174) finally has its inlet: the enroll seam's second face (enroll.FleetReporting) over HTTP.

  • Route + client — enrollwire.RegisterFleetReporting mounts POST /api/v1/fleet/report over the production sink; enrollwire.ReportClient is the enrolled agent's real reporting client. A not-enrolled refusal rides the typed taxonomy end to end (enroll.ErrNotEnrolled ↔ 403 not_enrolled) so the agent tells an authentication refusal from a transport fault (ADR 0100). A landed beat is 204.
  • Authenticated ingest — monitor.NewAuthenticatedStream gates each beat against the enrolled-node set (the one enroll ledger's NodeStatus) before writing into the in-memory stream the aggregation loop reads (ADR 0107 — heartbeats are runtime signal, never durable truth; ADR 0070 — the control plane stamps arrival, the device clock is never trusted). A stranger can never fabricate a fleet's presence.
  • Composed real — controlapi.WithFleetReporting(NewAuthenticatedStream(enrollLedger, beats)) in the whole composition; at rest it is the honest refusal (restingEnroll.Report — nothing is enrolled to keep the fleet aware).
  • Agent side — the production agent's reporting face is now the real ReportClient (retires the unbuiltFleet stub, the slice this was waiting for).

Acceptance:

  • AC1 (enrolled device reports → Latest reflects the beat within a cycle) ✓
  • AC2 (power pulled → beats stop against a live fleet → silence classifies critical, monitor raises) ✓ — B·6 noticed at last
  • AC3 (unenrolled or unauthenticated caller → ingest refuses) ✓

Evidence: internal/enrollwire/fleet_reporting_integration_test.go drives report → silence over the wire with the REAL aggregation reading the same stream; internal/monitor/authenticated_stream_test.go unit-tests the authentication. STATUS.md updated (header + milestone log).

Note: no Go toolchain in the Sandcastle sandbox (#198) — Go verified by careful review against gofmt (tabs/alignment) and the seam contracts; the seam CI runs the real build.

Done in `841c393` (on `origin/main`). The composed heartbeat stream (#174) finally has its inlet: the enroll seam's second face (`enroll.FleetReporting`) over HTTP. - **Route + client** — `enrollwire.RegisterFleetReporting` mounts `POST /api/v1/fleet/report` over the production sink; `enrollwire.ReportClient` is the enrolled agent's real reporting client. A not-enrolled refusal rides the typed taxonomy end to end (`enroll.ErrNotEnrolled` ↔ 403 `not_enrolled`) so the agent tells an authentication refusal from a transport fault (ADR 0100). A landed beat is 204. - **Authenticated ingest** — `monitor.NewAuthenticatedStream` gates each beat against the enrolled-node set (the one enroll ledger's `NodeStatus`) before writing into the in-memory stream the aggregation loop reads (ADR 0107 — heartbeats are runtime signal, never durable truth; ADR 0070 — the control plane stamps arrival, the device clock is never trusted). A stranger can never fabricate a fleet's presence. - **Composed real** — `controlapi.WithFleetReporting(NewAuthenticatedStream(enrollLedger, beats))` in the whole composition; at rest it is the honest refusal (`restingEnroll.Report` — nothing is enrolled to keep the fleet aware). - **Agent side** — the production agent's reporting face is now the real `ReportClient` (retires the `unbuiltFleet` stub, the slice this was waiting for). **Acceptance:** - AC1 (enrolled device reports → Latest reflects the beat within a cycle) ✓ - AC2 (power pulled → beats stop against a live fleet → silence classifies critical, monitor raises) ✓ — **B·6 noticed at last** - AC3 (unenrolled or unauthenticated caller → ingest refuses) ✓ **Evidence:** `internal/enrollwire/fleet_reporting_integration_test.go` drives report → silence over the wire with the REAL aggregation reading the same stream; `internal/monitor/authenticated_stream_test.go` unit-tests the authentication. STATUS.md updated (header + milestone log). Note: no Go toolchain in the Sandcastle sandbox (#198) — Go verified by careful review against gofmt (tabs/alignment) and the seam contracts; the seam CI runs the real build.
ben closed this issue 2026-07-31 05:33:05 +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.

Reference
Matou/idss#208
No description provided.