GRI-1877: wire PDF upload to the page converter (signage #15b) #106
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!106
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-1877-pdf-upload-wiring"
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?
What
Wires
POST /api/v1/media's PDF path to the page converter (crates/server/src/pdf.rs, GRI-1868 / signage #15a), closing signage #15b.handlers::convert_pdf_uploadreplaces thepdf_not_yet_supportedstub: it renders the PDF to a scratch directory, and only once every page has rendered does it write the original into the media directory and insert itsmediarow (kind = "document",pdf_pagesset to the page count), then one moremediarow per page (kind = "document_page"). A PDF the converter cannot parse leaves no catalog entry at all (AC-3-06).media_kind_check(migration0003_document_page_media_kind.sql) is widened to allowdocument_page, matching whatGET /mediaand adocument_pageplaylist item (playlist_items.kind, already in the schema) both expect.packaging/server/Dockerfileinstallspoppler-utils, whichpdf.rsshells out to (pdftoppm) — without it the deployed server would refuse every PDF withPdfError::ToolMissing, the same failure this issue exists to remove.media_integration.rs'sa_pdf_upload_is_refused_until_the_converter_is_wired_in(added alongside the stub on GRI-1874) is replaced byan_unparseable_pdf_upload_is_refused, since its assertion — that every PDF is refused withunsupported_media_type— is exactly the behaviour this issue removes. The new test keeps the same coverage (a PDF the converter can't parse still gets a clean 4xx) under the new error code (invalid_pdf).Known gap:
ac_3_03stays#[ignore]dmedia_acceptance_integration.rs::ac_3_03_uploading_a_multi_page_pdf_creates_one_document_page_item_per_pageneeds a workingpdftoppmto actually split a real PDF. This build host has nopoppler-utilsinstalled (confirmed:pdftoppmnot onPATH, no sudo to install it), so I can't verify the real-conversion path end to end here, and I did not touch that test — it isn't mine to un-ignore blind.pdf.rs's ownrenders_a_real_two_page_pdf_with_default_optionsis#[ignore]d for the identical reason and was left that way when GRI-1868 landed.Everything that doesn't need a real
pdftoppmpasses:cargo test -p server(all gates viascripts/local-gates.sh), includingac_3_06(corrupt PDF → clean 4xx, no items) and the fullpdf.rsunit suite against a fake converter script.Flagging to the CTO/System Administrator separately: the build host and (likely) the CI runner need
poppler-utils, the same package I added to the runtime image, beforeac_3_03can be un-ignored for real.How verified