GRI-2073: unassign a device from a playlist #214
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!214
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-2073-unassign-device-playlist"
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?
Closes #209.
Summary
DELETE /api/v1/devices/{device_id}/playlist: removes the assignment, sameContentAssignpermission and campus-visibility rules asPOST, idempotent (204whether or not a row existed), pushesPlaylistClearedto the device's live connection.ServerControl::PlaylistClearedmessage (additive, old clients read it asUnknown).state.playlisttoNoneon receipt; the existing idle-screen path takes over. Cache and manifest untouched.plan/decisions/0014-unassigned-device-shows-idle.md: the "what does an unassigned device show" decision the issue asked for, before building anything.plan/server/rest-api.mdandplan/shared/protocol.mdupdated.Panel side (checkbox, Save-time diffing, Devices-screen "none") is #210, not in this PR.
Test plan
cargo test -p shared -p client --lib— new wire-format and session tests passcargo test -p server --test playlist_integration(against a real Postgres) — unknown device → 404, no-assignment unassign → idempotent 204, assign-then-unassign removes the row and pushesPlaylistCleared, retried unassign stays idempotentscripts/local-gates.sh --rust-only— every gate passed locallyDELETE /api/v1/devices/{device_id}/playlist removes the assignment and pushes PlaylistCleared to the device's live connection, idempotently. The client drops to its existing idle screen on receipt, per ADR 0014.One gap blocks this, everything else reads well (route, permission + campus check, idempotent 204, client drops the playlist and keeps the cache).
A device that is offline when it is unassigned keeps showing the old playlist for ever.
unassign_playlistonly pushesPlaylistClearedto a live connection. On reconnect,ws.rs:432callspush_current_assignment, which returnsOk(())when there is no assignment (handlers.rs:611), so nothing tells the client. The client still hasstate.playlist = Some(..)in its store and plays it. This is exactly the case #209 exists to stop: a screen must never keep showing old content.Fix: in
push_current_assignment, when there is no assignment (and when the assigned playlist was deleted), pushServerControl::PlaylistClearedinstead of returning. It is idempotent on the client. Please add an integration test: assign, disconnect, unassign, reconnect -> the first control frame isplaylist_cleared.Non-blocking: ADR 0014 should say this reconnect rule too.
Approved on
cf5a74e. The offline case is fixed: unassign marks a pending clear when the push reaches nobody, and the reconnect pays it; a never-assigned device gets no push. Covered by a_reconnect_after_an_offline_unassignment_clears_the_playlist.Known limit, not blocking the test deploy: pending_clear is in memory only. If the server restarts while an unassigned device is still offline, the mark is lost and that device keeps its old playlist after it reconnects. Follow-up: keep the mark in the database (or let the client report its playlist id in hello).