Force refresh of a device or a playlist from the panel, including URL items #48

Closed
opened 2026-11-07 18:58:16 +00:00 by vivy · 8 comments
Owner

What

Panel button that makes a device reload now.

Done when

The device reloads within seconds of the click.

Depends on

#16

Plan

plan/shared/protocol.md


Routing/Hold: no agent is routed to this issue automatically. To take it yourself, assign yourself. Vivy removes the hold when it is handed to an agent.
Created for GRI-1818 from plan/overview/roadmap.md and the MVP plan on GRI-1761.

## What Panel button that makes a device reload now. ## Done when The device reloads within seconds of the click. ## Depends on #16 ## Plan plan/shared/protocol.md --- `Routing/Hold`: no agent is routed to this issue automatically. To take it yourself, assign yourself. Vivy removes the hold when it is handed to an agent. Created for GRI-1818 from `plan/overview/roadmap.md` and the MVP plan on GRI-1761.
vivy changed title from Live force refresh of a device to Force refresh of a device or a playlist from the panel, including URL items 2026-11-15 17:39:39 +00:00
Author
Owner

Asked by the product owner (GRI-2051, 2026-11-15 17:37 UTC): "put a button on a playlist and device that forces an update of a playlist, and if there are URL objects, that we can force refresh those too from the panel."

This widens #48 and moves it to Campus production test:

  • Device → Refresh: the device fetches its playlist and media again now, and reloads every web (URL) item.
  • Playlist → Refresh: the same for every device that shows this playlist.
  • The server sends the command over the existing device connection. A device that is offline gets it when it reconnects, and the panel says so ("will refresh when online").
  • The Devices screen (#228) shows when the last refresh was asked and when the device confirmed it.
  • Refresh is not a dangerous action, so the button is not red (#230).

Done when

  • On the test client: change a web page that is shown, press Refresh on the device, and the screen shows the new version within seconds. The same works from the playlist.
Asked by the product owner (GRI-2051, 2026-11-15 17:37 UTC): *"put a button on a playlist and device that forces an update of a playlist, and if there are URL objects, that we can force refresh those too from the panel."* This widens #48 and moves it to **Campus production test**: - **Device → Refresh:** the device fetches its playlist and media again now, and reloads every web (URL) item. - **Playlist → Refresh:** the same for every device that shows this playlist. - The server sends the command over the existing device connection. A device that is offline gets it when it reconnects, and the panel says so ("will refresh when online"). - The Devices screen (#228) shows when the last refresh was asked and when the device confirmed it. - Refresh is not a dangerous action, so the button is not red (#230). ## Done when - On the test client: change a web page that is shown, press Refresh on the device, and the screen shows the new version within seconds. The same works from the playlist.
Member

Looked at what exists before building against it (no branch/commits yet — this is a contract/test check, not implementation).

The "Live command" protocol family this needs does not exist yet. plan/shared/protocol.md lists it explicitly as *Later*, not MVP:

  • ServerControl (crates/shared/src/protocol.rs) has only PlaylistPush, PlaylistCleared, MediaManifest, TransferOffer, Unknown. There is no Refresh (or any live-command) variant to push down the socket.
  • ClientMessage has only Registration, Heartbeat, TransferAccept, TransferComplete, Unknown. There is no client → server acknowledgement frame a refresh command could use to report "confirmed".
  • DeviceConnections::push (crates/server/src/connections.rs:121) already exists and can send any ServerControl to a connected device, and AuditCategory::LiveCommands already exists in crates/shared/src/audit.rs — so the plumbing to add this family to is there, but the family itself isn't built.
  • There is no REST endpoint today to trigger anything per-device beyond approve/block/rename/campus-reassign (crates/server/src/devices.rs routes) — nothing a panel button could call to ask for a refresh.
  • Offline queueing ("will refresh when online") needs somewhere durable to hold "a refresh is owed to this device" across a reconnect; nothing like that exists on the Device row or elsewhere.
  • Client-side, crates/client/src/renderer/web.rs renders URL items, but there is no reload/re-fetch command it currently listens for.

This overlaps directly with #228, which is blocked on the same shape of gap (forge #228 comment 13174, board GRI-2103): this issue's "Devices screen shows when the last refresh was asked and confirmed" needs the rollout-status stream (crates/server/src/rollout_status.rs) extended with refresh-asked/confirmed state, which is the same server surface #228 is waiting on a contract for.

No tests exist for this either. grep -ril refresh frontend-web/src --include='*.test.*' and the same over crates/server/tests and crates/client both come up empty for anything matching a force-refresh/live-command flow.

Per process (tests first, written by QA; API shape agreed with backend before building against it), I don't have a contract or acceptance tests to build the frontend half against. Questions that need backend design before I can implement the panel side:

  1. What's the new ServerControl/ClientMessage pair for refresh request + confirmation, and does it bump PROTOCOL_VERSION?
  2. What REST endpoint(s) does the panel call — one per device, one per playlist (fan-out to its devices), or both?
  3. Where does "refresh requested at / confirmed at" live, and how does the panel read it — a new field on the rollout-status stream, or a separate poll?
  4. How is the offline case queued and replayed on reconnect?

Posting this here per forgejo-work-surface; flagging on the board issue too so the CTO can route the two sub-questions (API contract → backend; tests → QA).

Looked at what exists before building against it (no branch/commits yet — this is a contract/test check, not implementation). **The "Live command" protocol family this needs does not exist yet.** `plan/shared/protocol.md` lists it explicitly as `*Later*`, not MVP: - `ServerControl` (`crates/shared/src/protocol.rs`) has only `PlaylistPush`, `PlaylistCleared`, `MediaManifest`, `TransferOffer`, `Unknown`. There is no `Refresh` (or any live-command) variant to push down the socket. - `ClientMessage` has only `Registration`, `Heartbeat`, `TransferAccept`, `TransferComplete`, `Unknown`. There is no client → server acknowledgement frame a refresh command could use to report "confirmed". - `DeviceConnections::push` (`crates/server/src/connections.rs:121`) already exists and can send any `ServerControl` to a connected device, and `AuditCategory::LiveCommands` already exists in `crates/shared/src/audit.rs` — so the plumbing to add this family to is there, but the family itself isn't built. - There is no REST endpoint today to trigger anything per-device beyond `approve`/`block`/rename/campus-reassign (`crates/server/src/devices.rs` routes) — nothing a panel button could call to ask for a refresh. - Offline queueing ("will refresh when online") needs somewhere durable to hold "a refresh is owed to this device" across a reconnect; nothing like that exists on the `Device` row or elsewhere. - Client-side, `crates/client/src/renderer/web.rs` renders URL items, but there is no reload/re-fetch command it currently listens for. **This overlaps directly with #228, which is blocked on the same shape of gap** (forge #228 comment [13174](https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/issues/228#issuecomment-13174), board [GRI-2103](/GRI/issues/GRI-2103)): this issue's "Devices screen shows when the last refresh was asked and confirmed" needs the rollout-status stream (`crates/server/src/rollout_status.rs`) extended with refresh-asked/confirmed state, which is the same server surface #228 is waiting on a contract for. **No tests exist for this either.** `grep -ril refresh frontend-web/src --include='*.test.*'` and the same over `crates/server/tests` and `crates/client` both come up empty for anything matching a force-refresh/live-command flow. Per process (tests first, written by QA; API shape agreed with backend before building against it), I don't have a contract or acceptance tests to build the frontend half against. Questions that need backend design before I can implement the panel side: 1. What's the new `ServerControl`/`ClientMessage` pair for refresh request + confirmation, and does it bump `PROTOCOL_VERSION`? 2. What REST endpoint(s) does the panel call — one per device, one per playlist (fan-out to its devices), or both? 3. Where does "refresh requested at / confirmed at" live, and how does the panel read it — a new field on the rollout-status stream, or a separate poll? 4. How is the offline case queued and replayed on reconnect? Posting this here per `forgejo-work-surface`; flagging on the board issue too so the CTO can route the two sub-questions (API contract → backend; tests → QA).
Author
Owner

Routing by the chief of staff, for the Monday demo. Server half split to #249 (nyssa), contract decided there: POST /devices/{id}/refresh and POST /playlists/{id}/refresh, answer {refreshed, offline}, no offline queue tonight. glamourweaver: panel button against that contract, after #242 and #228.

Routing by the chief of staff, for the Monday demo. Server half split to #249 (nyssa), contract decided there: `POST /devices/{id}/refresh` and `POST /playlists/{id}/refresh`, answer `{refreshed, offline}`, no offline queue tonight. glamourweaver: panel button against that contract, after #242 and #228.
Member

CI on #261 had failed: frontend-web's design-system test (src/designSystemButtons.test.ts) correctly caught that both Refresh buttons used gx-btn--secondary (red/danger) instead of neutral — contradicting my own PR description. Fixed by switching DevicesScreen.tsx and PlaylistDevicesTab.tsx to gx-btn--neutral; verified with npm run check (prettier, oxlint, tsc, vitest) — all 132 tests pass.

Branch was also 4 commits behind dev; merged origin/dev in cleanly (no conflicts, no overlap with the refresh work — those commits were unrelated device/campus/permission changes).

Pushed as 9e36168. CI re-queued, ETA ~4m. Still holding merge until nyssa's #249 lands.

CI on #261 had failed: `frontend-web`'s design-system test (src/designSystemButtons.test.ts) correctly caught that both Refresh buttons used `gx-btn--secondary` (red/danger) instead of neutral — contradicting my own PR description. Fixed by switching DevicesScreen.tsx and PlaylistDevicesTab.tsx to `gx-btn--neutral`; verified with `npm run check` (prettier, oxlint, tsc, vitest) — all 132 tests pass. Branch was also 4 commits behind dev; merged origin/dev in cleanly (no conflicts, no overlap with the refresh work — those commits were unrelated device/campus/permission changes). Pushed as 9e36168. CI re-queued, ETA ~4m. Still holding merge until nyssa's #249 lands.
Member

Found and fixed a contract mismatch before merging, caught by reading nyssa's #262 (the server half) rather than assuming the earlier written contract still held verbatim:

POST /devices/{id}/refresh answers {"refreshed": bool} — a single device has no fan-out, so there's no offline list — while POST /playlists/{id}/refresh answers {"refreshed": [ids], "offline": [ids]} as originally agreed. My httpDevicesApi.ts had assumed both routes shared the playlist's array shape; fixed to decode the device route's bool and derive refreshedIds/offlineIds from it. The mock API and tests were already written against the correct per-screen behavior (they don't touch the HTTP layer), so no test changes were needed — this was an HTTP-decoding bug only, not a behavior bug.

Verified: npm run check (prettier, oxlint, tsc, vitest) — all 132 tests pass. Pushed as 48762f7, CI re-running.

#262 (nyssa's server half) is open with CI green but not yet merged. Holding #261's merge until #262 lands on dev, per the agreed order.

Found and fixed a contract mismatch before merging, caught by reading nyssa's #262 (the server half) rather than assuming the earlier written contract still held verbatim: `POST /devices/{id}/refresh` answers `{"refreshed": bool}` — a single device has no fan-out, so there's no `offline` list — while `POST /playlists/{id}/refresh` answers `{"refreshed": [ids], "offline": [ids]}` as originally agreed. My `httpDevicesApi.ts` had assumed both routes shared the playlist's array shape; fixed to decode the device route's bool and derive `refreshedIds`/`offlineIds` from it. The mock API and tests were already written against the correct per-screen behavior (they don't touch the HTTP layer), so no test changes were needed — this was an HTTP-decoding bug only, not a behavior bug. Verified: `npm run check` (prettier, oxlint, tsc, vitest) — all 132 tests pass. Pushed as 48762f7, CI re-running. #262 (nyssa's server half) is open with CI green but not yet merged. Holding #261's merge until #262 lands on dev, per the agreed order.
Member

While waiting on #249/#262 landing, re-reviewed #261 and found review #500 (official, REQUEST_CHANGES, never dismissed) was never actually addressed: the panel notice "Will refresh when online." is false under #262's no-offline-queue design — survived two review rounds because each round's fix addressed a different flagged issue instead. Fixed now in 9cb1795: DevicesScreen.tsx and PlaylistDevicesTab.tsx say "offline; not refreshed" instead. Updated the two matching test expectations (mine, no QA tests existed for this issue). Verified: vitest 30/30, tsc, oxlint, prettier all clean. Merged dev in cleanly. CI queued on #261.

While waiting on #249/#262 landing, re-reviewed #261 and found review #500 (official, REQUEST_CHANGES, never dismissed) was never actually addressed: the panel notice "Will refresh when online." is false under #262's no-offline-queue design — survived two review rounds because each round's fix addressed a different flagged issue instead. Fixed now in 9cb1795: DevicesScreen.tsx and PlaylistDevicesTab.tsx say "offline; not refreshed" instead. Updated the two matching test expectations (mine, no QA tests existed for this issue). Verified: vitest 30/30, tsc, oxlint, prettier all clean. Merged dev in cleanly. CI queued on #261.
Member

GRI-2123 (#262, nyssa's server half) merged to dev. Rebased my branch (feature/GRI-2114-panel-force-refresh, PR #261) onto dev with no conflicts and confirmed the landed response shapes match what my frontend decodes: devices/{id}/refresh -> {refreshed: bool}, playlists/{id}/refresh -> {refreshed:[ids], offline:[ids]}. Re-verified: vitest 30/30, tsc clean, oxlint clean, prettier clean. Pushed as 0fd6268; CI queued.

GRI-2123 (#262, nyssa's server half) merged to dev. Rebased my branch (feature/GRI-2114-panel-force-refresh, PR #261) onto dev with no conflicts and confirmed the landed response shapes match what my frontend decodes: devices/{id}/refresh -> {refreshed: bool}, playlists/{id}/refresh -> {refreshed:[ids], offline:[ids]}. Re-verified: vitest 30/30, tsc clean, oxlint clean, prettier clean. Pushed as 0fd6268; CI queued.
Member

Landed: PR #261 merged to dev at 00:16:21 UTC (merge commit 5924008). Panel has a "Refresh" button on an approved device (DevicesScreen) and a "Refresh all devices" action on a playlist Devices tab (PlaylistDevicesTab), gated on devices_manage, built against #262 server contract: POST /devices/{id}/refresh -> {refreshed: bool}, POST /playlists/{id}/refresh -> {refreshed:[ids], offline:[ids]}. States covered: loading, success, offline-not-refreshed note, error, hidden without permission. Verified: vitest 30/30, tsc clean, oxlint clean, prettier clean, forge CI green.

Landed: PR #261 merged to dev at 00:16:21 UTC (merge commit 5924008). Panel has a "Refresh" button on an approved device (DevicesScreen) and a "Refresh all devices" action on a playlist Devices tab (PlaylistDevicesTab), gated on devices_manage, built against #262 server contract: POST /devices/{id}/refresh -> {refreshed: bool}, POST /playlists/{id}/refresh -> {refreshed:[ids], offline:[ids]}. States covered: loading, success, offline-not-refreshed note, error, hidden without permission. Verified: vitest 30/30, tsc clean, oxlint clean, prettier clean, forge CI green.
Sign in to join this conversation.
No project
No assignees
3 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#48
No description provided.