engine-adapters: store-fleet-projection — fleet state reads the config repo + enroll ledger, never a second database #167

Closed
opened 2026-07-29 05:09:39 +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 fleet-state store real (ADR 0103 §3): a projection over the config repo's inventory plus the enroll ledger — never a parallel device database that could drift from what clan deploys. Feeds the P4 assess/select reads, monitoring's silence-classification input, and backups' target recommendation with one shared fleet.

Acceptance criteria

  • Given a device enrolled and placed, When the fleet store is read, Then devices/datasets/gaps derive from inventory + enroll ledger only
  • Given a device removed from inventory, When the projection refreshes, Then every consumer (P4/P5/P7 reads) sees the same fleet
  • Given the projection is lost, When the control plane restarts, Then it re-derives losslessly (nothing is lost if it's lost)

Blocked by

  • engine-adapters:store-runtime-ledgers
  • engine-adapters:clan-adapter-core

Task manifest

task: engine-adapters:store-fleet-projection
implements_seam: "the confirmed seams + ADRs 0102-0107 are the design contract (no flow/wireframe — spec #161)"
interface: "fleetstate store reads (Devices/Datasets/Gaps/Device/Healthy) — contracts unchanged"
seam: "fleetstate + consumer orchestrators' seam tests over the projection; a re-derivation test"
acceptance:
  - given: inventory + ledger fixtures; when: projected; then: consumer reads agree across P4/P5/P7
depends_on: [engine-adapters:store-runtime-ledgers, engine-adapters:clan-adapter-core]
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 fleet-state store real (ADR 0103 §3): a projection over the config repo's inventory plus the enroll ledger — never a parallel device database that could drift from what clan deploys. Feeds the P4 assess/select reads, monitoring's silence-classification input, and backups' target recommendation with one shared fleet. ## Acceptance criteria - [ ] Given a device enrolled and placed, When the fleet store is read, Then devices/datasets/gaps derive from inventory + enroll ledger only - [ ] Given a device removed from inventory, When the projection refreshes, Then every consumer (P4/P5/P7 reads) sees the same fleet - [ ] Given the projection is lost, When the control plane restarts, Then it re-derives losslessly (nothing is lost if it's lost) ## Blocked by - engine-adapters:store-runtime-ledgers - engine-adapters:clan-adapter-core ## Task manifest ```yaml task: engine-adapters:store-fleet-projection implements_seam: "the confirmed seams + ADRs 0102-0107 are the design contract (no flow/wireframe — spec #161)" interface: "fleetstate store reads (Devices/Datasets/Gaps/Device/Healthy) — contracts unchanged" seam: "fleetstate + consumer orchestrators' seam tests over the projection; a re-derivation test" acceptance: - given: inventory + ledger fixtures; when: projected; then: consumer reads agree across P4/P5/P7 depends_on: [engine-adapters:store-runtime-ledgers, engine-adapters:clan-adapter-core] 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 386208f (on origin/main).

What shipped: internal/fleetstate/projection.go — Projection, the real production fleetstate.Reader (ADR 0103 §3): a live dual-source read over the config-repo inventory + the enroll ledger, never a parallel device database.

  • Holds no state — every Devices/Device/Datasets/Gaps/Healthy read re-derives from its sources, so P4 assess/select, P5 monitoring silence classification, and P7 backups target recommendation share ONE fleet; a lost projection re-derives losslessly on restart (AC3).
  • Membership + placement (role/site/quorum/services/datasets) from the config-repo Inventory port — a node removed from inventory drops from every consumer at once (AC2). Per-node resources/network/install facts from the enroll ledger (EnrollLedger, satisfied by *enroll.Ledger), keyed by the grant node identity (AC1).
  • Healthy delegates to provisionings default-deny bit (Health, injected at compose; nil → default-deny) — coverage is re-derivable, not part of the inventory+ledger derivation (ADR 0103 §3).
  • Observed uptime pattern (DDR 0071) rides an optional WithPatterns overlay, honestly UptimeNew until monitoring supplies one.
  • MemoryInventory is the injectable inventory source; the real config-repo reader lands with the compose root (#181). Contracts unchanged — Projection satisfies fleetstate.Reader, monitor.FleetState and backup.FleetState as they stand.

Evidence: internal/fleetstate/projection_test.go proves all three acceptance clauses over a REAL enroll.Ledger (dual-source derivation, one-fleet-across-P4/P5/P7 after a removal, lossless re-derivation). go build/vet/full suite clean. STATUS.md header + milestone log updated in the same commit.

Next (#181): wire the real config-repo inventory reader + provisioning health read into the projection (ADR 0107); observed patterns from monitoring.

Done in `386208f` (on origin/main). **What shipped:** `internal/fleetstate/projection.go` — `Projection`, the real production `fleetstate.Reader` (ADR 0103 §3): a live dual-source read over the config-repo inventory + the enroll ledger, never a parallel device database. - **Holds no state** — every `Devices`/`Device`/`Datasets`/`Gaps`/`Healthy` read re-derives from its sources, so P4 assess/select, P5 monitoring silence classification, and P7 backups target recommendation share ONE fleet; a lost projection re-derives losslessly on restart (AC3). - **Membership + placement** (role/site/quorum/services/datasets) from the config-repo `Inventory` port — a node removed from inventory drops from every consumer at once (AC2). **Per-node resources/network/install facts** from the enroll ledger (`EnrollLedger`, satisfied by `*enroll.Ledger`), keyed by the grant node identity (AC1). - `Healthy` delegates to provisionings default-deny bit (`Health`, injected at compose; nil → default-deny) — coverage is re-derivable, not part of the inventory+ledger derivation (ADR 0103 §3). - Observed uptime pattern (DDR 0071) rides an optional `WithPatterns` overlay, honestly `UptimeNew` until monitoring supplies one. - `MemoryInventory` is the injectable inventory source; the real config-repo reader lands with the compose root (#181). Contracts unchanged — `Projection` satisfies `fleetstate.Reader`, `monitor.FleetState` and `backup.FleetState` as they stand. **Evidence:** `internal/fleetstate/projection_test.go` proves all three acceptance clauses over a REAL `enroll.Ledger` (dual-source derivation, one-fleet-across-P4/P5/P7 after a removal, lossless re-derivation). `go build`/`vet`/full suite clean. STATUS.md header + milestone log updated in the same commit. **Next (#181):** wire the real config-repo inventory reader + provisioning health read into the projection (ADR 0107); observed patterns from monitoring.
ben closed this issue 2026-07-29 20:24:19 +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#167
No description provided.