Skip to content

Complete the guest PDF annotation journey #56

Description

@sarthakagrawal927

Why

Guest PDFs are stored in IndexedDB but render in an iframe without Reader note controls. Byte-storage tests do not prove an import/read/annotate/reopen workflow.

What

Complete guest PDF page notes: view a PDF, attach a note to its current page, revisit that page, edit/delete notes, and preserve notes/counts after reload. All document/note storage remains browser-local. No cloud upload, login requirement, production migration, deployment, new production dependency, or text-selection/highlight claim.

Design

Reuse the existing project PDFViewer (react-pdf and its bundled local pdf.js worker) instead of embedding the guest PDF in an opaque iframe. Add optional controlled page/load callbacks, preserving account rendering. Reuse Reader's gray/accent styling and note patterns. A local PDF reader composes the viewer and a responsive page-note panel. Note anchors use the existing NoteAnchor.pageNumber. IndexedDB transactions persist changes before success is shown; save failure retains the draft and offers retry. Existing article query invalidation updates library counts. No iframe sandbox or origin protections are relaxed.

Specs

Requirement: Local page notes

The guest SHALL import a valid PDF through the library UI, read rendered pages, save a note anchored to the current page, navigate from the note back to the page, and retain its text/anchor after reload.

Requirement: Editing and deletion

A learner SHALL edit and delete saved notes, and the change SHALL survive reload. Empty notes SHALL not save. Failed writes SHALL retain the draft with an actionable error.

Requirement: Privacy and honest capability

The UI SHALL identify page notes as browser-local and SHALL not imply text highlights or annotations embedded in an exported PDF. The synthetic qualification SHALL block hosted/network writes and verify local persistence.

Tasks

  • Extend the existing PDF viewer with controlled page callbacks and reuse it for guests.
  • Add local page-note create/edit/delete controls and persistence feedback.
  • Run a real synthetic PDF through the built browser UI: import/render/annotate/reopen/edit/delete; inspect 390/768/1440 layouts and errors.
  • Run relevant/full checks, reconcile docs, push checked work and verify exact CI.

Hosted qualification remains #55. Parent/user explicitly requested this bounded implementation and safe checked push; no production upload or deployment is authorized.

Local evidence

pnpm quality passed 126 app tests/21files and 20 extension tests/2files, full builds, code-health gates and 53 documentation files. pnpm test:guest-pdf imports a valid two-page synthetic PDF through the built library UI, verifies real rendered text, anchors a page-2 note, fails a storage write and retries without losing its draft, reloads, returns to the page, edits/reopens/deletes/reloads. No API writes. 390/768/1440 screenshots have settled enabled Previous/disabled Next assertions and no overflow.

Independent parent source and desktop/mobile review found no blocking issue; .fleet/guest-pdf-design-review.json passed. Two detector spinner warnings were advisory. The test exposed and fixed API 5.4.296/worker 5.4.624 mismatch by aligning the existing react-pdf dependency to the existing PDF.js 5.4.624 package, with no new production package.

Completion receipt

Pushed bbc52d9052101afbe864ac2fefa17a6736e2d6ad to origin/main. Exact CI and Docs succeeded. The exact CI log includes the built-browser import/render/page-note/reload/edit/delete pass, 126 app tests and 20 extension tests.

No hosted documents, uploads, production configuration, migration or deployment were touched. #55 retains hosted/account/article qualification and the unimplemented account PDF annotation controls. This closes the scoped guest page-note implementation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions