Commit Graph

4 Commits

Author SHA1 Message Date
JasonFraser da1b8b325e Fix RBC's last transaction absorbing the Account Fees footer line
RBC prints "Account Fees: $48.75" directly under "Closing balance" on
the statement's last page - not a money token this module recognizes
("$48.75", not "48.75"), no reference-number prefix, no page-number
pattern, so it fell through to plain narrative text and landed on the
last real transaction's description via the trailing-leftover-buffer
rule (correct behavior for a GENUINE trailing narrative line, wrong
for this one).

Fixed by treating the closing-balance line as a position-based
boundary, the same way the header row already is: once extract_page()
recognizes it, every subsequent line on that page is skipped outright
rather than reaching money/narrative classification at all. A no-op
for HSBC, which never emits a closing_balance row in the first place.

measure.py: RBC field accuracy 0.9977 -> 1.0, HSBC unaffected. RBC's
overall status is still "Failed" after this - a separate, pre-existing
engine_agreement disagreement on page 4, not touched by this fix.
2026-10-12 19:31:54 -04:00
JasonFraser 6e4da3f385 Restructure frontend to Vue 3 + Vite (Stage 2 of 2)
Rebuilds templates/index.html (896 lines of vanilla JS, no framework, no
build step) as frontend/, a Vue 3 app per ENTERPRISE_STANDARDS.md's
frontend layering (views -> components -> composables -> services ->
repositories, Pinia for stores) - same agreed scope as Stage 1 (backend):
structure + commenting, not the full SaaS-shaped doc.

The full original file was read in full before starting (every function
enumerated against the plan, not re-derived from memory) to make sure
nothing documented in CLAUDE.md's "Frontend / UI state" section got
simplified away: sticky side-by-side layout with a draggable resizer,
Hide/Show Source Doc, collapsible Result card, per-row pencil-to-edit,
comma-formatted numbers, localStorage persistence with a restore banner,
image zoom controls, the pencil-icon-color and description-autogrow
fixes from earlier this session.

The original ask that started this whole detour - processing-phase text
with an animated ellipsis during /api/process - lands here as the one
genuinely new feature (useProcessingPhases.js + ProcessingIndicator.vue),
honestly simulated rather than claiming real progress (the backend is
one synchronous request with no streaming signal).

backend/app.py now serves frontend/dist (built via a new Dockerfile
multi-stage build: a node stage runs npm ci && npm run build, the Python
stage copies backend/ + that dist/ output) instead of rendering a Jinja
template - a manual SPA-fallback route serves a real static asset if one
exists at the requested path, else index.html. One real bug caught and
fixed before this ever ran: the first version also left Flask's own
automatic static route enabled, registering a duplicate/conflicting rule
against the same /<path:...> pattern as the manual catch-all - fixed by
disabling Flask's own static handling (static_folder=None) entirely.

Verified without a browser (the extension could not connect, tried
repeatedly): npm run build succeeds, formatService.js's pure functions
tested directly in Node, every prop/emit/store reference cross-checked
by hand across all ~20 new files, and full regression through the real
Docker container (SPA serving, static assets, /health, /api/* routing,
dual-engine extraction, measure.py - all unaffected or identical to
baseline). Actual interactive behavior - upload, drag/drop, the
processing-phase animation, editing, zoom, the resizer, persistence/
restore, download - was verified by the user in their own browser, not
by Claude. templates/index.html was kept in place as a fallback until
that confirmation came back, then deleted.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-12 06:32:49 -04:00
JasonFraser 081ab6ac50 Fix OCR-sourced detection in pipeline_service.recheck()
ocr_only detection only matched page_reports status "ocr_only", not
"ocr_raw_words" - if every page of a recheck needed the per-page
raw-OCR-words fallback (Docling failed on all of them), this incorrectly
treated the recheck as non-OCR-sourced, letting it reach "Verified" when
there was no second engine to earn that on. Now checks membership in
("ocr_only", "ocr_raw_words").

Verified directly (not just via measure.py, which never exercises
recheck()): an all-ocr_raw_words page_reports now correctly surfaces the
ocr_source check and stays below Verified; a mixed ocr_only/ocr_raw_words
case does the same; a normal dual-engine case is unaffected - confirmed
both as a direct function call and through /api/recheck on the real
running app. measure.py confirms zero regression elsewhere.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-11 23:49:44 -04:00
JasonFraser 01cd607728 Fix edit-icon color, description autogrow, and add image zoom controls
Three small UI fixes from earlier testing, never committed:

- Pencil edit icon now uses the same blue accent token the Save button
  already does (.row-btn.edit), instead of the default muted gray.
- Description textarea boxes left stale blank space after hiding the
  Source Document panel - the drag-resizer already re-measures box
  height on resize (autoGrowAll()), but the Hide/Show toggle never did,
  so widening the transactions column left every description box at its
  old height until something else happened to trigger a re-measure.
  Added the missing call.
- Images shown in the Source Document panel had no zoom controls at all
  (unlike PDFs, which get the browser's native viewer toolbar for free).
  Added a dedicated zoomable/scrollable image panel with -/+/Fit
  controls, width-based zoom (not CSS transform, so the panel's
  overflow:auto actually produces real scrollbars when zoomed in),
  opening at fit-width by default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-11 23:44:06 -04:00