Repository navigation
fix(paper-writing): harden PDF review and LaTeX main-file selection - #3887
Merged
Merged
Conversation
Open encrypted PDFs with ignoreEncryption and keep their notes in the review sidecar. pdf-lib cannot encrypt the objects it adds and keeps /Encrypt when saving, so Save PDF and Export are disabled for these files instead of producing unreadable annotations. PDFs that pdf-lib cannot parse get the same notice rather than a save-failure alert. A FILE_CONFLICT refusal, or a lost write whose reconciliation finds another version, now pauses review writes and keeps the local notes until the user replaces that exact host version or loads it; Undo restores the local notes. Retry previously repeated the same failing write. Saves no longer stamp the current PDF fingerprint over the build the notes were placed on, so adding a note after a recompile no longer hides the position warning. The warning stays until the user confirms the current layout. Save All skips review sessions without unsaved changes, so a session for an abandoned or unreadable path cannot block saving the source.
The main-file field changed the build target and review owner on every keystroke: each prefix remounted the PDF review pane with a new review session, and auto compile built partial paths. Keep a draft until Enter or blur; Escape restores the applied value.
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
Follow-up to #3870. Fixes four problems in the Paper Writing PDF review flow:
Type and Areas
Motivation / Impact
Encrypted PDFs. Workspace PDFs open through
PdfReviewEditor, which parsed them withPDFDocument.loadand noignoreEncryption. Owner-password PDFs, common for publisher downloads, failed there although pdf.js renders them. They now open normally and keep notes in the review sidecar. Save PDF and Export annotated PDF are disabled with an explanation: pdf-lib cannot encrypt the objects it adds and keeps/Encrypton save, so readers would decrypt the new annotation strings into garbage. PDFs that pdf-lib cannot parse get the same notice instead of a save-failure alert.Review file conflicts. After
<source>.openbitfun-review.jsonchanged on the workspace host, every autosave failed and Retry repeated the same compare-and-swap, so the tab stayed dirty until it was closed and its unsaved notes were lost. AFILE_CONFLICTrefusal, or a lost write whose reconciliation finds a different version, now pauses writes and keeps the local notes. The user chooses Replace with my notes (compare-and-swap against the version just read) or Load the file's notes; Undo restores the local notes after loading.Recompile warning. Every save stamped the current PDF fingerprint into the review, so any edit after a recompile marked all earlier notes as placed on the new build. The fingerprint is now written only with the first save; later edits and Save PDF keep it. The warning stays until the user selects Positions checked.
Main-file entry. The field changed the build target and review owner on every keystroke. Each prefix remounted the review pane and created a review session whose Save All participant stayed registered, and with auto compile on, a pause compiled the partial path. The entry now applies on Enter or blur; Escape restores the applied value. Save All also skips review sessions without unsaved changes, so a session for an abandoned or unreadable path cannot fail saving the source.
Local history has no existing fix; the only follow-ups to #3870 (
3a08949c62,b1025b72d4) touch other code.Verification
On this branch (base
a8913094cb) in a clean worktree, after installing dependencies and runningpnpm run gen:types:src/web-ui:node scripts/run-vitest.mjs run \ src/tools/editor/pdf-review \ src/tools/editor/components/{LatexEditor,PdfViewer,CodeEditor}.test.tsx \ src/tools/editor/services/{MonacoModelManager,editorViewResidency,EditorDocument}.test.ts \ src/tools/editor/languages/latex.language.test.ts \ src/tools/editor/utils/latexDocument.test.ts \ src/infrastructure/file-export/savePdfFile.test.ts \ src/infrastructure/api/service-api/LatexAPI.test.ts \ src/app/workbench/ContentResourceView.shortcuts.test.tsxpnpm exec tsc --noEmitfromsrc/web-ui: passed.pnpm run i18n:audit,pnpm run check:repo-hygiene,pnpm run appearance:contract-audit,pnpm run theme:color-audit:all, andpnpm run theme:visual-contract: passed.git diff --check: passed.pnpm run typography:auditreports only the existing violation in unchangeddesign-system/packages/ui/src/components/Dialog/Dialog.module.css:77, which is also present on the base.Reviewer Notes
FILE_CONFLICTrefusal fromwrite_target_checked, which serves local and remote targets on Desktop and the CLI peer host. A host that words the refusal differently still reaches the conflict state on the next save through the existing lost-response reconciliation; a test covers that path.readPdfReviewSourcereplacesextractReviewedPdfand reports encryption from the same parse it uses to extract an embedded review.Checklist