feat(edit): fail-closed validation before Edit PDF publish (#34) - #54
Merged
McanKul merged 4 commits intoAug 26, 2026
Merged
Conversation
nonamexishere
force-pushed
the
feat/34-validate-edit-output
branch
from
August 24, 2026 13:49
660d77d to
ae51a6e
Compare
This was referenced Aug 24, 2026
McanKul
requested changes
Aug 25, 2026
McanKul
left a comment
Owner
There was a problem hiding this comment.
Thanks for taking this on — the fail-closed staging flow is a solid base. A few things still need tightening before we can merge:
- Page order is currently inferred from geometry only. Two same-sized pages can be swapped while still passing; please validate page identity/order with a bounded content, text, or render-based check.
- Please add the issue’s integration coverage for real overlay exports preserving annotations/forms/catalog data, including rotated and cropped fixtures.
ValidationResult.warningsis discarded by the caller, so qpdf exit-3 warnings are not actually recorded or surfaced.- The branch now conflicts with
development; please rebase after the recent HEIC merge.
Once these are addressed, we can take another quick pass.
4 tasks
Validate staged Edit PDF output before the destination rename so a truncated or structurally wrong file cannot replace the user's dest. qpdf --check errors are fatal; warnings are recorded and do not block. Fixes McanKul#34.
Re-check cancel after qpdf --check and before publish so a mid-gate Cancel returns CANCELLED, deletes staging, and does not replace dest. Production --check registers on the job handle like overlay qpdf.
…ings Page identity now uses a per-page Contents digest so two same-geometry pages cannot be swapped past the publish gate. qpdf --check exit 3 still publishes; the warning text is kept on the completed job update.
nonamexishere
force-pushed
the
feat/34-validate-edit-output
branch
from
August 26, 2026 13:01
f241a20 to
25e1445
Compare
Contributor
Author
|
Thanks for the review — all four items should be addressed on
CI on this head is green (frontend + Rust). Ready for another pass when you have time. |
This was referenced Aug 26, 2026
McanKul
approved these changes
Aug 26, 2026
McanKul
left a comment
Owner
There was a problem hiding this comment.
Thanks for addressing the review. I verified the updated implementation locally: frontend tests/typecheck, all Rust tests, and an extra real-qpdf multi-stream page case passed. The page identity check, integration coverage, warning propagation, and rebase now look good.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a fail-closed publish gate for Edit PDF (#34). After qpdf writes the dest-sibling temp file, and before the atomic rename onto the chosen destination, OffPDF now:
qpdf --check(exit 2 = fatal, exit 3 = warning recorded and does not block, exit 0 = clean)/Rotate,/UserUnitA failed gate returns
INVALID_OUTPUT, deletes the staging file, and leaves the original and any existing destination untouched. The gate isvalidate_staged_pdfso later annotation / form / redaction work can reuse it.Packaged Save uses the same bundled qpdf binary as overlay (
resolve_qpdf(app)).Why
Epic #12’s definition of done calls for output validation before any existing-content mutation ships. Today a damaged overlay result could still replace the destination.
Validation
npm run typechecknpm test(179)cargo check --manifest-path src-tauri/Cargo.tomlcargo test --manifest-path src-tauri/Cargo.toml --lib(109)Privacy Checklist