Files
notescraft/specs/plugins-parity/briefs/19-pdf-annotation-model.md
Marcos Paulo e8c8c06d1e
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
feat: smart folder model, media time fragments, link card URL guard (MiniMax); specs for 10 more gaps (Codex) and the registry with bloat measurements
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 14:41:26 -03:00

1.9 KiB
Raw Permalink Blame History

TASK pdf-annotation-model: PDF annotation geometry, sidecar and fragment model

Runs through OpenCode (specs/agents/opencode-runbook.md is attached automatically). Task 1 of specs/plugins-parity/pdf-annotations/tasks.md.

OWNS

  • crates/pdf/src/annotation.rs (new, FIRST), crates/pdf/src/annotation/fragment.rs (new)
  • crates/pdf/src/lib.rs (declare/re-export), crates/pdf/src/error.rs (specific validation variant only)

FILES TO OPEN

  • specs/plugins-parity/pdf-annotations/spec.md D1–D2
  • crates/pdf/src/lib.rs
  • crates/pdf/src/error.rs

GOAL / API

Write crates/pdf/src/annotation.rs in SECOND tool call: compiling type/signature stub and one failing validation test, then make pass. First call reads at most three listed files.

Pure no-IO Rect::validate, Annotations::parse/to_json, PdfTarget::parse/to_fragment; normalized top-left rotated-crop-box rectangles, page 1..10,000. Sidecar version 1 and exact spec D1 fields; duplicate IDs/version/size rejected. First fragment supports page, optional stable annotation or normalized rect per D2; preserve page-only links. Existing serde/serde_json verified in PDF manifest; no new dependency. Declare module so tests run. No arbitrary-PDF reader implied by existing exporter crate.

TESTS

Round trip, NaN/infinity, zero area/outside unit square, page 0/10001, duplicate ID, all D1 caps, unknown version, malformed/duplicate fragment fields, page-only link, Unicode target, rotated geometry fixture.

VERIFY

export PATH="$HOME/.cargo/bin:$PATH"
cargo test -p notescraft-pdf annotation
cargo clippy -p notescraft-pdf --all-targets -- -D warnings
rustfmt --edition 2024 crates/pdf/src/annotation.rs crates/pdf/src/annotation/fragment.rs crates/pdf/src/lib.rs crates/pdf/src/error.rs

DO NOT

IO, engine registration, UI, Cargo/dependencies/new crate, PDF export refactor, unsafe/panics/unchecked indexing; git state changes.