device-add: the code screen's COPY button does nothing — CodeScreen emits copy, every layer forwards it, and DashboardComposition mounts the dialog without an @copy handler #2011

Closed
opened 2026-09-30 03:17:15 +00:00 by ben · 3 comments
Owner

Symptom

On the control panel's device-add code screen (P2-S2), the COPY button beside the install command does nothing. Ben, Whakatōhea Demo, 2026-09-30 03:1xZ, minting a Helper code for bens-mac-04 — the command had to be typed by hand.

Cause

The event is emitted and nobody listens. CodeScreen.vue:23 emits copy(command); DeviceAddSurface.vue:56 forwards it; DeviceAddDialog.vue:16 forwards it again ("forwarded for the consumer's clipboard effect") — and the consumer, DashboardComposition.vue:110, mounts <DeviceAddDialog :source @close> with no @copy handler. The clipboard write was left to "the consumer" at every layer and never wired at the top. The Connect screen (ConnectScreen.vue:390) and the members Invite screen each write navigator.clipboard themselves, so the code screen is the odd one out.

Fix

  • Write the clipboard where the button is, as ConnectScreen does: CodeScreen calls navigator.clipboard.writeText(command) itself, shows Copied for a moment, and falls back honestly (select the text / leave it on screen) when the clipboard API is denied. Keep emitting copy if any test relies on it, but the button must not depend on a parent.
  • Or wire @copy in DashboardComposition.vue — worse, because the same surface is mounted from more than one entry (Overview skeleton, Fleet, the codes ledgers, DDR 0237) and each would need the wiring.
  • A component test: clicking COPY writes the command (stub navigator.clipboard) and shows the confirmation; the existing emit test stays green.

Same hand run as #2002–#2007 (all landed, live on the demo as 2026.09.3061).

## Symptom On the control panel's device-add code screen (P2-S2), the **COPY** button beside the install command does nothing. Ben, Whakatōhea Demo, 2026-09-30 03:1xZ, minting a Helper code for `bens-mac-04` — the command had to be typed by hand. ## Cause The event is emitted and nobody listens. `CodeScreen.vue:23` emits `copy(command)`; `DeviceAddSurface.vue:56` forwards it; `DeviceAddDialog.vue:16` forwards it again ("forwarded for the consumer's clipboard effect") — and the consumer, `DashboardComposition.vue:110`, mounts `<DeviceAddDialog :source @close>` with **no `@copy` handler**. The clipboard write was left to "the consumer" at every layer and never wired at the top. The Connect screen (`ConnectScreen.vue:390`) and the members Invite screen each write `navigator.clipboard` themselves, so the code screen is the odd one out. ## Fix - Write the clipboard where the button is, as ConnectScreen does: `CodeScreen` calls `navigator.clipboard.writeText(command)` itself, shows `Copied` for a moment, and falls back honestly (select the text / leave it on screen) when the clipboard API is denied. Keep emitting `copy` if any test relies on it, but the button must not depend on a parent. - Or wire `@copy` in `DashboardComposition.vue` — worse, because the same surface is mounted from more than one entry (Overview skeleton, Fleet, the codes ledgers, DDR 0237) and each would need the wiring. - A component test: clicking COPY writes the command (stub `navigator.clipboard`) and shows the confirmation; the existing emit test stays green. ## Related Same hand run as #2002–#2007 (all landed, live on the demo as 2026.09.3061).

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

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

close-report for #2011 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit 54284d7c8b is not reachable from origin/main (not landed)
  • changed_files: 'dashboard/src/components/device-add/CodeScreen.vue' is not in the diff of the claimed commits
  • changed_files: 'dashboard/tests/unit/deviceAdd.test.ts' is not in the diff of the claimed commits
envelope
{
  "issue": 2011,
  "status": "success",
  "commits": [
    "54284d7c8bbdc1a0ebae11c9601486476c280333"
  ],
  "changed_files": [
    "dashboard/src/components/device-add/CodeScreen.vue",
    "dashboard/tests/unit/deviceAdd.test.ts"
  ],
  "tests": [
    {
      "command": "npx vitest run tests/unit/deviceAdd.test.ts",
      "exit_code": 0
    },
    {
      "command": "npx vue-tsc -p tsconfig.json --noEmit",
      "exit_code": 0
    }
  ],
  "criteria": {
    "COPY writes the command (stub navigator.clipboard) and shows the confirmation": "CodeScreen.vue copy() calls navigator.clipboard.writeText(command) and sets copied→'Copied'; test 'writes the install command to the clipboard and confirms' in deviceAdd.test.ts asserts writeText(EXPECTED) + button text 'Copied'",
    "falls back honestly when the clipboard API is denied": "copy() catch selects the command text and shows the copy-fallback hint; test 'falls back honestly when the clipboard API is denied' asserts no 'Copied', data-status='failed', copy-fallback present, command still on screen",
    "the button must not depend on a parent": "clipboard write lives in CodeScreen; test mounts CodeScreen alone (no @copy handler) and copy still works",
    "the existing emit test stays green": "copy() still emits('copy', command); test asserts wrapper.emitted('copy')[0]==[EXPECTED]; all 25 deviceAdd tests pass"
  },
  "summary": "The P2-S2 code screen's COPY button now writes the install command to the clipboard itself, confirms, and falls back honestly on denial.",
  "blockers": []
}
**close-report** for #2011 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit 54284d7c8bbdc1a0ebae11c9601486476c280333 is not reachable from origin/main (not landed) - changed_files: 'dashboard/src/components/device-add/CodeScreen.vue' is not in the diff of the claimed commits - changed_files: 'dashboard/tests/unit/deviceAdd.test.ts' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 2011, "status": "success", "commits": [ "54284d7c8bbdc1a0ebae11c9601486476c280333" ], "changed_files": [ "dashboard/src/components/device-add/CodeScreen.vue", "dashboard/tests/unit/deviceAdd.test.ts" ], "tests": [ { "command": "npx vitest run tests/unit/deviceAdd.test.ts", "exit_code": 0 }, { "command": "npx vue-tsc -p tsconfig.json --noEmit", "exit_code": 0 } ], "criteria": { "COPY writes the command (stub navigator.clipboard) and shows the confirmation": "CodeScreen.vue copy() calls navigator.clipboard.writeText(command) and sets copied→'Copied'; test 'writes the install command to the clipboard and confirms' in deviceAdd.test.ts asserts writeText(EXPECTED) + button text 'Copied'", "falls back honestly when the clipboard API is denied": "copy() catch selects the command text and shows the copy-fallback hint; test 'falls back honestly when the clipboard API is denied' asserts no 'Copied', data-status='failed', copy-fallback present, command still on screen", "the button must not depend on a parent": "clipboard write lives in CodeScreen; test mounts CodeScreen alone (no @copy handler) and copy still works", "the existing emit test stays green": "copy() still emits('copy', command); test asserts wrapper.emitted('copy')[0]==[EXPECTED]; all 25 deviceAdd tests pass" }, "summary": "The P2-S2 code screen's COPY button now writes the install command to the clipboard itself, confirms, and falls back honestly on denial.", "blockers": [] } ``` </details>

close-report for #2011 — status success

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

envelope
{
  "issue": 2011,
  "status": "success",
  "commits": [
    "54284d7c8bbdc1a0ebae11c9601486476c280333"
  ],
  "changed_files": [
    "dashboard/src/components/device-add/CodeScreen.vue",
    "dashboard/tests/unit/deviceAdd.test.ts"
  ],
  "tests": [
    {
      "command": "npx vitest run tests/unit/deviceAdd.test.ts",
      "exit_code": 0
    },
    {
      "command": "npx vue-tsc -p tsconfig.json --noEmit",
      "exit_code": 0
    }
  ],
  "criteria": {
    "COPY writes the command (stub navigator.clipboard) and shows the confirmation": "CodeScreen.vue copy() calls navigator.clipboard.writeText(command) and sets copied→'Copied'; test 'writes the install command to the clipboard and confirms' in deviceAdd.test.ts asserts writeText(EXPECTED) + button text 'Copied'",
    "falls back honestly when the clipboard API is denied": "copy() catch selects the command text and shows the copy-fallback hint; test 'falls back honestly when the clipboard API is denied' asserts no 'Copied', data-status='failed', copy-fallback present, command still on screen",
    "the button must not depend on a parent": "clipboard write lives in CodeScreen; test mounts CodeScreen alone (no @copy handler) and copy still works",
    "the existing emit test stays green": "copy() still emits('copy', command); test asserts wrapper.emitted('copy')[0]==[EXPECTED]; all 25 deviceAdd tests pass"
  },
  "summary": "The P2-S2 code screen's COPY button now writes the install command to the clipboard itself, confirms, and falls back honestly on denial.",
  "blockers": []
}
**close-report** for #2011 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 2011, "status": "success", "commits": [ "54284d7c8bbdc1a0ebae11c9601486476c280333" ], "changed_files": [ "dashboard/src/components/device-add/CodeScreen.vue", "dashboard/tests/unit/deviceAdd.test.ts" ], "tests": [ { "command": "npx vitest run tests/unit/deviceAdd.test.ts", "exit_code": 0 }, { "command": "npx vue-tsc -p tsconfig.json --noEmit", "exit_code": 0 } ], "criteria": { "COPY writes the command (stub navigator.clipboard) and shows the confirmation": "CodeScreen.vue copy() calls navigator.clipboard.writeText(command) and sets copied→'Copied'; test 'writes the install command to the clipboard and confirms' in deviceAdd.test.ts asserts writeText(EXPECTED) + button text 'Copied'", "falls back honestly when the clipboard API is denied": "copy() catch selects the command text and shows the copy-fallback hint; test 'falls back honestly when the clipboard API is denied' asserts no 'Copied', data-status='failed', copy-fallback present, command still on screen", "the button must not depend on a parent": "clipboard write lives in CodeScreen; test mounts CodeScreen alone (no @copy handler) and copy still works", "the existing emit test stays green": "copy() still emits('copy', command); test asserts wrapper.emitted('copy')[0]==[EXPECTED]; all 25 deviceAdd tests pass" }, "summary": "The P2-S2 code screen's COPY button now writes the install command to the clipboard itself, confirms, and falls back honestly on denial.", "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#2011
No description provided.