dashboard HttpDeviceAddClient: wire placeOptions / serverOffer / rentServer to the new enroll ops so the real panel opens the dialog on the place screen #1398

Closed
opened 2026-09-11 20:09:37 +00:00 by ben · 5 comments
Owner

Parent

Control-panel UI pass, Ben 2026-09-10/11 (branch founding-ui-two-colour-rail-ceremony, unmerged at filing). Device-add spec #13 (ADRs 0053–0057, DDR 0109); founding Access step P1-S4/S4a (ADR 0189 / DDR 0190). The dashboard half is BUILT on the branch: dashboard/src/components/device-add/{PlaceScreen,RentServerScreen,RentedScreen}.vue, DeviceAddSurface.vue (stages place → rent → rented | form), shell/DeviceAddDialog.vue, seam dashboard/src/lib/deviceAdd.ts (DevicePlaceOption, ServerOffer, RentServerRequest, RentedServer; OPTIONAL placeOptions/serverOffer/rentServer on DeviceAddSource), fake dashboard/tests/fakes/deviceAdd.ts, browser harness cd dashboard && pnpm harness → http://localhost:5198/panel.html?scenario=steady.

What to build

dashboard/src/lib/api/enrollClient.ts HttpDeviceAddClient implements the three OPTIONAL DeviceAddSource ops the dialog reads (placeOptions(), serverOffer(), rentServer(req)) over the generated client (dashboard/src/lib/api/generated.ts regenerated from the control API's OpenAPI once #1397 lands): snake/camel mapping as the mint does, a broker fault surfacing as the rent card's in-place error (rentError, Retry), never a thrown-away promise. Because the ops are optional on the seam, a control plane WITHOUT them (an older gateway) still opens the dialog straight on the enrol form — keep that: the client declares the methods only when the config read (GET /api/v1/enroll/config) says the gateway has a broker (add has_broker: bool to the config view if it is not there).

Acceptance criteria

  • Given a gateway whose config read says has_broker: true, when the operator opens Add a device from the Overview, Fleet or the codes ledger, then the dialog opens on the place screen with the seam's three places.
  • Given has_broker: false, when opened, then the dialog opens on the enrol form with no Back button and no rent path.
  • Given the rent card, when Rent this server is pressed with a name, size and region, then the client POSTs /api/v1/enroll/rent with {name, region, preset} and the rented outcome shows the response's ip/preset/region; Done closes the dialog.
  • Given a 502 from the rent, when it returns, then the rent card shows the broker's message with Retry and nothing else changes.
  • Given the client unit tests (dashboard/tests/unit/), when run, then the three ops are covered against a fake control-plane client, including the no-broker fallback.

Blocked by

The rent-op ticket and #1395 (the wireframe the client's screens are held to).

Why agent

Thin client wiring over a landed API — two-way door, provable by unit tests + the harness.

## Parent Control-panel UI pass, Ben 2026-09-10/11 (branch `founding-ui-two-colour-rail-ceremony`, unmerged at filing). Device-add spec #13 (ADRs 0053–0057, DDR 0109); founding Access step P1-S4/S4a (ADR 0189 / DDR 0190). The dashboard half is BUILT on the branch: `dashboard/src/components/device-add/{PlaceScreen,RentServerScreen,RentedScreen}.vue`, `DeviceAddSurface.vue` (stages place → rent → rented | form), `shell/DeviceAddDialog.vue`, seam `dashboard/src/lib/deviceAdd.ts` (`DevicePlaceOption`, `ServerOffer`, `RentServerRequest`, `RentedServer`; OPTIONAL `placeOptions/serverOffer/rentServer` on `DeviceAddSource`), fake `dashboard/tests/fakes/deviceAdd.ts`, browser harness `cd dashboard && pnpm harness` → `http://localhost:5198/panel.html?scenario=steady`. ## What to build `dashboard/src/lib/api/enrollClient.ts` `HttpDeviceAddClient` implements the three OPTIONAL `DeviceAddSource` ops the dialog reads (`placeOptions()`, `serverOffer()`, `rentServer(req)`) over the generated client (`dashboard/src/lib/api/generated.ts` regenerated from the control API's OpenAPI once #1397 lands): snake/camel mapping as the mint does, a broker fault surfacing as the rent card's in-place error (`rentError`, Retry), never a thrown-away promise. Because the ops are optional on the seam, a control plane WITHOUT them (an older gateway) still opens the dialog straight on the enrol form — keep that: the client declares the methods only when the config read (`GET /api/v1/enroll/config`) says the gateway has a broker (add `has_broker: bool` to the config view if it is not there). ## Acceptance criteria - [ ] Given a gateway whose config read says `has_broker: true`, when the operator opens Add a device from the Overview, Fleet or the codes ledger, then the dialog opens on the place screen with the seam's three places. - [ ] Given `has_broker: false`, when opened, then the dialog opens on the enrol form with no Back button and no rent path. - [ ] Given the rent card, when Rent this server is pressed with a name, size and region, then the client POSTs `/api/v1/enroll/rent` with `{name, region, preset}` and the rented outcome shows the response's ip/preset/region; Done closes the dialog. - [ ] Given a 502 from the rent, when it returns, then the rent card shows the broker's message with Retry and nothing else changes. - [ ] Given the client unit tests (`dashboard/tests/unit/`), when run, then the three ops are covered against a fake control-plane client, including the no-broker fallback. ## Blocked by The rent-op ticket and #1395 (the wireframe the client's screens are held to). ## Why agent Thin client wiring over a landed API — two-way door, provable by unit tests + the harness.

Blocked — the dashboard rent half this ticket wires to does not exist

I claimed #1398 and investigated. The ticket is framed as "thin client wiring over a landed API" — wire HttpDeviceAddClient's three optional ops to an already-built dashboard half. That foundation is not reachable in any commit on any branch:

  • No components. PlaceScreen.vue, RentServerScreen.vue, RentedScreen.vue, shell/DeviceAddDialog.vue, and the place → rent → rented staging in DeviceAddSurface.vue have never been added in any commit (checked git log --all --diff-filter=A). origin/founding-ui-two-colour-rail-ceremony does not contain them — its deviceAdd.ts is byte-identical to main and its DeviceAddSurface.vue references no rent screens. The branch was never pushed with the rent work.
  • No seam extension. dashboard/src/lib/deviceAdd.ts has none of DevicePlaceOption / ServerOffer / RentServerRequest / RentedServer, and DeviceAddSource has no optional placeOptions / serverOffer / rentServer ops (git log --all -S DevicePlaceOption / -S RentServerRequest → empty). The fake in tests/fakes/deviceAdd.ts has no rent methods either.
  • No OpenAPI / generated client. #1397 (landed) built only the Go seam + broker primitive and explicitly deferred the OpenAPI contract for /enroll/{places,server-offer,rent} to #1400 (see its close note: "Next (#1400 live half): … the openapi contract for the three routes"). So packages/openapi-spec/openapi.yaml and dashboard/src/lib/api/generated.ts have none of the three routes, and EnrollConfig has no has_broker.

So the acceptance criteria #1–#4 (dialog opens on the place screen, the rent card, the rented outcome, the 502 error) require the entire dashboard rent UI + seam + fake to be built first — that is a separate workstream (Ben's control-panel UI pass), not "thin client wiring", and reconstructing it here would collide with that unmerged branch and with #1400's designated OpenAPI work when they land.

What I need from a human (asked, no reply in the window)

I posted this to Mattermost and waited the full window; no reply came, so I'm parking it. The scope fork:

  • (A) Reconstruct the entire dashboard rent half here — Go has_broker + OpenAPI 3 routes + regenerate generated.ts + seam types/ops + fake + client + PlaceScreen/RentServerScreen/RentedScreen + DeviceAddDialog + DeviceAddSurface staging + unit & component tests. Large; collides with the never-merged founding-ui-two-colour-rail-ceremony branch and with #1400's OpenAPI.
  • (B) Land only the engineering foundation now — Go has_broker + OpenAPI 3 routes + regenerate + seam types/ops + fake + HttpDeviceAddClient ops + unit tests (acceptance #5) — and let the UI screens (#1–#4) wait for Ben's branch to merge.
  • (C) Land the dashboard rent half + OpenAPI contract first (merge founding-ui-two-colour-rail-ceremony, and/or do #1400's OpenAPI), then re-arm this ticket as the client-wiring slice it was written to be.

Why human

A human must resolve the false premise: either merge/land the dashboard rent half + the /enroll/{places,server-offer,rent} OpenAPI contract (so this becomes the thin wiring it was scoped as), or explicitly rescope this ticket to build the whole feature here. The choice is a cross-workstream coordination call (collision with an unmerged human branch and with #1400) that is not an agent's to make unilaterally. Re-add ready-for-agent once the foundation is on main or the ticket is rescoped.

## Blocked — the dashboard rent half this ticket wires to does not exist I claimed #1398 and investigated. The ticket is framed as *"thin client wiring over a landed API"* — wire `HttpDeviceAddClient`'s three optional ops to an already-built dashboard half. That foundation is **not reachable in any commit on any branch**: - **No components.** `PlaceScreen.vue`, `RentServerScreen.vue`, `RentedScreen.vue`, `shell/DeviceAddDialog.vue`, and the place → rent → rented staging in `DeviceAddSurface.vue` have never been added in any commit (checked `git log --all --diff-filter=A`). `origin/founding-ui-two-colour-rail-ceremony` does **not** contain them — its `deviceAdd.ts` is byte-identical to `main` and its `DeviceAddSurface.vue` references no rent screens. The branch was never pushed with the rent work. - **No seam extension.** `dashboard/src/lib/deviceAdd.ts` has none of `DevicePlaceOption` / `ServerOffer` / `RentServerRequest` / `RentedServer`, and `DeviceAddSource` has no optional `placeOptions` / `serverOffer` / `rentServer` ops (`git log --all -S DevicePlaceOption` / `-S RentServerRequest` → empty). The fake in `tests/fakes/deviceAdd.ts` has no rent methods either. - **No OpenAPI / generated client.** #1397 (landed) built only the Go seam + broker primitive and **explicitly deferred the OpenAPI contract for `/enroll/{places,server-offer,rent}` to #1400** (see its close note: *"Next (#1400 live half): … the openapi contract for the three routes"*). So `packages/openapi-spec/openapi.yaml` and `dashboard/src/lib/api/generated.ts` have none of the three routes, and `EnrollConfig` has no `has_broker`. So the acceptance criteria #1–#4 (dialog opens on the place screen, the rent card, the rented outcome, the 502 error) require the entire dashboard rent UI + seam + fake to be built first — that is a separate workstream (Ben's control-panel UI pass), not "thin client wiring", and reconstructing it here would collide with that unmerged branch and with #1400's designated OpenAPI work when they land. ### What I need from a human (asked, no reply in the window) I posted this to Mattermost and waited the full window; no reply came, so I'm parking it. The scope fork: - **(A)** Reconstruct the entire dashboard rent half here — Go `has_broker` + OpenAPI 3 routes + regenerate `generated.ts` + seam types/ops + fake + client + `PlaceScreen`/`RentServerScreen`/`RentedScreen` + `DeviceAddDialog` + `DeviceAddSurface` staging + unit & component tests. Large; collides with the never-merged `founding-ui-two-colour-rail-ceremony` branch and with #1400's OpenAPI. - **(B)** Land only the engineering foundation now — Go `has_broker` + OpenAPI 3 routes + regenerate + seam types/ops + fake + `HttpDeviceAddClient` ops + unit tests (acceptance #5) — and let the UI screens (#1–#4) wait for Ben's branch to merge. - **(C)** Land the dashboard rent half + OpenAPI contract first (merge `founding-ui-two-colour-rail-ceremony`, and/or do #1400's OpenAPI), then re-arm this ticket as the client-wiring slice it was written to be. ## Why human A human must resolve the false premise: either merge/land the dashboard rent half + the `/enroll/{places,server-offer,rent}` OpenAPI contract (so this becomes the thin wiring it was scoped as), or explicitly rescope this ticket to build the whole feature here. The choice is a cross-workstream coordination call (collision with an unmerged human branch and with #1400) that is not an agent's to make unilaterally. Re-add `ready-for-agent` once the foundation is on `main` or the ticket is rescoped.
Author
Owner

Unblocked and re-scoped — ready-for-agent (ruled by session under ADR 0174 on Ben's 2026-09-12 sitting; veto anytime).

Both halves now exist on origin/main:

  • the DASHBOARD half the earlier blocked ruling could not find landed in 606531a0 (the control-panel pass): dashboard/src/components/device-add/{PlaceScreen,RentServerScreen,RentedScreen}.vue, the DeviceAddSurface.vue stages, shell/DeviceAddDialog.vue, src/lib/deviceAdd.ts (optional placeOptions / serverOffer / rentServer on DeviceAddSource), tests/fakes/deviceAdd.ts, unit coverage in tests/unit/deviceAddStages.test.ts;
  • the GO half landed in a575406b (#1397): internal/controlapi/enroll_rent.go registers GET /api/v1/enroll/places, GET /api/v1/enroll/server-offer, POST /api/v1/enroll/rent.

What is still missing, and is this ticket: a575406b did NOT add the three routes to packages/openapi-spec/openapi.yaml (the commit touched no spec file), so dashboard/src/lib/api/generated.ts has no getEnrollPlaces / getEnrollServerOffer / postEnrollRent, and HttpDeviceAddClient (dashboard/src/lib/api/enrollClient.ts) implements none of the three optional ops. Do:

  1. openapi: the three paths + schemas mirroring enroll_rent.go's DevicePlaceOption, ServerOffer, RentedServer, rentServerRequest (snake_case on the wire, #126); add has_broker: bool to the /enroll/config view (the Go side: true when a broker client is composed). Regenerate the client (pnpm -C packages/openapi-spec … per the repo's check:client).
  2. HttpDeviceAddClient: declare placeOptions / serverOffer / rentServer ONLY when the config read says has_broker (an older gateway still opens the dialog straight on the enrol form — the surface already handles the absent ops); camelize in, snakeize out as the mint does; a broker 5xx surfaces as the rent card's rentError with Retry, never a thrown-away promise.
  3. Unit tests against a fake control-plane client: the three ops, the no-broker fallback, the 502 path. Then the harness (cd dashboard && pnpm harness) shows the dialog opening on the place screen in the steady scenario — already true with the fake.

Acceptance criteria in the body stand as written. Ben's eyes on the live dialog come after, on the next rented drive (#1400 is the live round-trip).

**Unblocked and re-scoped — ready-for-agent (ruled by session under ADR 0174 on Ben's 2026-09-12 sitting; veto anytime).** Both halves now exist on `origin/main`: - the DASHBOARD half the earlier blocked ruling could not find landed in `606531a0` (the control-panel pass): `dashboard/src/components/device-add/{PlaceScreen,RentServerScreen,RentedScreen}.vue`, the `DeviceAddSurface.vue` stages, `shell/DeviceAddDialog.vue`, `src/lib/deviceAdd.ts` (optional `placeOptions / serverOffer / rentServer` on `DeviceAddSource`), `tests/fakes/deviceAdd.ts`, unit coverage in `tests/unit/deviceAddStages.test.ts`; - the GO half landed in `a575406b` (#1397): `internal/controlapi/enroll_rent.go` registers `GET /api/v1/enroll/places`, `GET /api/v1/enroll/server-offer`, `POST /api/v1/enroll/rent`. **What is still missing, and is this ticket:** `a575406b` did NOT add the three routes to `packages/openapi-spec/openapi.yaml` (the commit touched no spec file), so `dashboard/src/lib/api/generated.ts` has no `getEnrollPlaces / getEnrollServerOffer / postEnrollRent`, and `HttpDeviceAddClient` (`dashboard/src/lib/api/enrollClient.ts`) implements none of the three optional ops. Do: 1. openapi: the three paths + schemas mirroring `enroll_rent.go`'s `DevicePlaceOption`, `ServerOffer`, `RentedServer`, `rentServerRequest` (snake_case on the wire, #126); add `has_broker: bool` to the `/enroll/config` view (the Go side: true when a broker client is composed). Regenerate the client (`pnpm -C packages/openapi-spec …` per the repo's check:client). 2. `HttpDeviceAddClient`: declare `placeOptions / serverOffer / rentServer` ONLY when the config read says `has_broker` (an older gateway still opens the dialog straight on the enrol form — the surface already handles the absent ops); camelize in, snakeize out as the mint does; a broker 5xx surfaces as the rent card's `rentError` with Retry, never a thrown-away promise. 3. Unit tests against a fake control-plane client: the three ops, the no-broker fallback, the 502 path. Then the harness (`cd dashboard && pnpm harness`) shows the dialog opening on the place screen in the `steady` scenario — already true with the fake. Acceptance criteria in the body stand as written. Ben's eyes on the live dialog come after, on the next rented drive (#1400 is the live round-trip).

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

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

swarm-claim host=bens-mac-04 run=22601
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=22601 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1398 — status success

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

envelope
{
  "issue": 1398,
  "status": "success",
  "commits": [
    "89ae6b6a"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/compose.go",
    "dashboard/src/entry/served.ts",
    "dashboard/src/lib/api/enrollClient.ts",
    "dashboard/src/lib/api/generated.ts",
    "dashboard/tests/unit/enrollLive.test.ts",
    "internal/controlapi/enroll.go",
    "internal/controlapi/enroll_integration_test.go",
    "packages/openapi-spec/openapi.yaml",
    "packages/openapi-spec/tests/unit/spec.test.ts"
  ],
  "tests": [
    {
      "command": "node packages/openapi-spec/scripts/generate-client.mjs --check",
      "exit_code": 0
    },
    {
      "command": "CI=true node_modules/.bin/vitest run tests/unit/enrollLive.test.ts (dashboard)",
      "exit_code": 0
    },
    {
      "command": "CI=true node_modules/.bin/vitest run tests/unit/deviceAddStages.test.ts tests/unit/fleetLive.test.ts tests/unit/pendingLive.test.ts tests/unit/serveEntry.test.ts (dashboard)",
      "exit_code": 0
    },
    {
      "command": "node_modules/.bin/vue-tsc -p tsconfig.json --noEmit (dashboard)",
      "exit_code": 0
    },
    {
      "command": "CI=true node_modules/.bin/vitest run (packages/openapi-spec)",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "go test ./control-plane/cmd/control-plane/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "has_broker:true -> dialog opens on the place screen with the seam's three places": "enrollClient.ts loadConfig() attaches placeOptions/serverOffer/rentServer only when has_broker; DeviceAddSurface.vue gates the place screen on typeof placeOptions==='function' (deviceAddStages.test.ts, 19 passing); enrollLive.test.ts asserts the three ops attach and placeOptions returns the three places (rented/own-vps/self-hosted) over a live control plane",
    "has_broker:false -> dialog opens on the enrol form with no Back/rent path": "enrollLive.test.ts 'has_broker:false' asserts placeOptions/serverOffer/rentServer are undefined after loadConfig; DeviceAddSurface opens stage 'form' when hasPlaces is false (deviceAddStages.test.ts)",
    "Rent this server POSTs /enroll/rent {name,region,preset} and the rented outcome shows ip/preset/region; Done closes": "enrollLive.test.ts asserts the received body equals {name,region,preset} (snakeized) and the outcome maps ip/preset(spec line)/region; RentedScreen.vue renders rented-ip/rented-preset/rented-region and emits done (deviceAddStages.test.ts)",
    "a 502 from the rent shows the broker's message with Retry, nothing else changes": "enrollLive.test.ts '502 from the rent' asserts rentServer rejects with the broker's message; RentServerScreen.vue catches it into rentError with a Retry button (data-status='rent-error')",
    "client unit tests cover the three ops against a fake control-plane client incl. the no-broker fallback": "dashboard/tests/unit/enrollLive.test.ts adds 4 tests: has_broker:true (all three ops), has_broker:false fallback, missing-has_broker fallback, and the 502 path — all against a live control-plane HTTP server; 10/10 passing"
  },
  "summary": "Added the /enroll/{places,server-offer,rent} OpenAPI contract + has_broker on /enroll/config, regenerated the client, and wired HttpDeviceAddClient's three optional RENTED-path ops (attached only when the gateway has a broker), with unit coverage of the ops, the no-broker fallback and the 502 path.",
  "blockers": []
}
**close-report** for #1398 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1398, "status": "success", "commits": [ "89ae6b6a" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/compose.go", "dashboard/src/entry/served.ts", "dashboard/src/lib/api/enrollClient.ts", "dashboard/src/lib/api/generated.ts", "dashboard/tests/unit/enrollLive.test.ts", "internal/controlapi/enroll.go", "internal/controlapi/enroll_integration_test.go", "packages/openapi-spec/openapi.yaml", "packages/openapi-spec/tests/unit/spec.test.ts" ], "tests": [ { "command": "node packages/openapi-spec/scripts/generate-client.mjs --check", "exit_code": 0 }, { "command": "CI=true node_modules/.bin/vitest run tests/unit/enrollLive.test.ts (dashboard)", "exit_code": 0 }, { "command": "CI=true node_modules/.bin/vitest run tests/unit/deviceAddStages.test.ts tests/unit/fleetLive.test.ts tests/unit/pendingLive.test.ts tests/unit/serveEntry.test.ts (dashboard)", "exit_code": 0 }, { "command": "node_modules/.bin/vue-tsc -p tsconfig.json --noEmit (dashboard)", "exit_code": 0 }, { "command": "CI=true node_modules/.bin/vitest run (packages/openapi-spec)", "exit_code": 0 }, { "command": "go test ./internal/controlapi/", "exit_code": 0 }, { "command": "go test ./control-plane/cmd/control-plane/", "exit_code": 0 } ], "criteria": { "has_broker:true -> dialog opens on the place screen with the seam's three places": "enrollClient.ts loadConfig() attaches placeOptions/serverOffer/rentServer only when has_broker; DeviceAddSurface.vue gates the place screen on typeof placeOptions==='function' (deviceAddStages.test.ts, 19 passing); enrollLive.test.ts asserts the three ops attach and placeOptions returns the three places (rented/own-vps/self-hosted) over a live control plane", "has_broker:false -> dialog opens on the enrol form with no Back/rent path": "enrollLive.test.ts 'has_broker:false' asserts placeOptions/serverOffer/rentServer are undefined after loadConfig; DeviceAddSurface opens stage 'form' when hasPlaces is false (deviceAddStages.test.ts)", "Rent this server POSTs /enroll/rent {name,region,preset} and the rented outcome shows ip/preset/region; Done closes": "enrollLive.test.ts asserts the received body equals {name,region,preset} (snakeized) and the outcome maps ip/preset(spec line)/region; RentedScreen.vue renders rented-ip/rented-preset/rented-region and emits done (deviceAddStages.test.ts)", "a 502 from the rent shows the broker's message with Retry, nothing else changes": "enrollLive.test.ts '502 from the rent' asserts rentServer rejects with the broker's message; RentServerScreen.vue catches it into rentError with a Retry button (data-status='rent-error')", "client unit tests cover the three ops against a fake control-plane client incl. the no-broker fallback": "dashboard/tests/unit/enrollLive.test.ts adds 4 tests: has_broker:true (all three ops), has_broker:false fallback, missing-has_broker fallback, and the 502 path — all against a live control-plane HTTP server; 10/10 passing" }, "summary": "Added the /enroll/{places,server-offer,rent} OpenAPI contract + has_broker on /enroll/config, regenerated the client, and wired HttpDeviceAddClient's three optional RENTED-path ops (attached only when the gateway has a broker), with unit coverage of the ops, the no-broker fallback and the 502 path.", "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.

Reference
Matou/idss#1398
No description provided.