Skip to content

Fixes from live-testing the Rust steps: form fields in Compare, worker error handling, no worker on mobile - #1016

Open
DutchSailor wants to merge 4 commits into
mainfrom
fix/rust1-livetest
Open

DutchSailor wants to merge 4 commits into
mainfrom
fix/rust1-livetest

Conversation

@DutchSailor

Copy link
Copy Markdown
Collaborator

Three fixes found while live-testing the Rust steps of #1014 on a release build, with real drawings, form fields, the real UI and the fallback paths.

What changes

  • Compare draws form fields in the worker tiles like pdf.js does. PDFium paints widgets only in its form pass, which the matrix render skipped, so the worker missed changed field values that the overlay showed. Now the worker reports them (10 regions against 9 in JavaScript on a test pair with changed fields; one text value comes in two pieces). Pairs without fields are unchanged.
  • A worker that reports a render error itself stays alive. An ok:false answer (for example PDF_OUTPUT_LIMIT on an A0 page at high zoom) was treated as a crash: the pool killed and restarted the worker, retried cold on a second worker, and marked workers permanently dead after three times, so queued snap requests fell back to the slow JavaScript path. This behaviour predates Rust steps 1: monochrome recompression, Compare pixels and snap geometry in Rust #1014. Live on a heavy sheet: before, 8 restarts and 2 workers permanently dead in three runs; after, 0 restarts.
  • The Compare worker path stays off on Android and iOS, which have no PDFium worker; before, every pair made one failing IPC call there.

Verification

  • cargo test -p pdfium-worker: 65 pass (two new worker tests for form fields)
  • New Rust tests for the worker-pool error handling compile (--no-run; the app's lib test executable does not start on this machine)
  • node --test js/compare/rust-compare.test.mjs: 5 pass
  • Live on a release build: Compare with form-field pairs, the heavy-sheet restart case, and the old-worker fallback

Not verified

  • Android and iOS on a device (no SDK or emulator on the test machine); macOS and Linux.

🤖 Generated with Claude Code

The mobile apps run in Tauri but have no PDFium worker. The worker path
only checked for Tauri, so every page pair on Android made a
compare_pixel_pair call that failed with "worker pool not ready" before
the JS pipeline ran. Pass isMobile() to createRustCompare so the path is
off there, like the PDFium render path (heeftRustRenderer).
A render or region answer with ok:false (for example PDF_OUTPUT_LIMIT on
a large sheet at a high zoom) means the exchange went fine and the worker
is healthy. The pool still treated it as a crash: it killed and respawned
the worker, retried the render cold on a second worker (which failed the
same way and was restarted too) and after three such answers in 30 s
marked the worker DeadPermanent. Requests queued on that worker, such as
snap geometry, failed with PDF_WORKER_UNAVAILABLE and fell back to JS.

Type these answers as WorkerReported: no restart and no retry on another
worker. Broken exchanges (EOF, timeout, garbage) still restart the worker.
pdf.js draws form field appearances with intent 'display', so a changed
field value is a change in the JS pipeline. PDFium draws fields only in
the form pass (FPDF_FFLDraw), which the matrix render used for compare
tiles skips. On desktop a changed value in a title block was therefore
not reported, while the overlay showed the new value and the web version
reported it.

On a page with widget annotations a tile is now rendered as the whole
page at scale with a shifted origin, with annotations and form data.
Pages without fields keep the matrix route.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant