build: Fleet device dialog — edit name/kind/location + PATCH /fleet/nodes/{id} (slice 3/4, resolves #1432) #2061

Closed
opened 2026-10-23 18:01:23 +00:00 by matou-build-agent · 3 comments

Parent

  • Design pass #2050; child spec #2058; DDR 0295. Flow
    docs/ux/flows/p9-device-dialog.mermaid; wireframes P9-D4 / D6.
  • Slice device-facts-edit of docs/slices/fleet-device-dialog.yaml.
  • Resolves the build of #1432 (edit name/kind/location — the promised edit
    that does not exist, fleetstate.go:167).

What to build

The device dialog edits a device's own facts — name, kind, location — in
place
(P9-D4): a name field, a kind picker (server / machine) and a location
field, pre-filled from the device, reusing the device-add dialog's field names
(device-name-input / kind-server|machine / device-location-input, ADR
0237). The one new seam: PATCH /api/v1/fleet/nodes/{id} with optional
name / kind / location + HttpFleetClient.updateNode; the ledger + fleet
store update, the fleet read reflects it on the next poll (one source, DDR 0155
§3). A refused save (empty name, unknown kind, a name already in use) is rejected
before any write and the dialog stays open with the reason, the offending
field marked, nothing changed (P9-D6, #298 fail-loud). Cancel writes nothing.

This is a vertical slice: the seam (PATCH), the Go handler + store write-through,
the dialog edit UI, and tests at both seams.

Acceptance criteria

  • Given the dialog, when Edit facts is chosen, then an edit state opens with
    name, a kind picker (server/machine) and location pre-filled from the device.
  • Given a valid edit, when Save is pressed, then PATCH /api/v1/fleet/nodes/{id}
    is called and Overview, Fleet and the dialog all show the new value on the next
    read (DDR 0155 §3).
  • Given an edit, when Save is refused by the seam (empty name / unknown kind
    / name in use), then the dialog stays open with the reason, the field marked,
    and nothing is written (P9-D6).
  • Given an edit, when Cancel is pressed, then nothing is written and the
    dialog returns to its summary.

Task manifest

task: device-facts-edit
implements_flow: p9-device-dialog
implements_edge: D1→D4 (edit), D4→D1 (save), D4→D6 (refused), D6→D4 (retry), D4→D1 (cancel)
wireframe:
  - docs/ux/wireframes/p9-device-dialog/p9-d4-device-dialog-edit.html
  - docs/ux/wireframes/p9-device-dialog/p9-d6-device-dialog-action-refused.html
interface: |
  PATCH /api/v1/fleet/nodes/{id} { name?, kind?, location? } -> updated node | 4xx with a plain reason
  HttpFleetClient.updateNode(id, { name?, kind?, location? }): Result<FleetNode>
binds:
  - symbol: updateNode
    defined_in: dashboard/src/lib/fleet.ts   # the HttpFleetClient edit op (NON-TEST path, must be in changed_files)
  - symbol: "PATCH /api/v1/fleet/nodes/{id}"
    defined_in: internal/controlapi/fleet.go  # the control-API handler + store write-through
seam: |
  dashboard unit over the injected fleet client (edit happy path, cancel, refusal rendering);
  Go control-API handler test over the in-memory fleet store/ledger (write-through + refusals),
  as the other provision.go/fleet.go handlers are tested.
acceptance:
  - given: a valid edit
    when: Save is pressed
    then: PATCH /api/v1/fleet/nodes/{id} is called and the next fleet read shows the new value
  - given: an empty name
    when: Save is pressed
    then: the seam refuses before writing and the dialog stays open with the reason (P9-D6)
depends_on: [dialog-shell-and-identity]
out_of_scope: [the routed actions — dialog-action-routes; remove — device-remove-entry]
unproven_by_seam: the real ledger/clan persistence of an edited fact across a restart — only a live leg exercises it
needs_human_decision: []

Blocked by

  • #2050 (the design PR must merge — native dependency).
  • dialog-shell-and-identity (the dialog must exist — native dependency).
<!-- origin: app-report #2046 --> ## Parent - Design pass **#2050**; child spec **#2058**; **DDR 0295**. Flow `docs/ux/flows/p9-device-dialog.mermaid`; wireframes P9-D4 / D6. - Slice `device-facts-edit` of `docs/slices/fleet-device-dialog.yaml`. - **Resolves the build of #1432** (edit name/kind/location — the promised edit that does not exist, `fleetstate.go:167`). ## What to build The device dialog edits a device's **own facts — name, kind, location — in place** (P9-D4): a name field, a kind picker (server / machine) and a location field, pre-filled from the device, reusing the device-add dialog's field names (`device-name-input` / `kind-server|machine` / `device-location-input`, ADR 0237). The **one new seam**: `PATCH /api/v1/fleet/nodes/{id}` with optional `name` / `kind` / `location` + `HttpFleetClient.updateNode`; the ledger + fleet store update, the fleet read reflects it on the next poll (one source, DDR 0155 §3). A refused save (empty name, unknown kind, a name already in use) is rejected before any write and the dialog **stays open with the reason**, the offending field marked, nothing changed (P9-D6, #298 fail-loud). *Cancel* writes nothing. This is a vertical slice: the seam (`PATCH`), the Go handler + store write-through, the dialog edit UI, and tests at both seams. ## Acceptance criteria - [ ] Given the dialog, when *Edit facts* is chosen, then an edit state opens with name, a kind picker (server/machine) and location pre-filled from the device. - [ ] Given a valid edit, when *Save* is pressed, then `PATCH /api/v1/fleet/nodes/{id}` is called and Overview, Fleet and the dialog all show the new value on the next read (DDR 0155 §3). - [ ] Given an edit, when *Save* is refused by the seam (empty name / unknown kind / name in use), then the dialog stays open with the reason, the field marked, and nothing is written (P9-D6). - [ ] Given an edit, when *Cancel* is pressed, then nothing is written and the dialog returns to its summary. ## Task manifest ```yaml task: device-facts-edit implements_flow: p9-device-dialog implements_edge: D1→D4 (edit), D4→D1 (save), D4→D6 (refused), D6→D4 (retry), D4→D1 (cancel) wireframe: - docs/ux/wireframes/p9-device-dialog/p9-d4-device-dialog-edit.html - docs/ux/wireframes/p9-device-dialog/p9-d6-device-dialog-action-refused.html interface: | PATCH /api/v1/fleet/nodes/{id} { name?, kind?, location? } -> updated node | 4xx with a plain reason HttpFleetClient.updateNode(id, { name?, kind?, location? }): Result<FleetNode> binds: - symbol: updateNode defined_in: dashboard/src/lib/fleet.ts # the HttpFleetClient edit op (NON-TEST path, must be in changed_files) - symbol: "PATCH /api/v1/fleet/nodes/{id}" defined_in: internal/controlapi/fleet.go # the control-API handler + store write-through seam: | dashboard unit over the injected fleet client (edit happy path, cancel, refusal rendering); Go control-API handler test over the in-memory fleet store/ledger (write-through + refusals), as the other provision.go/fleet.go handlers are tested. acceptance: - given: a valid edit when: Save is pressed then: PATCH /api/v1/fleet/nodes/{id} is called and the next fleet read shows the new value - given: an empty name when: Save is pressed then: the seam refuses before writing and the dialog stays open with the reason (P9-D6) depends_on: [dialog-shell-and-identity] out_of_scope: [the routed actions — dialog-action-routes; remove — device-remove-entry] unproven_by_seam: the real ledger/clan persistence of an edited fact across a restart — only a live leg exercises it needs_human_decision: [] ``` ## Blocked by - **#2050** (the design PR must merge — native dependency). - **dialog-shell-and-identity** (the dialog must exist — native dependency).
Author
Member

⏩ independent reviewer for #2061 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #2061 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>
Author
Member

close-report for #2061 — status success

✅ close-report gates passed — every claim verified against the PR head. PR #2171 (#2171) is open and green; a human merges it and the merge closes this issue via closes #2061 (MERGE_AUTHORITY=human).

envelope
{
  "issue": 2061,
  "status": "success",
  "commits": [
    "cf7ff428679d5f332f0533e65ab1060b1ed79de3"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/compose.go",
    "control-plane/cmd/control-plane/main.go",
    "control-plane/cmd/control-plane/whole_composition.go",
    "dashboard/src/components/shell/DeviceDialog.vue",
    "dashboard/src/components/shell/FleetSurface.vue",
    "dashboard/src/i18n/controlapi/en.ts",
    "dashboard/src/i18n/controlapi/es.ts",
    "dashboard/src/i18n/controlapi/fr.ts",
    "dashboard/src/i18n/controlapi/nl.ts",
    "dashboard/src/i18n/controlapi/pt.ts",
    "dashboard/src/i18n/shell/en.ts",
    "dashboard/src/i18n/shell/es.ts",
    "dashboard/src/i18n/shell/fr.ts",
    "dashboard/src/i18n/shell/nl.ts",
    "dashboard/src/i18n/shell/pt.ts",
    "dashboard/src/lib/api/fleetClient.ts",
    "dashboard/src/lib/api/generated.ts",
    "dashboard/src/lib/fleet.ts",
    "dashboard/src/lib/mountRegistry.ts",
    "dashboard/tests/e2e/preview-harness/fleetDeviceDialogEdit.spec.ts",
    "dashboard/tests/e2e/preview-harness/scenarios.ts",
    "dashboard/tests/fakes/fleet.ts",
    "dashboard/tests/unit/fleetDeviceDialog.test.ts",
    "dashboard/tests/unit/fleetLive.test.ts",
    "internal/controlapi/fleet.go",
    "internal/controlapi/fleet_edit_integration_test.go",
    "internal/enroll/ledger.go",
    "internal/enroll/persisted.go",
    "packages/openapi-spec/openapi.yaml"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command bash -c 'go build ./... && go vet ./... && go test ./... && golangci-lint run ./... && (cd broker && go test ./...)' (pre-push Go gate via land-pr)",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/controlapi/ ./internal/enroll/ ./control-plane/cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "cd dashboard && node_modules/.bin/vitest run",
      "exit_code": 0
    },
    {
      "command": "cd dashboard && node_modules/.bin/vue-tsc -p tsconfig.json --noEmit",
      "exit_code": 0
    },
    {
      "command": "eslint . (pre-push TS gate via land-pr, == pnpm run lint)",
      "exit_code": 0
    },
    {
      "command": "node packages/openapi-spec/scripts/generate-client.mjs --check",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Given the dialog, when Edit facts is chosen, then an edit state opens with name, a kind picker (server/machine) and location pre-filled from the device": "DeviceDialog.vue edit mode (data-action edit-device-<id> -> startEdit pre-fills name/kind/location); tests/unit/fleetDeviceDialog.test.ts 'Edit facts opens an edit state pre-filled'; harness fleetDeviceDialogEdit.spec.ts",
    "Given a valid edit, when Save is pressed, then PATCH /api/v1/fleet/nodes/{id} is called and Overview, Fleet and the dialog all show the new value on the next read (DDR 0155 §3)": "PATCH handler internal/controlapi/fleet.go + fleetFactsEditor (whole_composition.go) write-through enroll ledger EditDeviceFacts + projection re-read; FleetSurface onDialogSaved re-reads; tests/unit/fleetDeviceDialog.test.ts save test + MutableFleetSource surface re-read; fleet_edit_integration_test.go TestFleetEdit_ValidEdit_WritesThroughAndAnswersUpdatedNode",
    "Given an edit, when Save is refused by the seam (empty name / unknown kind / name in use), then the dialog stays open with the reason, the field marked, and nothing is written (P9-D6)": "validateFleetEdit rejects before write + writeFleetEditRefusal (fleet.go); DeviceDialog.vue renders data-field edit-refused + aria-invalid on the field; fleet_edit_integration_test.go empty-name/unknown-kind/name-in-use (writes==0); tests/unit/fleetDeviceDialog.test.ts refusal test; fleetLive.test.ts client mapping",
    "Given an edit, when Cancel is pressed, then nothing is written and the dialog returns to its summary": "DeviceDialog.vue cancel-edit -> cancelEdit (mode=summary, no seam call); tests/unit/fleetDeviceDialog.test.ts 'Cancel writes nothing and returns to the summary'"
  },
  "binds": [
    {
      "symbol": "updateNode",
      "defined_in": "dashboard/src/lib/fleet.ts"
    },
    {
      "symbol": "PATCH /api/v1/fleet/nodes/{id}",
      "defined_in": "internal/controlapi/fleet.go"
    }
  ],
  "summary": "The device dialog edits a device's name/kind/location in place (P9-D4) over a new PATCH /fleet/nodes/{id} seam, with fail-loud refusals (P9-D6); resolves the build of #1432.",
  "blockers": []
}
**close-report** for #2061 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the PR head. PR #2171 (https://git.matou.nz/Matou/idss/pulls/2171) is open and green; a human merges it and the merge closes this issue via `closes #2061` (MERGE_AUTHORITY=human). <details><summary>envelope</summary> ```json { "issue": 2061, "status": "success", "commits": [ "cf7ff428679d5f332f0533e65ab1060b1ed79de3" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/compose.go", "control-plane/cmd/control-plane/main.go", "control-plane/cmd/control-plane/whole_composition.go", "dashboard/src/components/shell/DeviceDialog.vue", "dashboard/src/components/shell/FleetSurface.vue", "dashboard/src/i18n/controlapi/en.ts", "dashboard/src/i18n/controlapi/es.ts", "dashboard/src/i18n/controlapi/fr.ts", "dashboard/src/i18n/controlapi/nl.ts", "dashboard/src/i18n/controlapi/pt.ts", "dashboard/src/i18n/shell/en.ts", "dashboard/src/i18n/shell/es.ts", "dashboard/src/i18n/shell/fr.ts", "dashboard/src/i18n/shell/nl.ts", "dashboard/src/i18n/shell/pt.ts", "dashboard/src/lib/api/fleetClient.ts", "dashboard/src/lib/api/generated.ts", "dashboard/src/lib/fleet.ts", "dashboard/src/lib/mountRegistry.ts", "dashboard/tests/e2e/preview-harness/fleetDeviceDialogEdit.spec.ts", "dashboard/tests/e2e/preview-harness/scenarios.ts", "dashboard/tests/fakes/fleet.ts", "dashboard/tests/unit/fleetDeviceDialog.test.ts", "dashboard/tests/unit/fleetLive.test.ts", "internal/controlapi/fleet.go", "internal/controlapi/fleet_edit_integration_test.go", "internal/enroll/ledger.go", "internal/enroll/persisted.go", "packages/openapi-spec/openapi.yaml" ], "tests": [ { "command": "nix develop .#go-ci --command bash -c 'go build ./... && go vet ./... && go test ./... && golangci-lint run ./... && (cd broker && go test ./...)' (pre-push Go gate via land-pr)", "exit_code": 0 }, { "command": "go test ./internal/controlapi/ ./internal/enroll/ ./control-plane/cmd/control-plane/", "exit_code": 0 }, { "command": "cd dashboard && node_modules/.bin/vitest run", "exit_code": 0 }, { "command": "cd dashboard && node_modules/.bin/vue-tsc -p tsconfig.json --noEmit", "exit_code": 0 }, { "command": "eslint . (pre-push TS gate via land-pr, == pnpm run lint)", "exit_code": 0 }, { "command": "node packages/openapi-spec/scripts/generate-client.mjs --check", "exit_code": 0 } ], "criteria": { "Given the dialog, when Edit facts is chosen, then an edit state opens with name, a kind picker (server/machine) and location pre-filled from the device": "DeviceDialog.vue edit mode (data-action edit-device-<id> -> startEdit pre-fills name/kind/location); tests/unit/fleetDeviceDialog.test.ts 'Edit facts opens an edit state pre-filled'; harness fleetDeviceDialogEdit.spec.ts", "Given a valid edit, when Save is pressed, then PATCH /api/v1/fleet/nodes/{id} is called and Overview, Fleet and the dialog all show the new value on the next read (DDR 0155 §3)": "PATCH handler internal/controlapi/fleet.go + fleetFactsEditor (whole_composition.go) write-through enroll ledger EditDeviceFacts + projection re-read; FleetSurface onDialogSaved re-reads; tests/unit/fleetDeviceDialog.test.ts save test + MutableFleetSource surface re-read; fleet_edit_integration_test.go TestFleetEdit_ValidEdit_WritesThroughAndAnswersUpdatedNode", "Given an edit, when Save is refused by the seam (empty name / unknown kind / name in use), then the dialog stays open with the reason, the field marked, and nothing is written (P9-D6)": "validateFleetEdit rejects before write + writeFleetEditRefusal (fleet.go); DeviceDialog.vue renders data-field edit-refused + aria-invalid on the field; fleet_edit_integration_test.go empty-name/unknown-kind/name-in-use (writes==0); tests/unit/fleetDeviceDialog.test.ts refusal test; fleetLive.test.ts client mapping", "Given an edit, when Cancel is pressed, then nothing is written and the dialog returns to its summary": "DeviceDialog.vue cancel-edit -> cancelEdit (mode=summary, no seam call); tests/unit/fleetDeviceDialog.test.ts 'Cancel writes nothing and returns to the summary'" }, "binds": [ { "symbol": "updateNode", "defined_in": "dashboard/src/lib/fleet.ts" }, { "symbol": "PATCH /api/v1/fleet/nodes/{id}", "defined_in": "internal/controlapi/fleet.go" } ], "summary": "The device dialog edits a device's name/kind/location in place (P9-D4) over a new PATCH /fleet/nodes/{id} seam, with fail-loud refusals (P9-D6); resolves the build of #1432.", "blockers": [] } ``` </details>
Owner

PR #2171 merged to main (5947156f) — closing.

PR #2171 merged to main (5947156f) — closing.
ben closed this issue 2026-11-16 17:33:15 +00:00
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#2061
No description provided.