Skip to content

OCR Review Browser Local PostgreSQL Proof

Status: passed on 2026-07-15 against an isolated local PostgreSQL runtime and non-default Gateway table. This is not default-route, production, or billable Mistral recognition-quality evidence.

Scope

The proof starts Teacher Web, IAM, document-service, docx-import-service, question-bank-service, a Gateway, and separate iam, document, docx_import, and question_bank PostgreSQL databases under a temporary directory. It uses a generated local PDF and a Mistral-compatible local server. The harness does not read or write legacy source, shared databases, default Gateway routes, or public provider accounts.

The tested table is copied from deploy/gateway/routes.import-ocr-mathtype-native-localhost-example.json and only its runtime target ports are rewritten. deploy/gateway/routes.json is not modified.

Evidence

Command:

bash
OCR_REVIEW_BROWSER_LOCAL_POSTGRES_CONFIRM=local-postgres \
make test-ocr-review-browser-local-postgres

Latest artifact root:

text
output/qa/ocr-review-browser-local-postgres-20260715113954/

The run created job docxjob-f1908211af7a01320dec6d26 and Question Bank row q_0dbcf7b71fbdd7cf78f051491fb5ce03 through Teacher Web and the Gateway. browser-create/ records the initial UI, multipart source upload, native OCR create request, completed job detail, and review-editor link. browser-review/ records the review body, native save response, reloaded detail, and rendered editor screenshot.

mistral/requests.jsonl has exactly two local-provider calls: initial create and owner reprocess. The direct request used the configured model mistral-ocr-browser-test, a PDF data URL, and a local bearer key. The persisted PostgreSQL row has parser_engine=mistral-ocr, an opaque source_media_asset_id, an empty source_storage_key, a reviewer id, and COMPLETED status.

After browser save/reload, the owner approves through the narrow candidate exam-import-approval route. The harness then reads /api/questions/{id}?view=editor through candidate questions-detail, checks both Gateway response headers, and records the Question Bank response and row. The persisted row has SINGLE_CHOICE, reviewed escaped HTML plus plain-text stem, option B as correct, <p>Chọn B.</p> as the solution, one canonical answer key, and scoringRuleJson.maxScore=0.75.

Access Boundaries

Teacher B in the same organization received 404 from the non-default Gateway for Teacher A's job detail, status, event log, review save, approval, and OCR reprocess. Teacher A received 400 OCR_SOURCE_REQUIRED when trying to create an OCR job with a raw storageKey. Focused HTTP coverage also rejects Teacher B's direct approval request before it can reach the Question Bank owner boundary.

The temporary candidate table composes the scoped OCR/review/approval and Question Bank read examples, rewriting only loopback ports. Broad /api/exam-import and /api/questions remain legacy_proxy in deploy/gateway/routes.json.

Limits

  • This document validates only omitted/default ocrMode=direct. The separate opt-in batch proof is recorded in OCR Batch Review Browser Local PostgreSQL Proof.
  • The PDF fixture and Mistral response are local deterministic fixtures, so the result is transport, ownership, review persistence, Question Bank persistence, and Gateway proof, not a public-provider accuracy or latency claim.
  • OCR still has no native Word or Markdown artifact-download parity claim.
  • No default-route or production rollout was performed. Rollback remains using GATEWAY_ROUTE_TABLE=deploy/gateway/routes.json.
bash
GOTOOLCHAIN=go1.25.11 go test ./services/docx-import-service/internal/http -count=1
make test-import-pdf-ocr-workflow
make test-import-ocr-mathtype-routes
OCR_BROWSER_SELF_TEST=1 make test-ocr-browser

Go-platform documentation is generated from repository Markdown.