P2-S5 Connected card never leaves the Fleet strip — the enrolled projection (#979) has no prune/leave rule #982

Closed
opened 2026-08-29 10:28:57 +00:00 by matou-build-agent · 3 comments

The gap

Follow-up to #979 (landed in c7eef7e2). #979 made the enrolled device
render live as the P2-S5 "Connected — not yet set up" card by adding
enroll.StatusEnrolled to the pending projection query
(internal/controlapi/enroll.go registerEnrollPending). That fixed the
device vanishing. It did not answer the open question #979 flagged:
when does the P2-S5 Connected card LEAVE the strip?

enroll.StatusEnrolled is terminal (internal/enroll/enroll.go:65) and
the ledger never prunes (internal/enroll/ledger.go ListPending returns
every matching request forever). So with the #979 fix in place, a standing
community accumulates one permanent Connected card per device ever
enrolled
— the strip never empties even after every device is set up. The
device-add flow's S5 --provision--> P4S1 edge
(docs/ux/flows/p2-device-add-cli.mermaid:19) implies the card should leave
once the device is provisioned, but no rule exists for that today, in the
flow contract or the code.

Why this is design-tier, not a swarm build

There are three candidate leave-rules and no chosen default, and each has a
different subsystem coupling:

  1. Prune-when-provisioned — filter out enrolled requests whose fleet node
    is already provisioned. Matches the flow's S5→P4S1 edge most directly.
    Cost: couples the enroll pending projection to provisioning/fleet state
    (the fleet store already holds node-<requestID> with a Provisioned bool
    — internal/controlapi/fleet.go:81 — but the enroll ledger's ListPending
    has no view of it today; a new dependency edge).
  2. Recency window — the Connected card shows only for enrolled requests
    confirmed within the last N (minutes/hours), then falls off. No cross-
    subsystem coupling, but picks an arbitrary window and can hide a device the
    operator hasn't yet acted on.
  3. Operator acknowledgement — the card carries a "dismiss / I've got it"
    affordance; enrolled requests leave once acknowledged. New wire verb + UI
    affordance + a persisted ack bit.

There is also a second surface in play: the resting Fleet list is where the
enrolled device permanently lives (enrolledFleetNode,
dashboard/src/lib/pending.ts:146, is currently unwired, and
FleetSurface.vue loads once onMounted with no live re-read —
dashboard/src/components/shell/FleetSurface.vue:186). The admission hook
already places the node un-provisioned server-side
(internal/enroll/admission.go, internal/enroll/ledger.go OnEnrolled), so
the leave-rule and the resting-list live re-read are two halves of the same
"where does a landed device live over time" design.

Proposed default ruling (adopt under ADR 0174 if it qualifies)

Candidate 1 (prune-when-provisioned), because it is the only one the
existing flow contract already implies (S5→P4S1), needs no arbitrary window
and no new operator gesture, and is provable with an integration test (enroll
a device, mark its node provisioned, assert it drops off
GET /api/v1/enroll/pending while staying on GET /api/v1/fleet). Wire the
resting Fleet list's live re-read in the same slice so the device is never
invisible during the hand-off. The enroll→fleet coupling this introduces is
the design decision to confirm before building — hence needs-design.

Until this lands, the #979 fix is net-correct (a device that just joined shows
its true P2-S5 state) but a long-standing community's strip will show stale
Connected cards for already-provisioned devices.

Provenance

Filed by a session-runner agent while landing #979 under ADR 0174 — the
leave-rule was deliberately NOT guessed in that two-way-door fix. Relates to
device-add stories 20/26.

## The gap Follow-up to #979 (landed in `c7eef7e2`). #979 made the enrolled device render live as the P2-S5 "Connected — not yet set up" card by adding `enroll.StatusEnrolled` to the pending projection query (`internal/controlapi/enroll.go` `registerEnrollPending`). That fixed the device *vanishing*. It did **not** answer the open question #979 flagged: **when does the P2-S5 Connected card LEAVE the strip?** `enroll.StatusEnrolled` is **terminal** (`internal/enroll/enroll.go:65`) and the ledger **never prunes** (`internal/enroll/ledger.go` `ListPending` returns every matching request forever). So with the #979 fix in place, a standing community accumulates **one permanent Connected card per device ever enrolled** — the strip never empties even after every device is set up. The device-add flow's `S5 --provision--> P4S1` edge (`docs/ux/flows/p2-device-add-cli.mermaid:19`) implies the card should leave once the device is provisioned, but **no rule exists for that today**, in the flow contract or the code. ## Why this is design-tier, not a swarm build There are three candidate leave-rules and no chosen default, and each has a different subsystem coupling: 1. **Prune-when-provisioned** — filter out enrolled requests whose fleet node is already provisioned. Matches the flow's `S5→P4S1` edge most directly. Cost: couples the enroll pending projection to provisioning/fleet state (the fleet store already holds `node-<requestID>` with a `Provisioned` bool — `internal/controlapi/fleet.go:81` — but the enroll ledger's `ListPending` has no view of it today; a new dependency edge). 2. **Recency window** — the Connected card shows only for enrolled requests confirmed within the last N (minutes/hours), then falls off. No cross- subsystem coupling, but picks an arbitrary window and can hide a device the operator hasn't yet acted on. 3. **Operator acknowledgement** — the card carries a "dismiss / I've got it" affordance; enrolled requests leave once acknowledged. New wire verb + UI affordance + a persisted ack bit. There is also a **second surface** in play: the resting Fleet list is where the enrolled device *permanently* lives (`enrolledFleetNode`, `dashboard/src/lib/pending.ts:146`, is currently unwired, and `FleetSurface.vue` loads once `onMounted` with no live re-read — `dashboard/src/components/shell/FleetSurface.vue:186`). The admission hook already places the node un-provisioned server-side (`internal/enroll/admission.go`, `internal/enroll/ledger.go` `OnEnrolled`), so the leave-rule and the resting-list live re-read are two halves of the same "where does a landed device live over time" design. ## Proposed default ruling (adopt under ADR 0174 if it qualifies) **Candidate 1 (prune-when-provisioned)**, because it is the only one the existing flow contract already implies (`S5→P4S1`), needs no arbitrary window and no new operator gesture, and is provable with an integration test (enroll a device, mark its node provisioned, assert it drops off `GET /api/v1/enroll/pending` while staying on `GET /api/v1/fleet`). Wire the resting Fleet list's live re-read in the same slice so the device is never invisible during the hand-off. The enroll→fleet coupling this introduces is the design decision to confirm before building — hence `needs-design`. Until this lands, the #979 fix is net-correct (a device that just joined shows its true P2-S5 state) but a long-standing community's strip will show stale Connected cards for already-provisioned devices. ## Provenance Filed by a session-runner agent while landing #979 under ADR 0174 — the leave-rule was deliberately NOT guessed in that two-way-door fix. Relates to device-add stories 20/26.
Owner

Ruled by Ben, 2026-08-29 — prune-when-provisioned (candidate 1)

The P2-S5 Connected card leaves the strip when the device's fleet node is provisioned — the rule the flow contract already implies (S5 --provision--> P4S1, docs/ux/flows/p2-device-add-cli.mermaid:19). No recency window, no dismiss gesture.

Build shape as proposed in the filing:

  • The enroll pending projection filters out enrolled requests whose fleet node (node-<requestID>) has Provisioned: true — the enroll→fleet read coupling is hereby accepted as the design decision.
  • Same slice: wire the resting Fleet list's live re-read (enrolledFleetNode in dashboard/src/lib/pending.ts + FleetSurface.vue's one-shot onMounted load) so the device is never invisible during the hand-off.
  • Proof: integration test — enroll a device, mark its node provisioned, assert it drops off GET /api/v1/enroll/pending while staying on GET /api/v1/fleet.

Label flipped needs-design → ready-for-agent.

## Ruled by Ben, 2026-08-29 — **prune-when-provisioned (candidate 1)** The P2-S5 Connected card leaves the strip when the device's fleet node is **provisioned** — the rule the flow contract already implies (`S5 --provision--> P4S1`, `docs/ux/flows/p2-device-add-cli.mermaid:19`). No recency window, no dismiss gesture. Build shape as proposed in the filing: - The enroll pending projection filters out enrolled requests whose fleet node (`node-<requestID>`) has `Provisioned: true` — the enroll→fleet read coupling is hereby accepted as the design decision. - **Same slice:** wire the resting Fleet list's live re-read (`enrolledFleetNode` in `dashboard/src/lib/pending.ts` + `FleetSurface.vue`'s one-shot `onMounted` load) so the device is never invisible during the hand-off. - Proof: integration test — enroll a device, mark its node provisioned, assert it drops off `GET /api/v1/enroll/pending` while staying on `GET /api/v1/fleet`. Label flipped needs-design → ready-for-agent.
Author
Member

swarm-claim host=matou-dev-server-01 run=14215
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=14215 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #982 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 982,
  "status": "success",
  "commits": [
    "f787d5e1"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/compose_enroll_test.go",
    "control-plane/cmd/control-plane/whole_composition.go",
    "control-plane/cmd/control-plane/whole_surfaces.go",
    "internal/controlapi/enroll.go",
    "internal/controlapi/enroll_integration_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/controlapi/... ./internal/enroll/... ./control-plane/...",
      "exit_code": 0
    },
    {
      "command": "gofmt -l (touched files)",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/controlapi/... ./control-plane/cmd/control-plane/...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Leave-rule = prune-when-provisioned (Ben's ruling, candidate 1)": "controlapi.NewEnrollPendingPruned drops Enrolled requests whose fleet node is provisioned (internal/controlapi/enroll.go); wired at composition root reading the real *fleetstate.Projection (whole_composition.go, whole_surfaces.go enrolledNodeProvisioning)",
    "Enrolled request drops off GET /api/v1/enroll/pending once its node is provisioned": "TestEnrollPending_ProvisionedLeavesStripStaysOnFleet asserts len(pending)==0 after the node is marked provisioned (internal/controlapi/enroll_integration_test.go)",
    "...while staying on GET /api/v1/fleet": "same test asserts the node is still present in got.Nodes on GET /api/v1/fleet after provisioning",
    "Un-provisioned enrolled device still shows as the P2-S5 Connected card": "same test asserts len(pending)==1 status Enrolled before the node is provisioned; earlier-phase rows are never pruned (only Enrolled is prune-eligible)",
    "Resting Fleet list live re-read (same slice, never invisible during hand-off)": "already wired by 6d3d9f83 — FleetSurface.vue re-reads GET /api/v1/fleet on the pending strip's edge-triggered watch (FleetSurface.vue:217-234); verified present on this branch",
    "enroll->fleet coupling contained to the composition root, ledger stays pure": "EnrollNodeProvisioning is a consumer-side port in controlapi; the enroll ledger is unchanged"
  },
  "summary": "The P2-S5 Connected card leaves the Fleet strip once its device is provisioned via a pure-read prune decorator over the enroll ledger, joined with the fleet-state projection at the composition root.",
  "blockers": []
}
**close-report** for #982 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 982, "status": "success", "commits": [ "f787d5e1" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/compose_enroll_test.go", "control-plane/cmd/control-plane/whole_composition.go", "control-plane/cmd/control-plane/whole_surfaces.go", "internal/controlapi/enroll.go", "internal/controlapi/enroll_integration_test.go" ], "tests": [ { "command": "go test ./internal/controlapi/... ./internal/enroll/... ./control-plane/...", "exit_code": 0 }, { "command": "gofmt -l (touched files)", "exit_code": 0 }, { "command": "go vet ./internal/controlapi/... ./control-plane/cmd/control-plane/...", "exit_code": 0 } ], "criteria": { "Leave-rule = prune-when-provisioned (Ben's ruling, candidate 1)": "controlapi.NewEnrollPendingPruned drops Enrolled requests whose fleet node is provisioned (internal/controlapi/enroll.go); wired at composition root reading the real *fleetstate.Projection (whole_composition.go, whole_surfaces.go enrolledNodeProvisioning)", "Enrolled request drops off GET /api/v1/enroll/pending once its node is provisioned": "TestEnrollPending_ProvisionedLeavesStripStaysOnFleet asserts len(pending)==0 after the node is marked provisioned (internal/controlapi/enroll_integration_test.go)", "...while staying on GET /api/v1/fleet": "same test asserts the node is still present in got.Nodes on GET /api/v1/fleet after provisioning", "Un-provisioned enrolled device still shows as the P2-S5 Connected card": "same test asserts len(pending)==1 status Enrolled before the node is provisioned; earlier-phase rows are never pruned (only Enrolled is prune-eligible)", "Resting Fleet list live re-read (same slice, never invisible during hand-off)": "already wired by 6d3d9f83 — FleetSurface.vue re-reads GET /api/v1/fleet on the pending strip's edge-triggered watch (FleetSurface.vue:217-234); verified present on this branch", "enroll->fleet coupling contained to the composition root, ledger stays pure": "EnrollNodeProvisioning is a consumer-side port in controlapi; the enroll ledger is unchanged" }, "summary": "The P2-S5 Connected card leaves the Fleet strip once its device is provisioned via a pure-read prune decorator over the enroll ledger, joined with the fleet-state projection at the composition root.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#982
No description provided.