engine-adapters: compose-heartbeat-stream — agents' reports feed monitoring's latest-heartbeat store #174

Closed
opened 2026-07-29 05:10:05 +00:00 by ben · 1 comment
Owner

Parent

Engine-adapters child spec: #161 (ADRs 0102–0107; scoped on wayfinder #160 — Ben ruled live: per-family clan-lab smokes gate each family, the arc closes on a real-hardware end-to-end, tickets arm the swarm). Everything else agent-decided, post-hoc review pending.

What to build

The heartbeat stream (ADR 0107): the agents' FleetReporting.Report path feeds an in-memory latest-value store serving monitor's Latest — runtime signal, re-filled within a report cycle after a restart; expected-pattern tunings are already durable via store-runtime-ledgers.

Acceptance criteria

  • Given agents reporting, When monitor.Latest is read, Then it serves each node's latest heartbeat
  • Given a control-plane restart, When a report cycle passes, Then the store is warm again and no false silence-raise fires during warm-up

Blocked by

  • bootstrap:enroll-seam — #26 (closed; satisfied)

Task manifest

task: engine-adapters:compose-heartbeat-stream
implements_seam: "the confirmed seams + ADRs 0102-0107 are the design contract (no flow/wireframe — spec #161)"
interface: "enroll.FleetReporting → monitor heartbeat port — contracts unchanged"
seam: "internal/monitor + internal/enroll seam tests over the wired stream"
acceptance:
  - given: report traffic; when: restart; then: warm-up window classifies honestly, no phantom raise
depends_on: [bootstrap:enroll-seam]
out_of_scope: [screen changes (no UI surface in this arc), the release source / rollout mechanics (out of arc, wayfinder #160)]
needs_human_decision: []
## Parent Engine-adapters child spec: #161 (ADRs 0102–0107; scoped on wayfinder #160 — Ben ruled live: per-family clan-lab smokes gate each family, the arc closes on a real-hardware end-to-end, tickets arm the swarm). Everything else agent-decided, post-hoc review pending. ## What to build The heartbeat stream (ADR 0107): the agents' FleetReporting.Report path feeds an in-memory latest-value store serving monitor's Latest — runtime signal, re-filled within a report cycle after a restart; expected-pattern tunings are already durable via store-runtime-ledgers. ## Acceptance criteria - [ ] Given agents reporting, When monitor.Latest is read, Then it serves each node's latest heartbeat - [ ] Given a control-plane restart, When a report cycle passes, Then the store is warm again and no false silence-raise fires during warm-up ## Blocked by - bootstrap:enroll-seam — #26 (closed; satisfied) ## Task manifest ```yaml task: engine-adapters:compose-heartbeat-stream implements_seam: "the confirmed seams + ADRs 0102-0107 are the design contract (no flow/wireframe — spec #161)" interface: "enroll.FleetReporting → monitor heartbeat port — contracts unchanged" seam: "internal/monitor + internal/enroll seam tests over the wired stream" acceptance: - given: report traffic; when: restart; then: warm-up window classifies honestly, no phantom raise depends_on: [bootstrap:enroll-seam] out_of_scope: [screen changes (no UI surface in this arc), the release source / rollout mechanics (out of arc, wayfinder #160)] needs_human_decision: [] ```
Author
Owner

Done in 08e274e (on origin/main).

Built the engine-adapters heartbeat stream's input leg (ADR 0107): the production monitor.HeartbeatStream — an in-memory latest-value store implementing both the enroll seam's FleetReporting.Report (write, from the agents) and monitoring's Heartbeats.Latest (read, for the aggregation loop). Concurrency-safe, latest-wins, arrival stamped from the control plane's clock — the real counterpart of FakeHeartbeats.

AC1 (agents reporting → Latest serves each node) and AC2 (restart → empty store → no false silence-raise during warm-up, warm again after a report cycle) are covered by seam tests over the wired stream:

  • internal/monitor/stream_test.go drives the real store through the aggregation loop: Report feeds Latest; a restart starts empty so every node reads never-reported (Latest ok=false), which the silence classifier holds as pre-history (DDR 0071 / #80) — no phantom raise — and a genuinely-silent warm node still raises (the suppression is pre-history, not blanket).
  • internal/enroll/heartbeat_stream_test.go (external enroll_test) proves the write leg honours FleetReporting (latest-wins, idempotent, independent per node).

Heartbeat state is runtime signal, not rebuild-surviving truth (ADR 0103 §1); pattern tunings stay durable via store-runtime-ledgers.

Not wired into main.go — per ADR 0107 the monitor.New swap + aggregation-loop start is the fan-in slice compose-aggregation-loop (#181), which depends on this input leg (the loop starts only when the composition root is whole). This slice ships the store component + its seam tests, unwired-not-faked.

Verified: go build ./..., go vet, go test ./... (incl. -race on the new tests) all green.

Done in `08e274e` (on `origin/main`). Built the engine-adapters heartbeat stream's **input leg** (ADR 0107): the production `monitor.HeartbeatStream` — an in-memory latest-value store implementing both the enroll seam's `FleetReporting.Report` (write, from the agents) and monitoring's `Heartbeats.Latest` (read, for the aggregation loop). Concurrency-safe, latest-wins, arrival stamped from the control plane's clock — the real counterpart of `FakeHeartbeats`. **AC1** (agents reporting → `Latest` serves each node) and **AC2** (restart → empty store → no false silence-raise during warm-up, warm again after a report cycle) are covered by seam tests over the wired stream: - `internal/monitor/stream_test.go` drives the real store through the aggregation loop: Report feeds Latest; a restart starts empty so every node reads never-reported (`Latest` ok=false), which the silence classifier holds as pre-history (DDR 0071 / #80) — no phantom raise — and a genuinely-silent *warm* node still raises (the suppression is pre-history, not blanket). - `internal/enroll/heartbeat_stream_test.go` (external `enroll_test`) proves the write leg honours `FleetReporting` (latest-wins, idempotent, independent per node). Heartbeat state is runtime signal, not rebuild-surviving truth (ADR 0103 §1); pattern tunings stay durable via store-runtime-ledgers. **Not wired into `main.go`** — per ADR 0107 the `monitor.New` swap + aggregation-loop start is the fan-in slice `compose-aggregation-loop` (#181), which depends on this input leg (the loop starts only when the composition root is whole). This slice ships the store component + its seam tests, unwired-not-faked. Verified: `go build ./...`, `go vet`, `go test ./...` (incl. `-race` on the new tests) all green.
ben closed this issue 2026-07-29 05:35: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.

Reference
Matou/idss#174
No description provided.