Skip to content

fix(pdf): restore native annotation placement on Revert - #840

Open
IndelibleVivi wants to merge 1 commit into
modelcontextprotocol:mainfrom
IndelibleVivi:fix/pdf-annotation-revert
Open

IndelibleVivi wants to merge 1 commit into
modelcontextprotocol:mainfrom
IndelibleVivi:fix/pdf-annotation-revert

Conversation

@IndelibleVivi

Copy link
Copy Markdown

Dragging an annotation imported from the PDF mutates the same definition held by the file baseline. Revert then removes user additions but restores the native annotation at its dragged position.

Keep baseline definitions independent from editable definitions, including nested highlight rectangles, at import and restoration boundaries. Derive Revert availability from current annotation contents as well as the existing saved-diff state, so native-only moves can be reverted and undoing a move disables Revert again. The saved diff and PDF export formats remain unchanged.

Refs #817. This covers Revert only; redo shortcuts, saving native moves, reload persistence, and screenshot consistency remain separate parts of that issue.

Adds a deterministic local PDF with a native stamp and a Playwright regression through basic-host: add a user stamp, move the native stamp, Revert; repeat native-only move/Revert twice; then verify undo returns to the baseline and disables Revert. The test also rejects uncaught page errors. The shared loading helper accepts optional tool input so it can reuse the existing server-readiness wait without fetching a remote PDF.

Validation on macOS:

  • Upstream 07cda25 with the new fixture/regression fails at the native placement assertion: expected left/top 180px / 252px, received 252px / 290px after Revert.
  • EXAMPLE=pdf-server npm run test:e2e -- tests/e2e/pdf-annotation-revert.spec.ts --project=chromium --reporter=list --workers=1 --retries=0: passed with bundled Chromium 143 (Playwright 1.57).
  • Additional local runs of the final regression at 1280×720 and 900×900: both passed, including the page-error assertion.
  • npm test: 457 passed, 1 existing skip, 0 failed; includes 108 PDF annotation tests.
  • npm run build, npm run --workspace examples/pdf-server build, and npm run prettier: passed. The PDF workspace build includes its TypeScript check.

Validation uses synthetic PDFs and the repository's basic-host. Native Claude Desktop and other browser engines were not exercised. No documentation change is needed: this restores the existing Revert behavior while retaining the documented persistence/export boundaries.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T06:57:14.505047Z
We couldn’t complete this review. Comment @codex review to try again.
3eb8106 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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