transport: device-add-live (reactive-seam ruling required) #151

Closed
opened 2026-07-27 20:44:20 +00:00 by ben · 4 comments
Owner

Parent

Split from #128 (parent: ADR 0037) per Ben's approval on 2026-07-27 to break the six-surface transport slice into per-surface follow-ups.

Context

From #128's handback comment: device-add's seams are reactive-store shaped, not request/response —

  • CodesLedgerSource.listCodes() is a synchronous snapshot
  • DeviceAddSource/PendingSource use watch() subscriptions plus sync config getters (communityDomain()/releaseChannel())

Making these "live over HTTP" needs reactive HTTP stores that poll/cache — a shape the members migration (request/response) didn't need to solve.

Open question — needs a ruling before implementation starts

Is a reactive HTTP store (poll/cache) compatible with the manifest's out_of_scope: [screen changes], or does a real reactive source require a component/seam change? This is a design call, not an implementation detail — flagged explicitly by the agent as something it shouldn't guess.

What to build (once ruled on)

Wire CodesLedgerSource, DeviceAddSource and PendingSource onto the real control plane, in whatever shape the ruling above settles on.

Acceptance criteria

  • Given the device-add dashboard surfaces (codes ledger, watcher), their production client is the generated one and every flow its tests drive works against a real control plane.
  • Given the OpenAPI spec, it describes every endpoint these surfaces consume.
  • No fake remains in any of these surfaces' production wiring.

Blocked by

  • #128 (members transport pattern, done on main)
  • The reactive-seam ruling above

Task manifest

task: transport:device-add-live
implements_edge: "device-add dashboard surfaces (codes ledger, watcher) read/act over real HTTP"
interface: "TBD pending reactive-seam ruling"
seam: "TBD pending reactive-seam ruling"
acceptance: "see Acceptance criteria above"
depends_on: []
out_of_scope: [screen changes]
needs_human_decision: ["is a reactive HTTP store in-scope as transport-only, or does it require a seam/component change?"]
## Parent Split from #128 (parent: ADR 0037) per Ben's approval on 2026-07-27 to break the six-surface transport slice into per-surface follow-ups. ## Context From #128's handback comment: device-add's seams are **reactive-store shaped**, not request/response — - `CodesLedgerSource.listCodes()` is a **synchronous snapshot** - `DeviceAddSource`/`PendingSource` use `watch()` **subscriptions** plus sync config getters (`communityDomain()`/`releaseChannel()`) Making these "live over HTTP" needs reactive HTTP stores that poll/cache — a shape the members migration (request/response) didn't need to solve. ## Open question — needs a ruling before implementation starts Is a reactive HTTP store (poll/cache) compatible with the manifest's `out_of_scope: [screen changes]`, or does a real reactive source require a component/seam change? This is a design call, not an implementation detail — flagged explicitly by the agent as something it shouldn't guess. ## What to build (once ruled on) Wire `CodesLedgerSource`, `DeviceAddSource` and `PendingSource` onto the real control plane, in whatever shape the ruling above settles on. ## Acceptance criteria - [ ] Given the device-add dashboard surfaces (codes ledger, watcher), their production client is the generated one and every flow its tests drive works against a real control plane. - [ ] Given the OpenAPI spec, it describes every endpoint these surfaces consume. - [ ] No fake remains in any of these surfaces' production wiring. ## Blocked by - #128 (members transport pattern, done on `main`) - The reactive-seam ruling above ## Task manifest ```yaml task: transport:device-add-live implements_edge: "device-add dashboard surfaces (codes ledger, watcher) read/act over real HTTP" interface: "TBD pending reactive-seam ruling" seam: "TBD pending reactive-seam ruling" acceptance: "see Acceptance criteria above" depends_on: [] out_of_scope: [screen changes] needs_human_decision: ["is a reactive HTTP store in-scope as transport-only, or does it require a seam/component change?"] ```
Author
Owner

Human ruling (Ben, in-session 2026-07-28): the reactive HTTP store is IN-SCOPE transport wiring — the #129 "B implement fully" precedent extends to reactive-store-shaped seams.

Concretely, for the needs_human_decision question in the manifest:

  1. A poll/cache reactive HTTP store is transport-only, not a screen change. Implement CodesLedgerSource, DeviceAddSource and PendingSource behind their existing watch() contracts: the store polls the corresponding GET endpoint while ≥1 watcher is subscribed, stops at zero (the fakes' watcherCount() cleanup discipline carries over), and pushes to watchers on change. pending.ts's own contract comment already names this production shape ("List as a watched query").
  2. The sync getters may convert sync→async (communityDomain() / releaseChannel(), and listCodes()'s synchronous snapshot) following the established #129/#152/#153 sync→async precedent, with the consequent component refactors (ref+onMounted+reload) in-scope.
  3. The line that must not move: the rendered wireframe contract — the P2/P3 screens' fields, elements and states are unchanged. out_of_scope: [screen changes] means the design contract, not component code (the settled reading of the B ruling).
  4. Push transport (SSE/websocket) stays out of scope — a later internal upgrade behind the same seams; polling cadence is an implementation detail (pick something honest for the call-in watcher, e.g. a few seconds, and note it).
  5. Wire the results into productionDashboardDeps (the pending strip's deliberate unwired slot at mountRegistry.ts is waiting for exactly this) — no fake in production wiring (#132).

Re-labelling ready-for-human → ready-for-agent.

**Human ruling (Ben, in-session 2026-07-28): the reactive HTTP store is IN-SCOPE transport wiring — the #129 "B implement fully" precedent extends to reactive-store-shaped seams.** Concretely, for the `needs_human_decision` question in the manifest: 1. **A poll/cache reactive HTTP store is transport-only, not a screen change.** Implement `CodesLedgerSource`, `DeviceAddSource` and `PendingSource` behind their existing `watch()` contracts: the store polls the corresponding GET endpoint while ≥1 watcher is subscribed, stops at zero (the fakes' `watcherCount()` cleanup discipline carries over), and pushes to watchers on change. `pending.ts`'s own contract comment already names this production shape ("List as a watched query"). 2. **The sync getters may convert sync→async** (`communityDomain()` / `releaseChannel()`, and `listCodes()`'s synchronous snapshot) following the established #129/#152/#153 sync→async precedent, with the consequent component refactors (`ref`+`onMounted`+reload) in-scope. 3. **The line that must not move:** the rendered wireframe contract — the P2/P3 screens' fields, elements and states are unchanged. `out_of_scope: [screen changes]` means the design contract, not component code (the settled reading of the B ruling). 4. **Push transport (SSE/websocket) stays out of scope** — a later internal upgrade behind the same seams; polling cadence is an implementation detail (pick something honest for the call-in watcher, e.g. a few seconds, and note it). 5. Wire the results into `productionDashboardDeps` (the pending strip's deliberate unwired slot at `mountRegistry.ts` is waiting for exactly this) — no fake in production wiring (#132). Re-labelling `ready-for-human` → `ready-for-agent`.
Author
Owner

Blocked → ready-for-human (Sandcastle, 2026-07-28): a new seam-DATA gap on the pending strip, distinct from the reactive-shape question already ruled on.

Implementing Ben's 2026-07-28 ruling, two of the three sources are cleanly buildable and I am ready to ship them the moment the fork below is settled:

  • CodesLedgerSource (DF2/A4) and DeviceAddSource (P2/P3 mint + call-in) wire against the existing enroll.Operator face — ListCodes / MintCode / RevokeCode, the call-in watcher polled from the code's ledger state (active = waiting, else called-in), and communityDomain()/releaseChannel() served from control-plane config (ADR 0054). No seam change, no fakes.

  • PendingSource (Fleet P2-S4/S5 strip) is blocked. The P2-S4 wireframe card renders name (tōtara), community, code, issuedBy, issuedAgo. The Operator face's List returns RequestView, which carries none of these (only status/probe/mode/network). So a real pending GET cannot fill the card without either (a) an enroll-domain projection change adding those display fields — a seam change in another slice, which the ruling put out of scope — or (b) inventing name/issuer/community in the handler, a production fake (ADR 0100 + acceptance clause 3 forbid it).

Ruling item 3 requires the P2-S4 fields to stay rendered, but the enroll seam cannot supply them today — a genuine fork the reactive-shape ruling did not resolve. A human must pick:

  • A (recommended): Ship codes-ledger + device-add-mint transport now (no seam change, no fakes); split the pending strip into a new ticket that adds a dashboard pending projection (name/issuer/community/code) to the enroll Operator face — the strip stays deliberately unwired-not-faked until then (exactly its state today).
  • B: Declare a small additive enroll pending-projection in-scope for #151 (allow the seam change the ruling deferred), then wire all three here.
  • C: Wire the strip against RequestView as-is, rendering the card without name/issuer/community — a wireframe deviation until enroll grows those fields.

An ask-human was posted to Mattermost (thread mfhexod73pgzudpqj3gcteusba) and timed out with no reply in 20 min; a late reply resumes that same thread. No code was changed this iteration. Re-arm with ready-for-agent once the fork is chosen.

**Blocked → ready-for-human (Sandcastle, 2026-07-28): a new seam-DATA gap on the pending strip, distinct from the reactive-shape question already ruled on.** Implementing Ben's 2026-07-28 ruling, two of the three sources are cleanly buildable and I am ready to ship them the moment the fork below is settled: - **CodesLedgerSource (DF2/A4)** and **DeviceAddSource (P2/P3 mint + call-in)** wire against the existing `enroll.Operator` face — `ListCodes` / `MintCode` / `RevokeCode`, the call-in watcher polled from the code's ledger state (`active` = waiting, else called-in), and `communityDomain()`/`releaseChannel()` served from control-plane config (ADR 0054). No seam change, no fakes. - **PendingSource (Fleet P2-S4/S5 strip)** is blocked. The P2-S4 wireframe card renders `name` (`tōtara`), `community`, `code`, `issuedBy`, `issuedAgo`. The Operator face's `List` returns `RequestView`, which carries **none** of these (only `status`/`probe`/`mode`/`network`). So a real pending GET cannot fill the card without either (a) an **`enroll`-domain projection change** adding those display fields — a seam change in another slice, which the ruling put out of scope — or (b) inventing `name`/`issuer`/`community` in the handler, a production **fake** (ADR 0100 + acceptance clause 3 forbid it). Ruling item 3 requires the P2-S4 fields to stay rendered, but the enroll seam cannot supply them today — a genuine fork the reactive-shape ruling did not resolve. A human must pick: - **A (recommended):** Ship codes-ledger + device-add-mint transport now (no seam change, no fakes); **split** the pending strip into a new ticket that adds a dashboard pending projection (`name`/`issuer`/`community`/`code`) to the `enroll` Operator face — the strip stays deliberately unwired-not-faked until then (exactly its state today). - **B:** Declare a small additive `enroll` pending-projection **in-scope for #151** (allow the seam change the ruling deferred), then wire all three here. - **C:** Wire the strip against `RequestView` as-is, rendering the card **without** `name`/`issuer`/`community` — a wireframe deviation until enroll grows those fields. An `ask-human` was posted to Mattermost (thread `mfhexod73pgzudpqj3gcteusba`) and timed out with no reply in 20 min; a late reply resumes that same thread. No code was changed this iteration. Re-arm with `ready-for-agent` once the fork is chosen.
Author
Owner

Human ruling (Ben, 2026-07-30): Option A — ship the two unblocked sources now; the pending strip splits out.

  • In this ticket: CodesLedgerSource (DF2/A4) and DeviceAddSource (P2/P3 mint + call-in) over the existing enroll.Operator face, reactive per the poll/cache ruling — no seam change, no fakes. The pending strip stays deliberately unwired-not-faked here (its state today).
  • Split out as #184 (transport:pending-strip-live, blocked by this ticket via native dependency): the additive pending projection on the Operator face (name / community / code / issuedBy / issuedAt) plus the strip's live wiring — the deliberate seam growth recorded in its own ticket rather than slipped into this one.

Re-armed ready-for-agent. The ask-human thread (mfhexod73pgzudpqj3gcteusba) is answered with the same ruling.

## Human ruling (Ben, 2026-07-30): **Option A** — ship the two unblocked sources now; the pending strip splits out. - **In this ticket:** CodesLedgerSource (DF2/A4) and DeviceAddSource (P2/P3 mint + call-in) over the existing `enroll.Operator` face, reactive per the poll/cache ruling — no seam change, no fakes. The pending strip stays **deliberately unwired-not-faked** here (its state today). - **Split out as #184** (`transport:pending-strip-live`, blocked by this ticket via native dependency): the additive pending projection on the Operator face (name / community / code / issuedBy / issuedAt) plus the strip's live wiring — the deliberate seam growth recorded in its own ticket rather than slipped into this one. Re-armed `ready-for-agent`. The ask-human thread (`mfhexod73pgzudpqj3gcteusba`) is answered with the same ruling.
Author
Owner

Done (Ruling A) — landed on main as commit 8ec3496 (sandcastle: transport:device-add-live #151).

What shipped — the DF2/A4 codes ledger and the P2/P3 mint + call-in watcher now read/act over enroll's Operator face live over HTTP, per Ben's reactive poll/cache ruling (Option A, 2026-07-30). No seam change, no fakes.

  • OpenAPI (packages/openapi-spec/openapi.yaml): GET/POST /enroll/codes, POST /enroll/codes/{code}/revoke, GET /enroll/config (the install/download config, ADR 0054) + CodeView/CodeState/MintCodeRequest/EnrollConfig schemas. generated.ts regenerated; check:client in sync.
  • Control plane (internal/controlapi/enroll.go): WithEnroll(EnrollCodesService, EnrollConfig) — a thin projection over the real *enroll.Ledger (the Operator face satisfies the narrow port by construction). Go seam test (enroll_integration_test.go): mint→list→revoke, redeem-binds→called-in, unknown→404, config read.
  • Dashboard (src/lib/api/enrollClient.ts): HttpCodesLedgerClient (caches the ledger read, serves sync listCodes(), re-reads after revoke — one ledger, two views) and HttpDeviceAddClient (mint/revoke; sync communityDomain()/releaseChannel() from a cached config read; watchCallIn polls the ledger read — active → waiting, else called-in; polling stops at zero watchers). Both wired real into productionDashboardDeps (new deviceAdd/codesLedger slots); not tab-bound yet (their mount is a needs-design decision), riding the composition value like provisioning/updates. Node-env round-trip test enrollLive.test.ts.

Acceptance

  • AC1 — the device-add dashboard surfaces' production client is the generated one; every flow their tests drive works against a real control plane (Go integration test over the real ledger + node-env TS round-trip; they meet at the spec). ✅
  • AC2 — the OpenAPI spec describes every endpoint these surfaces consume. ✅
  • AC3 — no fake remains in these surfaces' production wiring (productionDashboardDeps uses the real Http clients). ✅

Verify: go build/vet/gofmt clean; go test ./internal/controlapi ./internal/enroll ./control-plane/... ok; openapi check:client in sync; vue-tsc clean; all 678 dashboard tests green.

Scope kept: the pending strip (P2-S4/S5) stayed deliberately unwired-not-faked here — it splits out as #184 (transport:pending-strip-live), now unblocked by this close.

Note for the compose follow-up: WithEnroll is built and integration-tested but not yet registered in control-plane/cmd/control-plane/main.go — wiring the real enroll ledger + its EnrollConfig (community domain / release channel from clan vars, ADR 0054) into the composition root is the compose ticket's job (the #128→#155 precedent).

Done (Ruling A) — landed on `main` as commit `8ec3496` (`sandcastle: transport:device-add-live #151`). **What shipped** — the DF2/A4 codes ledger and the P2/P3 mint + call-in watcher now read/act over `enroll`'s Operator face live over HTTP, per Ben's reactive poll/cache ruling (Option A, 2026-07-30). No seam change, no fakes. - **OpenAPI** (`packages/openapi-spec/openapi.yaml`): `GET/POST /enroll/codes`, `POST /enroll/codes/{code}/revoke`, `GET /enroll/config` (the install/download config, ADR 0054) + `CodeView`/`CodeState`/`MintCodeRequest`/`EnrollConfig` schemas. `generated.ts` regenerated; `check:client` in sync. - **Control plane** (`internal/controlapi/enroll.go`): `WithEnroll(EnrollCodesService, EnrollConfig)` — a thin projection over the real `*enroll.Ledger` (the Operator face satisfies the narrow port by construction). Go seam test (`enroll_integration_test.go`): mint→list→revoke, redeem-binds→called-in, unknown→404, config read. - **Dashboard** (`src/lib/api/enrollClient.ts`): `HttpCodesLedgerClient` (caches the ledger read, serves sync `listCodes()`, re-reads after revoke — one ledger, two views) and `HttpDeviceAddClient` (mint/revoke; sync `communityDomain()`/`releaseChannel()` from a cached config read; `watchCallIn` polls the ledger read — active → waiting, else called-in; polling stops at zero watchers). Both wired **real** into `productionDashboardDeps` (new `deviceAdd`/`codesLedger` slots); not tab-bound yet (their mount is a needs-design decision), riding the composition value like provisioning/updates. Node-env round-trip test `enrollLive.test.ts`. **Acceptance** - AC1 — the device-add dashboard surfaces' production client is the generated one; every flow their tests drive works against a real control plane (Go integration test over the real ledger + node-env TS round-trip; they meet at the spec). ✅ - AC2 — the OpenAPI spec describes every endpoint these surfaces consume. ✅ - AC3 — no fake remains in these surfaces' production wiring (`productionDashboardDeps` uses the real Http clients). ✅ **Verify**: `go build`/`vet`/`gofmt` clean; `go test ./internal/controlapi ./internal/enroll ./control-plane/...` ok; openapi `check:client` in sync; `vue-tsc` clean; all 678 dashboard tests green. **Scope kept**: the pending strip (P2-S4/S5) stayed deliberately unwired-not-faked here — it splits out as **#184** (`transport:pending-strip-live`), now unblocked by this close. **Note for the compose follow-up**: `WithEnroll` is built and integration-tested but **not yet registered** in `control-plane/cmd/control-plane/main.go` — wiring the real enroll ledger + its `EnrollConfig` (community domain / release channel from clan vars, ADR 0054) into the composition root is the compose ticket's job (the #128→#155 precedent).
ben closed this issue 2026-07-30 04:40: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#151
No description provided.