Media: wire PDF upload to the page converter (signage #15b) #104

Closed
opened 2026-11-10 04:42:07 +00:00 by forgemother · 3 comments
Member

What

POST /api/v1/media refuses any application/pdf upload with
unsupported_media_type — crates/server/src/media/handlers.rs::pdf_not_yet_supported,
called from upload_media whenever classify() returns "document". The
page-image converter itself landed on GRI-1868 (crates/server/src/pdf.rs,
this repo's closed issue #15), but nothing in the upload path calls it yet.
handlers.rs's own comment names this gap as "signage #15b", which was never
filed.

plan/server/rest-api.md's own "Media" table already documents the finished
behaviour ("A PDF is paged into one document_page entry per page at upload
time") — the plan is ahead of the code here, not wrong.

Why it matters now

#28's deployment note names "web page URL and PDF" as the two must-have
content types a campus needs on day one. The URL path (POST /media/url)
works end-to-end today; PDF does not — a real upload is refused with a 400
before it ever reaches pdf.rs. The note can show the product owner how to
put a web page on a screen and cannot show the same for a PDF, which is half
of its "done when": the note usable alone.

Done when

A PDF uploaded through POST /api/v1/media is split into page images via
pdf.rs, one media row per page with pdf_pages set on the original (the
shape handlers.rs's comment and rest-api.md already describe), and a
document_page playlist item can reference a page.

Depends on

Nothing new — pdf.rs (issue #15, closed) already does the conversion; this
is purely the wiring between upload_media and that converter.

Blocks

#28 (deployment note: one server behind a reverse proxy, many campuses) —
the note cannot document a must-have content type the server refuses.

## What `POST /api/v1/media` refuses any `application/pdf` upload with `unsupported_media_type` — `crates/server/src/media/handlers.rs::pdf_not_yet_supported`, called from `upload_media` whenever `classify()` returns `"document"`. The page-image converter itself landed on GRI-1868 (`crates/server/src/pdf.rs`, this repo's closed issue #15), but nothing in the upload path calls it yet. `handlers.rs`'s own comment names this gap as "signage #15b", which was never filed. `plan/server/rest-api.md`'s own "Media" table already documents the finished behaviour ("A PDF is paged into one `document_page` entry per page at upload time") — the plan is ahead of the code here, not wrong. ## Why it matters now #28's deployment note names "web page URL and PDF" as the two must-have content types a campus needs on day one. The URL path (`POST /media/url`) works end-to-end today; PDF does not — a real upload is refused with a 400 before it ever reaches `pdf.rs`. The note can show the product owner how to put a web page on a screen and cannot show the same for a PDF, which is half of its "done when": the note usable alone. ## Done when A PDF uploaded through `POST /api/v1/media` is split into page images via `pdf.rs`, one `media` row per page with `pdf_pages` set on the original (the shape `handlers.rs`'s comment and `rest-api.md` already describe), and a `document_page` playlist item can reference a page. ## Depends on Nothing new — `pdf.rs` (issue #15, closed) already does the conversion; this is purely the wiring between `upload_media` and that converter. ## Blocks #28 (deployment note: one server behind a reverse proxy, many campuses) — the note cannot document a must-have content type the server refuses.
Member

PR #106 opened: #106

upload_media now wires PDFs to pdf.rs (signage #15a): one media row per page (kind = "document_page"), the original gets pdf_pages set, migration 0003 widens media_kind_check to allow it. A PDF the converter can't parse leaves no catalog entry (AC-3-06, still green).

Replaced media_integration.rs's a_pdf_upload_is_refused_until_the_converter_is_wired_in (written alongside the stub on GRI-1874) with an_unparseable_pdf_upload_is_refused — the old assertion (every PDF refused with unsupported_media_type) is precisely what this issue removes. Did not touch any Test Writer-owned acceptance test.

Added poppler-utils to packaging/server/Dockerfile: without it the deployed server has no pdftoppm and would refuse every PDF with ToolMissing — the same failure mode this issue exists to fix.

Known gap, flagged separately, not blocking this PR: ac_3_03 (real multi-page split) stays #[ignore]d. This build host has no poppler-utils/pdftoppm installed (no sudo to add it), the same reason pdf.rs's own real-conversion test is still ignored. I can't verify or un-ignore that path here; the CTO/System Administrator should confirm poppler-utils is on the build host and the CI runner before anyone un-ignores it.

Local gates (--rust-only and --frontend-only) both green against a real Postgres. CI is running on the PR now.

PR #106 opened: https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/pulls/106 `upload_media` now wires PDFs to `pdf.rs` (signage #15a): one `media` row per page (`kind = "document_page"`), the original gets `pdf_pages` set, migration `0003` widens `media_kind_check` to allow it. A PDF the converter can't parse leaves no catalog entry (AC-3-06, still green). Replaced `media_integration.rs`'s `a_pdf_upload_is_refused_until_the_converter_is_wired_in` (written alongside the stub on GRI-1874) with `an_unparseable_pdf_upload_is_refused` — the old assertion (every PDF refused with `unsupported_media_type`) is precisely what this issue removes. Did not touch any Test Writer-owned acceptance test. Added `poppler-utils` to `packaging/server/Dockerfile`: without it the deployed server has no `pdftoppm` and would refuse every PDF with `ToolMissing` — the same failure mode this issue exists to fix. **Known gap, flagged separately, not blocking this PR:** `ac_3_03` (real multi-page split) stays `#[ignore]`d. This build host has no poppler-utils/pdftoppm installed (no sudo to add it), the same reason `pdf.rs`'s own real-conversion test is still ignored. I can't verify or un-ignore that path here; the CTO/System Administrator should confirm poppler-utils is on the build host and the CI runner before anyone un-ignores it. Local gates (`--rust-only` and `--frontend-only`) both green against a real Postgres. CI is running on the PR now.
Member

PR #106: CI mostly green (clippy, cargo deny, fmt, cargo test, frontend-web, repo boundary, pre-push hook all passed). The only red is CI / cargo deny advisories, which is GRI-1872 — a pre-existing failure on dev itself (gtk-renderer feature: proc-macro-error, paste, glib unsoundness), unrelated to this PR's dependency tree. CI / CI (the required aggregate) is still pending, waiting on the runner queue. Will report the final verdict once it resolves.

PR #106: CI mostly green (clippy, cargo deny, fmt, cargo test, frontend-web, repo boundary, pre-push hook all passed). The only red is `CI / cargo deny advisories`, which is GRI-1872 — a pre-existing failure on `dev` itself (gtk-renderer feature: proc-macro-error, paste, glib unsoundness), unrelated to this PR's dependency tree. `CI / CI` (the required aggregate) is still pending, waiting on the runner queue. Will report the final verdict once it resolves.
Member

PR #106 merged into dev by Vivy at 2026-11-10T05:37:57Z (commit 9141699). Verified: dev now fast-forwards to 5daa329 and 9141699 is an ancestor. Closing — done when met: PDFs upload through pdf.rs, one media row per page with pdf_pages set on the original, document_page playlist items can reference a page. Known gap carried forward separately: ac_3_03 (real multi-page split) stays #[ignore]d pending poppler-utils on the build host/CI runner — not blocking this issue.

PR #106 merged into dev by Vivy at 2026-11-10T05:37:57Z (commit 9141699). Verified: dev now fast-forwards to 5daa329 and 9141699 is an ancestor. Closing — done when met: PDFs upload through pdf.rs, one media row per page with pdf_pages set on the original, document_page playlist items can reference a page. Known gap carried forward separately: ac_3_03 (real multi-page split) stays #[ignore]d pending poppler-utils on the build host/CI runner — not blocking this issue.
nyssa closed this issue 2026-11-10 05:53:43 +00:00
Sign in to join this conversation.
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#104
No description provided.