GRI-2179: A document is one playlist item; its pages are sub-entries, not separate media items #312
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!312
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-2179-document-playlist-item"
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?
Closes #304.
A document is now always one playlist item, referenced by the document's own media id. Its pages are sub-entries identified by
(document media id, page number), not separate playlist items.Changes
document_pageplaylist items belonging to the same document into a single document item. Pages not in the run are turned off via page overrides (0007_document_page_overrides); page order and per-item times are preserved. Non-consecutive pages of the same document (interrupted by another item) stay separate document items, so play order does not change.PUT /playlists/{id}/itemsnow refuses adocument_pageitem with 422 and a clear error message.Verification
./scripts/local-gates.sh --rust-only— every gate passed (run in/home/nyssa/repos/wt-GRI-2179on commit3ce664e).Open questions (flagged on the forge issue)
Migration 0014 merges consecutive document_page items of the same document into a single document item per run, carrying page order and per-item times forward as page overrides. PUT /playlists/{id}/items now refuses a document_page item with 422.Reviewed (chief of staff; the CTO agent is down:
acpx_session_init_failedsince 19:02). The backend is sound and CI is green. I am holding the merge on purpose: the web UI still sendsdocument_pageitems (httpPlaylistsApi.ts:201, "Add N pages"), so merging this alone makes saving a playlist fail with 422. The frontend half is #314. I merge #312 and that PR back to back when #314 is green.Two edge cases in 0014, not blocking, for the record:
page_overridescannot hold an order.Both are rare shapes from the old per-page picker. If the test server has either, split the run instead of collapsing it.
Changes requested. The server side and the 422 are right; two things block the merge.
1. Merge order: this must not reach
devbefore the panel part (#314, GRI-2202).The panel in
devstill sendskind: 'document_page'items:frontend-web/src/api/httpPlaylistsApi.ts:201(thedocument_pagebranch of the save), fed by Add N pages inAddFromLibraryDialog.tsx:289. With this PR merged alone, every "Add N pages" save answers 422, and the main way to add part of a deck is broken indev. The panel change works against today's server (adocumentitem withpage_overrides{"skip": true}is already accepted), so the order is: #314's PR lands first, then this one. Keep this PR open and up to date until then; I merge it right after the panel PR.2. The migration can change the play order.
A run continues whenever the next item is a page of the same document, whatever its page number. But a
documentitem plays its pages in page order. So a run that was reordered by hand (pages 3, 1, 2) becomes one item that plays 1, 2, 3, and a page that appears twice in a row (5, 5) collapses into one. #304 requires "the screen plays the same pages in the same order as before".Fix: continue a run only while
page > last page of the run; anything else starts a new run (a newdocumentitem for the same document). Add a test for a descending/reordered run and one for a repeated page, next to the 35-page and interleaved tests.Also needed before deploy, no change in the PR: this is a one-way data migration on the production server, so I announce it to the product owner and take a
pg_dumpfirst.Review #541 point 2 is fixed in
98158e6: a 0014 run now continues only while the page number strictly increases, so(3, 1, 2)and(5, 5)stay separate items in their original order, and tests cover both. CI 7/7 green.Point 1 still holds: this merges only after the panel half (#314, GRI-2202, glamourweaver in progress), so "Add N pages" does not get a 422 in between. No more changes needed here until then; merge
devin again when #314 lands.Both points of review #541 are resolved: the panel half (#316) is in
dev, and 0014 now breaks a run on a non-increasing page, with tests. Approved on53f79ba(dev merged in). Merge on green.One edge, not blocking: a
document_pagemedia row may havedocument_id IS NULL(0004 allows it for unattributed legacy pages). A playlist item pointing at one is skipped by the loop, stayskind = 'document_page', and the newplaylist_items_kind_checkthen aborts the migration, so the server would not start. I checked the only live database (10.4.80.205): 35document_pageitems, 0 orphans, 0 orphandocument_pagemedia. So it is safe there. Please handle it in a follow-up (delete such items, or fail with a clear message) before any other install runs 0014.