Skip to content

v0.4.0-dev feat: add coordinate-aware vector OCR routing - #7

Merged
Tom-R-Main merged 2 commits into
mainfrom
codex/coordinate-vector-ocr
Oct 11, 2026
Merged

Tom-R-Main merged 2 commits into
mainfrom
codex/coordinate-vector-ocr

Conversation

@Tom-R-Main

@Tom-R-Main Tom-R-Main commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Outlined text can be visible in a PDF while absent from native text extraction.
This change collects bounded painted-path evidence, excludes simple graphics
and shapes accounted for by clipped native text, and records explainable
regional OCR candidates in schema 0.19. Candidates reuse covering bitmap crops
and require recognized text within their own bounds before recovery is reported.

The combined schema 0.18/0.19 continuation also adds page geometry and raster
transforms for declared quarter turns, CropBox and UserUnit. Public boxes stay
in raw PDF coordinates, while JavaScript helpers map them to display space.
Recognized word order, exact source text, chunks and locators remain preserved.
Rotated inferred tables stay withheld pending topology qualification.

The parser remains 0.4.0-dev; this PR does not tag or publish a release.
Geometric candidates and successful OCR do not prove visual completeness.
Vector-lexer bounds exclude initial decompression and whole-process memory.

Validation

  • Local Zig gates: 82/82 build steps; native, shared-library and WASM artifacts.
    The retained uncached run passed 3,774/3,784 tests with ten documented skips.
  • All 339 JavaScript tests pass with no skips, including 13 vector CLI/SDK
    tests, actual outlined-text OCR in both JSONL formats, and crop cleanup.
    CI now runs test files serially after an observed parallel startup deadline.
  • 23 small outlined-text/negative-control PDFs and all 47 generated outputs
    reproduce byte-for-byte. Both SDK readers pass 36 corpus documents plus
    three OCR-enabled controls; adaptive evaluation and existing text/OCR floors pass.
  • Linux/aarch64: 19 scoped memory checks with no skips and 16 vector CLI
    controls across both formats. OCR subprocess memory and whole-Python-process
    shutdown remain unqualified; memcheck_proven remains false.

Review

Regression fixes cover native clip suppression, exhausted coverage accounting,
and disjoint OCR output in a reused bitmap crop. Consolidated read-only review
of all 92 changed files at 075d925 found no actionable findings. Its fresh
checks passed 310 selected JavaScript tests, 28 Zig tests and fixture identity
checks. Review used a separate inherited-model context; no model diversity is
claimed. All six remote CI checks passed at the same head: native gates,
WASM, both Python wheel jobs, adaptive OCR quality and Memcheck boundaries.

Documentation

Output-schema and adapter documentation describe geometry, nullable vector
evidence, counters, work limits, candidate/request links and recovery semantics.
The changelog records this development continuation and its qualified limits.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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 ✅ Completed 2026-10-11T20:29:46.679430Z 075d925 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 075d9250a8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/vector_evidence.zig
Comment on lines +305 to +307
if (values[0] <= 0) {
self.builder.unknown();
self.graphics.paint_state.geometry_known = false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Accept zero-width PDF hairlines

When a valid content stream uses 0 w (the PDF hairline width), this branch marks the graphics geometry unknown. Every subsequent path in that graphics state is then discarded, including filled outlined lettering that does not depend on stroke width, so vector OCR routing can silently miss visible text until a matching Q restores the state. Treat zero as a valid width and conservatively bound only the affected strokes.

Useful? React with 👍 / 👎.

Comment thread src/adaptive.zig
Comment on lines +2596 to +2597
.unexplained_vector => "unexplained_vector",
.vector_evidence_limited => "vector_evidence_limited",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include vector reasons in debug SVG output

Adding names here does not make them appear in debug SVG: writeReasonCsv still iterates a fixed list ending at formula_route_stub. Consequently, vector-routed rectangles omit unexplained_vector and vector_evidence_limited from data-reasons, losing the newly added routing provenance in this output format; add both enum values to that enumeration.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

@Tom-R-Main
Tom-R-Main merged commit 478d73a into main Oct 11, 2026
6 checks passed
@Tom-R-Main
Tom-R-Main deleted the codex/coordinate-vector-ocr branch October 11, 2026 20:34
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