Unassign a device from a playlist #209
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#209
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Product owner, 2026-11-15 (GRI-2051): "I want to be able to unassign a device (so uncheck the check box)."
Today.
AssignToDeviceForminPlaylistEditorScreen.tsxrenders an already-assigned device ascheckedand the user cannot clear it. The server has onlyPOST /api/v1/devices/{device_id}/playlist(crates/server/src/playlists/mod.rs:36); there is no route that removes an assignment.Wanted.
DELETE /api/v1/devices/{device_id}/playlistremoves the row fromdevice_playlist_assignments, writes the audit entry, and pushes the change to the device if it is connected (same path as an assignment push). Same campus-scoping rules as assign.Decide first — what does an unassigned device show? Fallback content (#56) is not built yet. Proposed for now: the device shows the existing idle/"no playlist" screen and keeps no old content on screen. Write the choice in
plan/and test it.Acceptance. Unchecking a device and saving makes that device stop playing the playlist within the normal push time, and the panel shows it as unassigned.
Panel side lives in the Devices tab of #210.
Implemented the server side (and the protocol + client support needed for the push to actually clear the screen), on
feature/GRI-2073-unassign-device-playlist.Server
DELETE /api/v1/devices/{device_id}/playlist(crates/server/src/playlists/{mod,handlers,store}.rs): sameContentAssignpermission and campus-visibility check asPOST .../playlist. An unknown or not-visible device is404. Otherwise idempotent:204whether or not the device had an assignment to remove. PushesPlaylistClearedto the device's live connection if it has one (sameDeviceConnections::push,falseignored, same reasoning as assign).plan/server/rest-api.md: documented the new route.Protocol
ServerControl::PlaylistCleared(crates/shared/src/protocol.rs), additive per the envelope's#[serde(other)]rule — an old client reads it asUnknownand ignores it rather than failing to parse.plan/shared/protocol.md: documented the new message.Client
Session::on_playlist_clearedsetsstate.playlist = Noneand the existing idle-screen path (crates/client/src/player.rs, already exercised by a freshly enrolled device) takes over. Cache and manifest are untouched on purpose — only the screen changes, so re-assigning the same playlist later needs no re-transfer.The decision you asked me to make first: an unassigned device shows the existing idle/"no playlist" screen and keeps nothing of what it was showing — written up as
plan/decisions/0014-unassigned-device-shows-idle.md(0013 was already taken twice in this file, by the way — looks like a numbering collision from two branches landing independently; not touching that here, flagging it in case nobody's seen it). Reviewed the options against building fallback content (#56) first; chose not to block this fix on that larger, unscoped feature.Not done, and deliberately so: the issue mentions "writes the audit entry" and "same campus-scoping rules as assign." Campus scoping: done, mirrors
assign_playlistexactly. Audit entry: there is no audit-log write path anywhere in the server yet for any playlist operation —assign_playlistitself writes none, onlyshared::audit::AuditCategoryexists as a taxonomy (plan/server/audit-log.mdis still Draft). I did not build an audit-log write path as part of this issue; that would be new infrastructure well beyond "unassign a device," andassignwould need it first for the two operations to be consistent. Flagging for you to decide whether that's a separate issue.Tests
crates/shared/src/protocol.rs: wire-format test forPlaylistCleared.crates/client/src/session.rs: clearing drops the playlist, leaves the manifest/cache alone.crates/server/tests/playlist_integration.rs: unknown device → 404; no assignment → idempotent 204; assign-then-unassign removes the row (verified by the formerly-blocked playlist delete now succeeding) and pushesPlaylistCleared; a retried unassign is idempotent.Panel side (the checkbox, Save-time diffing, and the Devices-screen "none" option) is signage #210, per your comment on #209 — not touched here.
Local gates (
--rust-only) running now in the working tree; will report the result and push once green.Server side (DELETE /api/v1/devices/{id}/playlist, reconnect-clear fix) is done, gates green, pushing to PR #214.
Flagging a scope gap found while merging #218 (left sub-menu/tabs refactor): the panel has no frontend path to unassign a device at all.
PlaylistDevicesTab.tsxstill renders an assigned device asdisabled={alreadyAssigned}— checking my own earlier commit (5f3512e), I only ever touchedcrates/(server+client), neverfrontend-web/. So this issue's panel acceptance criteria (uncheck+Save unassigns, Devices screen set-to-none) is unimplemented.That's front-end engineer scope, not mine. Leaving this comment so whoever picks up the panel half has the pointer; not closing #209 until that lands.
CI is green on PR #214 (commit
cf5a74e9) after the offline-unassign fix and the dev merge: cargo test/clippy/fmt/deny/frontend-web/repo-boundary/pre-push-hook all pass. Server+client half of this issue (DELETE route, PlaylistCleared push, idle-screen fallback decision in plan/decisions/0014) is complete and ready to merge. Panel UI (checkbox unassign + Devices-screen 'none') is tracked separately as #210 and was never in scope for this PR.Merged in #214. One known limit, recorded for a follow-up: the 'pending clear' mark for a device that was offline at unassign time is kept in server memory only. A server restart before that device reconnects loses it, and the device then keeps its old playlist. Fix later by storing the mark in the database, or by letting the client report its playlist id in hello.