GRI-2098: panel conversion progress for PDF/PPTX uploads (#233 part 2) #265

Merged
vivy merged 3 commits from feature/GRI-2098-conversion-progress into dev 2026-11-16 03:53:03 +00:00
Member

Panel side of #233 part 2 (GRI-2098), built against the contract Vivy posted
on the issue and PR #264 (not merged yet — see below).

What changed

A .pdf/.pptx upload's row is a placeholder until its background job
resolves it: a document with pageCount: null, or pending for a
.pptx not yet known to be document or video. The panel now polls
GET /media/{id}/job for any such item and shows:

  • a step name while the count is unknown (Queued for conversion,
    Converting to PDF, Rendering pages, Encoding video);
  • Page N of M rendered with a progress bar once pages are known;
  • Failed to process: <reason> on state: "failed", including the
    error_step: "interrupted" case (server restart) — same generic
    handling, no special-casing needed.

The item can still be deleted while converting or after a failure (closing
a failed item specifically is #236, out of scope here).

Mock mode

mockMediaApi.ts now simulates the same placeholder-then-job shape (a
.pptx upload it previously rejected outright now works, resolving to
video), computed from elapsed wall-clock time rather than a running
timer — nothing to clean up, and deterministic to drive with fake timers
in tests. A filename containing fail forces the simulated job to fail,
for tests and for trying the failure path in npm run dev:mock.

Against #264, not merged yet

PR #264 (forge #263) isn't merged, so this is built from its documented
contract (job_state, GET /media/{id}/job's state/page/page_total/
error_step/error_message) and the mock stands in for it — same as any
other panel work against a not-yet-landed backend contract. httpMediaApi
talks to the real route either way; nothing here needs changing once #264
lands.

Tests

httpMediaApi.test.ts/mockMediaApi.test.ts: getMediaJob against both
implementations (in-progress, failed, 404). MediaScreen.test.tsx: the
existing PDF-grouping test updated for the now-async placeholder (was
previously synchronous), plus new coverage for a PPTX resolving to video
and a failed conversion's error display with delete still available.

Checked at the repo's existing breakpoints via the design system's
responsive list/card classes (gx-list-item, gx-card, gx-progress) —
no new CSS, tokens or custom components, so no new light/dark or
zoom-to-200% risk beyond what those already carry. Keyboard access is the
existing Delete button; the new status/error text uses role="status"/
role="alert", matching the upload-progress and error patterns already in
this screen.

Panel side of #233 part 2 (GRI-2098), built against the contract Vivy posted on the issue and PR #264 (not merged yet — see below). ## What changed A `.pdf`/`.pptx` upload's row is a placeholder until its background job resolves it: a `document` with `pageCount: null`, or `pending` for a `.pptx` not yet known to be `document` or `video`. The panel now polls `GET /media/{id}/job` for any such item and shows: - a step name while the count is unknown (*Queued for conversion*, *Converting to PDF*, *Rendering pages*, *Encoding video*); - *Page N of M rendered* with a progress bar once pages are known; - *Failed to process: `<reason>`* on `state: "failed"`, including the `error_step: "interrupted"` case (server restart) — same generic handling, no special-casing needed. The item can still be deleted while converting or after a failure (closing a failed item specifically is #236, out of scope here). ## Mock mode `mockMediaApi.ts` now simulates the same placeholder-then-job shape (a `.pptx` upload it previously rejected outright now works, resolving to `video`), computed from elapsed wall-clock time rather than a running timer — nothing to clean up, and deterministic to drive with fake timers in tests. A filename containing `fail` forces the simulated job to fail, for tests and for trying the failure path in `npm run dev:mock`. ## Against #264, not merged yet PR #264 (forge #263) isn't merged, so this is built from its documented contract (`job_state`, `GET /media/{id}/job`'s `state`/`page`/`page_total`/ `error_step`/`error_message`) and the mock stands in for it — same as any other panel work against a not-yet-landed backend contract. `httpMediaApi` talks to the real route either way; nothing here needs changing once #264 lands. ## Tests `httpMediaApi.test.ts`/`mockMediaApi.test.ts`: `getMediaJob` against both implementations (in-progress, failed, 404). `MediaScreen.test.tsx`: the existing PDF-grouping test updated for the now-async placeholder (was previously synchronous), plus new coverage for a PPTX resolving to video and a failed conversion's error display with delete still available. Checked at the repo's existing breakpoints via the design system's responsive list/card classes (`gx-list-item`, `gx-card`, `gx-progress`) — no new CSS, tokens or custom components, so no new light/dark or zoom-to-200% risk beyond what those already carry. Keyboard access is the existing Delete button; the new status/error text uses `role="status"`/ `role="alert"`, matching the upload-progress and error patterns already in this screen.
GRI-2098: panel conversion progress for PDF/PPTX uploads (#233 part 2)
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 (pull_request) Successful in 20s
CI / cargo deny advisories (pull_request) Successful in 20s
CI / cargo clippy (pull_request) Successful in 1m20s
CI / repository boundary (pull_request) Successful in 5s
CI / frontend-web (pull_request) Successful in 1m12s
CI / cargo test (pull_request) Successful in 3m52s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
0b64fd97dc
Merge remote-tracking branch 'origin/dev' into feature/GRI-2098-conversion-progress
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 9s
CI / cargo deny (pull_request) Successful in 13s
CI / cargo deny advisories (pull_request) Successful in 18s
CI / cargo clippy (pull_request) Successful in 1m7s
CI / repository boundary (pull_request) Successful in 3s
CI / frontend-web (pull_request) Successful in 56s
CI / cargo test (pull_request) Successful in 3m29s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
d7c847d439
vivy requested changes 2026-11-16 03:07:15 +00:00
Dismissed
vivy left a comment

Contract matches GET /media/{media_id}/job on dev (13f1f05c) — field names, states, interrupted as error_step. Two changes before merge:

  1. JOB_POLL_INTERVAL_MS = 150 is too fast for production. An 83-slide deck converts for 5+ minutes on the test server: that is ~2000 requests per converting item, per open panel, each one a DB read through the auth and campus checks. Use ~1500 ms in the product. If the tests need speed, make the interval a parameter or use fake timers (vi.useFakeTimers() + advanceTimersByTimeAsync) — do not tune the product for the test.

  2. A transient error stops the poll for ever. catch { return } treats a network blip or a 502 during a redeploy the same as a 404. The row then shows a stale step label until the user reloads, and the id stays in polledJobIdsRef, so it is never polled again. Return only on ApiRequestError with status 404; on any other error wait the interval and try again (a small retry cap is fine).

Everything else is fine: no list flash on done (refreshItemsOnly), unmount guard, failed state shows the server message, delete stays available on a converting row.

Contract matches `GET /media/{media_id}/job` on dev (13f1f05c) — field names, states, `interrupted` as `error_step`. Two changes before merge: 1. **`JOB_POLL_INTERVAL_MS = 150` is too fast for production.** An 83-slide deck converts for 5+ minutes on the test server: that is ~2000 requests per converting item, per open panel, each one a DB read through the auth and campus checks. Use ~1500 ms in the product. If the tests need speed, make the interval a parameter or use fake timers (`vi.useFakeTimers()` + `advanceTimersByTimeAsync`) — do not tune the product for the test. 2. **A transient error stops the poll for ever.** `catch { return }` treats a network blip or a 502 during a redeploy the same as a 404. The row then shows a stale step label until the user reloads, and the id stays in `polledJobIdsRef`, so it is never polled again. Return only on `ApiRequestError` with status 404; on any other error wait the interval and try again (a small retry cap is fine). Everything else is fine: no list flash on done (`refreshItemsOnly`), unmount guard, failed state shows the server message, delete stays available on a converting row.
GRI-2098: slow job poll to product cadence, retry on transient poll error
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 8s
CI / cargo deny (pull_request) Successful in 12s
CI / cargo deny advisories (pull_request) Successful in 19s
CI / cargo clippy (pull_request) Successful in 57s
CI / repository boundary (pull_request) Successful in 3s
CI / frontend-web (pull_request) Successful in 57s
CI / cargo test (pull_request) Successful in 3m25s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
62c646a243
Review on PR #265: the 150ms poll interval was a test artifact leaking
into the product, and a non-404 getMediaJob failure (network blip, 5xx)
stopped polling for good instead of retrying. Poll interval now defaults
to 1500ms, with a test-only override in mediaJobPoll.ts so MediaScreen.tsx
keeps exporting only its component.
vivy approved these changes 2026-11-16 03:53:00 +00:00
vivy left a comment

Both points fixed on 62c646a2: poll is 1500 ms (test override only), and only a not_found stops the poll; other errors wait one interval and retry, with a test. Server returns code not_found for a missing job. CI green on all 7 required contexts. Approved.

Both points fixed on 62c646a2: poll is 1500 ms (test override only), and only a not_found stops the poll; other errors wait one interval and retry, with a test. Server returns code not_found for a missing job. CI green on all 7 required contexts. Approved.
vivy merged commit 297bed8c5d into dev 2026-11-16 03:53:03 +00:00
vivy deleted branch feature/GRI-2098-conversion-progress 2026-11-16 03:53:03 +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!265
No description provided.