GRI-2123: force-refresh a device or every connected device on a playlist #262

Merged
vivy merged 3 commits from fix/GRI-2123-device-force-refresh into dev 2026-11-15 23:42:34 +00:00
Member

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 — needs devices_manage, campus-scoped like other device routes, 404 when out of scope. Pushes a new ServerControl::Refresh to 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.
  • New wire frame ServerControl::Refresh (no fields) in crates/shared/src/protocol.rs — the first cut of the Live command family (plan/shared/protocol.md), previously all Later.
  • Client: a Refresh frame restarts the current item from the beginning, using the playlist already held — not whatever the time-based cursor would pick next. A dedicated watch::Sender<u64> counter (client::sync::Sync) carries this past Player::set_playlist's own "nothing changed" equality check, since the playlist genuinely hasn't changed; App::refresh_current redisplays Source directly. This is what makes a URL item (WebRenderer::show → load_url) actually reload — nothing else would ever force that.
  • Docs: 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 own ServerControl::Refresh push.
  • 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 (the gtk-renderer feature is not part of CI's default feature set).

## 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` — needs `devices_manage`, campus-scoped like other device routes, 404 when out of scope. Pushes a new `ServerControl::Refresh` to 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. - New wire frame `ServerControl::Refresh` (no fields) in `crates/shared/src/protocol.rs` — the first cut of the *Live command* family (`plan/shared/protocol.md`), previously all *Later*. - Client: a `Refresh` frame restarts the **current** item from the beginning, using the playlist already held — not whatever the time-based cursor would pick next. A dedicated `watch::Sender<u64>` counter (`client::sync::Sync`) carries this past `Player::set_playlist`'s own "nothing changed" equality check, since the playlist genuinely hasn't changed; `App::refresh_current` redisplays `Source` directly. This is what makes a URL item (`WebRenderer::show` → `load_url`) actually reload — nothing else would ever force that. - Docs: `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: - [x] `a_device_refresh_reaches_a_connected_device_and_restarts_its_item` — a connected device gets the frame. - [x] `a_device_refresh_for_an_out_of_campus_device_is_not_found` — out-of-campus device id is 404. - [x] `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 own `ServerControl::Refresh` push. - [x] `shared::protocol::tests::a_refresh_carries_its_tag_and_no_fields` — wire format. - [x] `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 (the `gtk-renderer` feature is not part of CI's default feature set).
GRI-2123: force-refresh a device or every connected device on a playlist
All checks were successful
CI / the pre-push hook (pull_request) Successful in 5s
CI / cargo fmt (pull_request) Successful in 5s
CI / install.sh client upgrade (pull_request) Successful in 12s
CI / cargo deny (pull_request) Successful in 21s
CI / cargo deny advisories (pull_request) Successful in 23s
CI / cargo clippy (pull_request) Successful in 1m46s
CI / repository boundary (pull_request) Successful in 6s
CI / frontend-web (pull_request) Successful in 1m29s
CI / cargo test (pull_request) Successful in 4m4s
CI / CI (pull_request) Successful in 2s
CI / Notify gate failed (pull_request) Has been skipped
0896f91943
vivy approved these changes 2026-11-15 22:22:11 +00:00
Dismissed
vivy left a comment

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 past set_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.

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 past `set_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.
Merge branch 'dev' into fix/GRI-2123-device-force-refresh
All checks were successful
CI / the pre-push hook (pull_request) Successful in 5s
CI / install.sh client upgrade (pull_request) Successful in 10s
CI / cargo fmt (pull_request) Successful in 5s
CI / cargo deny (pull_request) Successful in 24s
CI / cargo deny advisories (pull_request) Successful in 20s
CI / cargo clippy (pull_request) Successful in 1m30s
CI / repository boundary (pull_request) Successful in 5s
CI / frontend-web (pull_request) Successful in 1m2s
CI / cargo test (pull_request) Successful in 2m49s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
6ec40fb874
vivy dismissed vivy's review 2026-11-15 23:26:39 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

vivy merged commit 33a068698c into dev 2026-11-15 23:42:34 +00:00
vivy deleted branch fix/GRI-2123-device-force-refresh 2026-11-15 23:42:35 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!262
No description provided.