# Scanner rework status Progress on the approved scanner/OCR rework. See ADR-007/008/009/010 in [DECISIONS.md](DECISIONS.md) for the decisions behind these. For the current live automation runbook, see [AUTOMATION_LIVE_SCAN.md](AUTOMATION_LIVE_SCAN.md). ## Done (implemented, unit-tested, build green) - **OCR eval harness** — `src/eval/`, `npm run eval`, gate in `npm test`. See [ocr-eval.md](ocr-eval.md). - **C# input/capture sidecar** — `native/input-helper/`, `npm run helper:build`. Replaces the PowerShell helper on the same JSON protocol; PowerShell remains a fallback. Verified end-to-end (spawn, runtime, base64 capture). - **Layout profiles + OCR preprocessing** — `src/lib/layoutProfile.ts` (pure geometry, 16:9 detection), `src/lib/ocrPreprocess.ts` (grayscale + Otsu binarize). main.ts now uses calibrated 16:9 detail/count/grid coordinates first and OCRs an upscaled + binarized copy. - **Card-ready gating** — `src/lib/cardReadyGate.ts` replaces the fixed 280 ms settle with change+stability polling; robust to animation. - **GOOD interop** — `src/lib/goodInterop.ts` (export + best-effort import for scanned records), Electron file-picker import/export, and store merge. - **Rescan-merge** — `src/lib/artifactMerge.ts` collapses leveled re-scan duplicates by a level-independent identity. - **Data staleness warning** — `src/lib/dataPackageStatus.ts`, surfaced in the Scanner Diagnose data-package line. - **Lock detection (experimental)** — `src/lib/lockDetection.ts`, wired into live capture as a read-only `locked` flag and persisted with scanned records. - **Elevated live automation path** — `npm run dev:admin` now starts through `scripts/dev-admin.ps1` and logs to `outputs/admin-start/admin-dev.log`. Live status confirmed `isElevated: true`, `genshinFound: true`, and `targetProcess: "GenshinImpact"`. - **Read-only click probe** — `/automation/probe-click?index=1` verified that the app can focus Genshin, move to a visible inventory tile, click it, and observe a changed detail panel fingerprint (`clicked: true`, `inputBlocked: false`, `changed: true`). - **Bounded auto-scan validation** — `/scanner/start?limit=2` completed live with 2 clicks, 2 verified detail views, 2 parsed artifacts, 2 stored records, 2 review samples, and 0 misses. ## Remaining — needs the live environment or a UI pass These cannot be finished/validated without Genshin running at the user's resolution or without UI work best tested live: 1. **Validate/tune OCR preprocessing** on more real captures — confirm invert + threshold + upscale factor help (not hurt) actual Tesseract reads. The text-level eval harness cannot measure image preprocessing. 2. **Validate locked=true** against a known locked artifact — unlocked/grey lock was live-checked; a gold locked icon still needs a positive sample. 3. **Broader scan soak test** — after the bounded two-item live scan passed, the next automation validation should increase the limit gradually and watch for repeated pages, scroll behavior, duplicate handling, and OCR review rate. ## Grow the eval corpus Every low-confidence review sample already stores its crops + OCR. Confirm/correct those via `reviewSampleToEvalCase` and commit them into `src/eval/corpus/` so the harness keeps measuring real-world accuracy across patches. See [ocr-eval.md](ocr-eval.md).