Files
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.8 KiB

TASK ocr-contract: bounded backend-neutral attachment OCR result model

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

OWNS

  • crates/index/src/ocr.rs (new, FIRST)
  • crates/index/src/lib.rs (declare/re-export), crates/index/src/error.rs (validation error only)

FILES TO OPEN

  • specs/plugins-parity/attachment-ocr/spec.md D1
  • crates/index/src/lib.rs
  • crates/index/src/error.rs

GOAL / API

Write crates/index/src/ocr.rs in SECOND tool call: compiling model stub plus one failing rectangle-validation test, then make pass. First call reads at most three listed inputs.

Define OcrDocument, OcrPage, OcrLine, OcrWord, OcrRect, OcrCapabilities with named spec caps and validate(); normalized top-left geometry, preserved reading order, explicit unsupported state and optional backend confidence. Pure no-IO model; no serde dependency in index manifest, so JSON persistence belongs engine. No fake Markdown line offsets. OS-first decision does not authorize native bindings: tasks 2/4 require owner response; fake contract testing can proceed.

TESTS

Valid/empty result, orientation/page geometry, NaN/infinity/outside/zero rect, page 0, duplicate page, 501 pages, 2 MiB/page and 16 MiB/job text overflow, word cap, optional confidence and unsupported language/capability shape. Declare module so unit tests execute.

VERIFY

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

DO NOT

IO, native API/FFI, unsafe, dependency/Cargo/new crate, bundled models, OCR implementation, index postings, UI, git state changes.