feat(scanner): add debug instrumentation for vision pipeline timing #155
No reviewers
Labels
No labels
agent-context-drift
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rstillwell/deckhearth#155
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/scanner-debug-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds real-time performance logging to the card scanner pipeline for diagnosing slow identification on iOS Chrome and mobile devices.
Changes
lib/scanner-card-identify.js— Instrumented Layer 0 (pgvector visual similarity), Layer 1 (Tesseract OCR + pg_trgm), and Layer 2 (Vision API) with per-layer timing logs. Pipeline orchestration logs total scan time and each layer transition.lib/use-scanner-identification.js— Added shutter-press logging with attempt count, verification outcome timing, rate-limit cooldown display, and error-path instrumentation.docs/SCANNER_DEBUG_MODE.md— Full usage guide with activation instructions, log format reference, common patterns (fast L0 hit, OCR path, vision API path, rate limit), and iOS Chrome debugging tips.How to use
Then navigate to
/scannerand scan cards. Timestamped logs will appear in the console showing which pipeline layer is slow.What gets logged
Zero overhead when off
All logging is gated by
isDebugMode()which checkswindow.__SCANNER_DEBUGorlocalStorage— no performance impact in production.Test results
All 58 scanner-specific tests pass (3.23s). No behavioral changes — purely additive instrumentation.
- custom_frames: per-user frames with full 9-slot palette (JSONB), unique names; designer frame picker lists them alongside starters, click to use, edit/delete via inline editor with live preview - custom_symbols: upload cost icons (PNG/WebP/SVG, 2MB) keyed by short code; re-uploading a code replaces the old icon; ManaPips renders icon pips for {CODE} tokens with graceful text fallback - custom_cards.custom_frame_id links designs to custom frames; API GETs join and nest the palette; deleting a frame falls back to starter - migration 1787700511000- {CODE} tokens in description/actions/flavor render as inline symbol icons (RichText), including inside cost pips - custom frames gain an optional background texture (upload/replace/ remove via /api/custom-frames/[id]/texture); renders behind panels - custom games can be shared to the community (is_public): toggle in the game space, public listing at /community/games, read-only game view, /api/public/games endpoints (no auth, public rows only) - /designer/print: multi-card print sheets on US Letter at 300dpi (63x88mm cards, 3x3 or 2x2, dashed cut guides, full-sheet PNG export) - migration 1787711511000- Add isDebugMode() + debugLog() helpers to scanner-card-identify.js and use-scanner-identification.js - Instrument Layer 0 (pgvector), Layer 1 (Tesseract OCR + pg_trgm), Layer 2 (Vision API) with per-layer timing - Log shutter press, verification outcomes, rate-limit cooldowns, and pipeline totals - Activate via localStorage.setItem('SCANNER_DEBUG', 'true') or window.__SCANNER_DEBUG = true - Zero runtime overhead when debug mode is off (isDebugMode() check inlined) - Add docs/SCANNER_DEBUG_MODE.md with full usage guide and log pattern examples