feat(devices): uninstall the agent on delete, prompt to force when unreachable (VAPP-55) #66
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VAPP-55-delete-uninstall-agent-prompt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements the delete-device UI half of the uninstall-on-delete flow (VAPP-55). Pairs with the server orchestration (VS-70, vervain-server PR #90) and the agent self-uninstall (VA-87, merged). The delete dialog now reflects that deleting uninstalls the agent, and prompts to proceed when the agent is unreachable instead of silently deleting or erroring.
Server fn
remove_device(device_id, force)returns a typedDeleteOutcomeinstead ofResult<(), _>:Deleted- agent uninstalled (if reachable) and record removed (ackok).AgentUnreachable- agent offline / ack timed out, nothing deleted (ackagent-unreachable).UninstallFailed- agent reached but uninstall errored, nothing deleted (ackuninstall-failed).AgentUnreachable/UninstallFailedare states the dialog reacts to, so they come back asOk; genuine failures (not-authorized,db-error, ...) stayServerFnError. The single-noderemovedevicesnow carries the top-levelforceboolean. Tokens are the kebab-case strings pinned in VS-70.Dialog (device_detail.rs)
AgentUnreachablethe dialog switches to a force-confirm step: "The agent is offline and can't be uninstalled remotely. Delete the device anyway? The agent will remain installed on the machine and must be removed manually." Its "Delete anyway" re-issuesremove_device(.., force = true).UninstallFailed, a distinct retry message; the record is kept.force_promptsignal drives the two steps; reset when the dialog opens. The name-confirm gate applies only to the first (non-force) attempt.Acceptance criteria
just checkpasses (verified equivalently in the rust-builder image, see below).Verification
In
ghcr.io/niceguyit/rust-builder-glibc:v1.0.1-rust1.94-trixie:cargo fmt --checkclean.cargo clippy --all-targets --features server -- -D warningsclean.cargo check --target wasm32-unknown-unknownclean (client).cargo check --features desktopclean (the desktop CI build triggers onsrc/**;just checkdoes not compile this feature).cargo test --features server --bin vervain-app-> 24 passed.Sequencing
Merge after VS-70 (PR #90) merges and deploys to staging, so the dialog's "deleting uninstalls the agent" copy is truthful end-to-end. The server tolerates a UI that never sends
force, and this UI tolerates the new tokens, so the two can land in either order without breaking, but the copy is only accurate once the server uninstalls.#VAPP-55
The delete-device dialog now reflects the VS-70 server flow: a normal delete uninstalls the agent from the machine before removing the record, and an offline agent gets a "Delete anyway?" prompt instead of a silent delete or an opaque error. `remove_device` gains a `force` flag and returns a typed `DeleteOutcome` (Deleted / AgentUnreachable / UninstallFailed) instead of `Result<(), _>`: the unreachable and uninstall-failed results are states the dialog branches on, so they ride back as `Ok` while genuine failures (not-authorized, db-error, ...) stay errors. The single-node `removedevices` now carries `force` and its ack maps `ok` -> Deleted, `agent-unreachable` -> AgentUnreachable, `uninstall-failed` -> UninstallFailed (these are the kebab-case tokens pinned in VS-70). In the dialog: the name-confirm copy now says deleting uninstalls the agent; on `AgentUnreachable` the dialog switches to a force-confirm step ("The agent is offline and can't be uninstalled remotely. Delete the device anyway? ...") whose "Delete anyway" re-issues with `force: true`; `UninstallFailed` surfaces a distinct retry message and keeps the record. The reachable happy path is unchanged (now with the agent uninstalled server-side). A `force_prompt` signal drives the two steps and is reset when the dialog opens. Verified in the rust-builder-glibc image: cargo fmt, clippy --all-targets --features server -D warnings, cargo check --target wasm32-unknown-unknown, cargo check --features desktop, and cargo test --features server --bin vervain-app all pass. #VAPP-55 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>