GRI-1887: wire the panel's five API modules to the real server #118
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!118
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-1887-panel-live-api"
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
Flips
USE_MOCKoff in all five panel API modules (session, devices, IPrules, media, playlists). The
http*Api.tsimplementations were writtenagainst a draft plan doc before the real server routes existed, and didn't
match what's actually merged — this adjusts them to the real, snake_case
wire contract instead:
devicesApi:DevicedropslastSeenAt/assignedPlaylist(the server'sDeviceViewexposes neither);hostname/ipAddressare now top-level,matching the server.
ipRulesApi:auto_approve→autoApprove,target_group→targetGroupboth ways (the existing code senttargetGroupon write,which the server silently ignored).
mediaApi: PDF page numbers are derived from a single upload response'srow order (document row first, then one
document_pagerow per page, inrender order) — the only place that order is ever available, since the
server stores no page index.
playlistsApi: a playlist item carries onlymedia_idon the wire, nohuman name and no
kind— both are resolved against the already-loadedmedia library when converting to/from the wire shape.
sessionApi:GET /setup/statusreturnsneeds_setup, inverted from thepanel's
firstUserExists— fixed. Login and first-user setup are notfully wired; see "Not done" below.
USE_MOCKno longer a hardcoded boolean in each module:import.meta.env.MODE === 'test'picks the mock, sovitestkeeps exercising the mock (and theQA suite is unedited) while every other build talks to the server.
Also removes the stale "not wired yet" section of
plan/operations/deployment.md(PR #103merged this already).Verified by hand
Against a real
serverbuild + a disposable Postgres on this build host,through the actual HTTP routes each
http*Api.tsmodule calls (curl,matching each module's exact request/response shapes — I don't have a
browser tool in this environment; see "Not done" for what that means for
devices/media/playlists/IP rules too):
target_group), list, remove both. Full round-trip, matches the adapter.token; see
plan/operations/deployment.md's own "shown once" note — notsurfaced in the panel yet, same as before), rename, list by status.
Added a URL item. PDF upload does not work — see "Not done".
kindresolvedfrom the media library, matching
ItemInput's validation), saved,assigned to an approved device, confirmed
GET /devices/{id}is the onedeleting a still-assigned playlist is refused against (409
device_assigned).npm run check(prettier, oxlint, tsc, vitest) is green, unedited tests.scripts/local-gates.sh --frontend-onlyis green.Not done — two real server-side blockers found while verifying by hand
1. First-user setup and login don't work against the real server, and
I did not change the panel's Login/Setup screens to fix it. The server's
/setupand/sessionroutes requireemail+name(POST /setup) oremail(POST /session) — theuserstable has nousernamecolumn atall. The panel's
SetupScreen/LoginScreen(andApp.test.tsx, the QAsuite) model a username-only account, matching
plan/server/rest-api.md'sown line — "Logs in: username and password in" — which the server never
implemented. I can't resolve this myself: changing the login UI to collect
email+name would break
App.test.tsx, which I won't edit, and I don't owncrates/server. This needs a decision — either the server acceptsusername(matching its own doc and the existing UI/test), or the UIchanges to email+name and the QA engineer updates the test. Flagging to
the back-end engineer and the QA engineer.
2. PDF upload fails server-side, every time.
crates/server/src/media/handlers.rs::convert_pdf_uploadremoves itsrender directory (
tokio::fs::remove_dir_all(&render_dir)) right afterrender_pagesreturns, then tries to read each rendered page's bytes outof that now-deleted directory in the loop below — every upload 500s with
"reading a converted page: No such file or directory" after rendering
succeeds. Reproduced by hand with a real two-page PDF (poppler-utils
wasn't on this host either; downloaded and extracted the
.deblocallyto get
pdftoppm, confirmed it renders the test PDF fine standalone, thenhit the same crash through the server). The
documentcatalog row isinserted before the crash, so a failed upload also leaves an orphaned
documentrow withpdf_pagesset but no actual page rows or files. Thisblocks the issue's "upload image/video/PDF" criterion for the PDF case;
image and video upload both work. Flagging to the back-end engineer —
crates/serverisn't mine to fix.Test plan
npm run checkinfrontend-web/scripts/local-gates.sh --frontend-onlyhand against a running
server+ Postgres, via the exact routeseach
http*Api.tsmodule callsmismatch (see above)
verification of the same requests/responses the screens make, not a
click-through of the screens themselves