GRI-2123: force-refresh a device or every connected device on a playlist #262
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!262
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/GRI-2123-device-force-refresh"
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?
Summary
Server half of #48 (the panel button stays with glamourweaver on #48). Contract decided on the forge issue, smallest version:
POST /api/v1/devices/{device_id}/refresh— needsdevices_manage, campus-scoped like other device routes, 404 when out of scope. Pushes a newServerControl::Refreshto the device's live connection if it has one;{"refreshed": bool}.POST /api/v1/playlists/{playlist_id}/refresh— same permission, scoped by the playlist's own campus. Fans out to every device assigned the playlist;{"refreshed": [ids], "offline": [ids]}. No queue tonight for the offline ones.ServerControl::Refresh(no fields) incrates/shared/src/protocol.rs— the first cut of the Live command family (plan/shared/protocol.md), previously all Later.Refreshframe restarts the current item from the beginning, using the playlist already held — not whatever the time-based cursor would pick next. A dedicatedwatch::Sender<u64>counter (client::sync::Sync) carries this pastPlayer::set_playlist's own "nothing changed" equality check, since the playlist genuinely hasn't changed;App::refresh_currentredisplaysSourcedirectly. This is what makes a URL item (WebRenderer::show→load_url) actually reload — nothing else would ever force that.plan/server/rest-api.md,plan/shared/protocol.md.Test plan
No pre-written QA tests existed for this issue, so I wrote the acceptance tests myself from the "Done when" list, in their own commit before the implementation:
a_device_refresh_reaches_a_connected_device_and_restarts_its_item— a connected device gets the frame.a_device_refresh_for_an_out_of_campus_device_is_not_found— out-of-campus device id is 404.a_playlist_refresh_reaches_connected_devices_and_reports_the_offline_ones— the playlist route reaches a connected device and reports an offline one, both in the response and in the server's ownServerControl::Refreshpush.shared::protocol::tests::a_refresh_carries_its_tag_and_no_fields— wire format.client::session::tests::a_refresh_notice_carries_the_playlist_already_held— the client-side notice does not disturb the stored playlist.Verified locally:
SIGNAGE_TEST_DATABASE_URL=... ./scripts/local-gates.sh --rust-only— every gate passed. Additionally, by hand:xvfb-run -a cargo test -p client --features gtk-renderer— all tests pass (thegtk-rendererfeature is not part of CI's default feature set).Reviewed. Both routes need
devices_manage, both answer 404 out of campus (the playlist route scopes by the playlist's own campus), and an offline device is not an error. The client's refresh counter gets pastset_playlist's equality check without touching the stored playlist, and the session test proves that. A client older than this PR drops{"type":"refresh"}without error (an_unknown_frame_is_ignored), so a fleet with mixed versions is safe. CI is green. Approved.Note for #261: the device route answers
{"refreshed": bool}, not lists of ids. I asked #261 to match that.New commits pushed, approval review dismissed automatically according to repository settings