Console: delete an idle simulator or emulator
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- frontend
Direzione di ricerca
Read ui/src/model/actions.ts and the existing cases in ui/src/model/actions.test.ts first; then check how useActions().run is tested in ui/src/state/actions.test.tsx. Add coverage for offering and running the action, and update e2e/console/actions.spec.ts and website/.../worker/console.mdx as specified. Done means the listed unit and console tests pass and the docs state when deletion is offered.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Part of #1131.
Scope
On a worker's console, an operator can delete an idle simulator or emulator: the Devices tab's ⋯ menu, the device's drawer and ⌘K offer Delete device on a virtual device that is ready or shutdown, behind a confirm. It calls DELETE /v1/devices/{id} with the device's dev_… id, which #1134 makes delete it. On a gateway, or before the mode is known, it is not offered.
In short
Delete device asks first, then the device goes, and its row reads deleted once the daemon's device.deleted event arrives, as every deleted device's row does today. A device that an agent leased in the meantime is refused by the daemon, and the error toast says so in the daemon's words.
flowchart LR
R["Simulator row ⋯, drawer, ⌘K (Delete device, new)"] --> C["Confirm: Delete Pixel 9 (Android 16)?"]
C --> D["DELETE /v1/devices/dev_7f3a"]
D --> T[Toast; the row reads deleted on device.deleted]
D --> E[Error toast: dev_7f3a is leased: release it first]
Words, exactly (<model> and <version> are the device's, <os> is iOS or Android, <id> its dev_… id):
| Where | Text |
|---|---|
| Menu label | Delete device (danger, last after a line) |
| Confirm title | Delete <model> (<os> <version>)? |
| Confirm body | It is shut down and removed from disk. If the warm pool keeps this kind, it boots a new one. |
| Buttons | Keep, Delete device (busy: Deleting…) |
| Success toast | Deleted <model> (<os> <version>) |
| Error toast title | Couldn't delete <model> (<os> <version>), with the daemon's message below, e.g. <id> is leased: release it first |
If this goes wrong, an operator would notice Delete device on a device the daemon then refuses, or no Delete device on an idle one.
Technical spec
Facts
Commit ce8fea85. #1133 and #1134 add what this task reads; their rows are the feature's Shared values.
| # | Fact | Source |
|---|---|---|
| F1 | Action ids are a closed union; a danger action carries a confirm and a failure title | ui/src/model/actions.ts:12-51 |
| F2 | useActions().run confirms, writes, toasts the outcome, and shows the ApiError's message under the failure title |
ui/src/state/actions.ts:68-123; ui/src/data/api.ts:15-25 |
| F3 | The status device shape carries id (dev_… for a virtual device), spec (model, OS version), state, physical |
src/contract/schemas.ts:214-231; src/core/registry.ts:248 |
| F4 | Virtual states are provisioning, ready, leased, reclaiming, quarantined, shutdown, deleted |
src/contract/schemas.ts:17-26 |
| F5 | Every device. event marks ['workers'] stale |
ui/src/model/stale-keys.ts:36-37 |
| F6 | The model and state tests sit in actions.test.ts and actions.test.tsx |
ui/src/model/actions.test.ts:1-30; ui/src/state/actions.test.tsx:1-40 |
| F7 | The warm pool keeps a device of each configured target and learned kind, and boots one when a kept kind has none | src/core/warm-pool/converger.ts:246, :454 |
Modules touched
Searches: deviceActions, ItemAction["id"], "remove-phone" in ui/src (#1133 adds them), and "Delete device", "simulator" in website/src/content/docs/docs/worker/console.mdx.
ui/src/model/actions.ts:deviceActionsgains Delete device for a virtual device; the iddelete-device.ui/src/model/actions.test.ts,ui/src/state/actions.test.tsx.website/.../worker/console.mdx: Delete device.e2e/console/actions.spec.ts.
The row menu, the drawer and ⌘K already read deviceActions, and its input already carries the model, platform name and OS version (#1133's Modules touched), so no screen, state or other model file changes.
flowchart LR
surfaces[Row menu, drawer, ⌘K] --> list["model/actions.ts deviceActions *"]
list --> run[state/actions.ts run]
run --> route["DELETE /v1/devices/dev_… (#1134)"]
sequenceDiagram
participant O as Operator
participant C as Console
participant D as Worker daemon
O->>C: Delete device on dev_7f3a, confirm
C->>D: DELETE /v1/devices/dev_7f3a
alt 200
D-->>C: { id, driverDeviceId, physical: false }
D-->>C: events device.shutdown, device.deleted
C-->>O: toast Deleted Pixel 9 (Android 16)
else 409 DEVICE_BUSY
C-->>O: error toast with dev_7f3a is leased: release it first, Retry
else 404 from an older daemon
C-->>O: error toast with dev_7f3a is not an enrolled device
end
Contract and event changes
none. #1134 changes the route's answer; this task reads none of it.
Other code on the same state
Searches: inFlight (1 writer) and itemKey device/ (#1133's key).
| Component | Both act | Who wins |
|---|---|---|
| #1133's Remove phone | same list, same itemKey form; a device is a phone or not, so never both |
— |
| An agent's lease | the daemon's claim decides (#1134) | the first; the console shows the refusal |
| The warm pool | may boot a new device of the kind after the delete | both happen; the confirm says so |
Failure modes
| Call | Outcome | What happens | Limit, counted from |
|---|---|---|---|
DELETE /v1/devices/{dev id} |
200 | Deleted <model> (<os> <version>) |
200 s from the send (feature Shared values) |
| same | 409 DEVICE_BUSY |
error toast with the daemon's message, Retry | same |
| same | 404 (an older daemon) | error toast with the daemon's message | same |
| same | 401 | no toast; the session signs out | same |
| same | no answer | The daemon did not answer.; the daemon goes on, and the row reads deleted when its event arrives |
same |
The console writes no state.
Rules in play
- ADR 0055 §3: "a virtual device
readyorshutdown" in worker mode. - ADR 0037 §3: "Dangerous actions sit last in a menu, after a line, in the error colour."
- ADR 0037 §5: "An error toast shows the daemon's own
message". - documentation rule 9:
worker/console.mdxnames Delete device.
Tests
Seam: deviceActions in ui/src/model/actions.ts (modelled on ui/src/model/actions.test.ts) and useActions().run (modelled on ui/src/state/actions.test.tsx).
- An operator opens a simulator's or emulator's menu and sees Delete device only when it is idle, on a worker: mode
workerwithreadyandshutdown(offered, danger, last, confirm as worded);leased,reclaiming,provisioning,quarantined,deleted(not offered); modegatewayand unknown (nothing); a phone (no Delete device). - An operator runs Delete device and sees a confirm naming the model, then one
DELETE /v1/devices/dev_…and a toast: confirmed and 200 (path with thedev_…id,timeoutMs200000,Deleted Pixel 9 (Android 16)); cancelled (no request); 409DEVICE_BUSY(Couldn't delete Pixel 9 (Android 16)with the daemon's message).
Done when
pnpm exec vitest run --project unit ui/src/model/actions.test.ts ui/src/state/actions.test.tsxpasses with the Tests lines above.pnpm test:console --project=chromium e2e/console/actions.spec.tspasses with a new test: on a worker, Delete device on an idle emulator asks, sends oneDELETE /v1/devices/dev_…, and shows the toast.website/.../worker/console.mdxnames Delete device and when it is offered.
Out of scope
- The daemon's delete (#1134).
- Deleting a quarantined simulator or emulator.
- Device actions on a gateway's console.
Depends on
- #1133
- #1134
Written by an agent.
- Lingua principale
- TypeScript
- Stelle
- 705
- Fork
- 40
- Merge medio
- 12h 9m
- PR unite (30g)
- 376
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di callstackincubator/simlock
-
request:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
callstackincubator/simlock#1806 ·
I maintainer di solito rispondono entro 1 giorno
-
bug:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
callstackincubator/simlock#1780 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
task:draft
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
callstackincubator/simlock#1441 ·
I maintainer di solito rispondono entro 1 giorno
-
bug:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
callstackincubator/simlock#1805 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
callstackincubator/simlock#1804 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di callstackincubator/simlock
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Update project links after the repository renamesForse già presa @JonathanTSilva l’ha presa oggi. Apertaai-generated priority: p2 size: xs type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
JonathanTSilva/jts-website#119 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
promplate/code-review#158 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Docs] CONTRIBUTING points the Backend Remake milestone at a branch that does not existForse già presa @franpts2 l’ha presa oggi. Apertadocs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 3 giorni