bettersight-statement-extra.../backend/services
JasonFraser 292c13e819 Add the Layouts page, drift detection on every recheck, and fix two real persistence bugs (L.7)
New /layouts route (LayoutsView.vue, linked from AppHeader.vue): List (own + shared
mappings with usage/failure stats), Inspect (source document with each column drawn
as a labeled vertical strip), Test (an unsaved dry run against any of the user's own
documents), Version history + Roll back (append-only - a rollback creates a new
version rather than editing history), and Retire. The plan's own "Edit" (reopening
ManualMappingView pre-populated) was deliberately dropped - columnMap never persists
page/vertical position, so there's no real data to re-populate a visual editor with.

Drift detection now runs on every recheck, not just the original extraction -
useRowEditing.js and TransactionRow.vue both call the same recordUsage() useBatchExtraction.js
already used, via a newly shared layoutMappingsService.checksPassed(). Required
threading layoutMappingUsed/layoutMappingVersionUsed onto the in-memory document
object too (extractionStore/useDocuments/useBatchExtraction), not just the PocketBase
record.

Found and fixed two real bugs via this stage's own end-to-end testing, both in the
same "computed correctly this session, never persisted" category as L.6's zone-padding
fix: startPage itself was never saved, so every future auto-apply of a saved mapping
would have silently reset to page 1, reintroducing the cover-page bug L.2 already
fixed once. Worse: startPage alone only skips whole pages - it does nothing about the
real header row text still sitting on the start page itself, which would have
corrupted essentially every real manually-mapped statement. Fixed with two new
persisted fields (startPage, headerBottom) and a new header_bottom parameter in
table_extract.py, using the same zone-padding margin as a safety buffer.

Verified against the real rebuilt container: a 2-page synthetic statement confirmed
both bugs real before their fixes and confirmed both fixed together; a second,
independent upload auto-applies the saved mapping with both fields carried through;
sourceDocument backfill, version history/rollback, retire, and real three-user
promotion all confirmed against the real PocketBase; a separate test confirmed the
recheck-triggered drift detection itself, flipping a real mapping to stale after a
deliberately broken running-balance edit. measure.py byte-identical throughout; npm
run build passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-15 05:03:20 -04:00
..
extraction Add the Layouts page, drift detection on every recheck, and fix two real persistence bugs (L.7) 2026-10-15 05:03:20 -04:00
__init__.py Fix edit-icon color, description autogrow, and add image zoom controls 2026-10-11 23:44:06 -04:00
checks_service.py Fix edit-icon color, description autogrow, and add image zoom controls 2026-10-11 23:44:06 -04:00
excel_service.py Add review screen R.5: edit log, acknowledge/accept workflow, Excel Edits sheet 2026-10-13 20:41:13 -04:00
extraction_service.py Add the Layouts page, drift detection on every recheck, and fix two real persistence bugs (L.7) 2026-10-15 05:03:20 -04:00
pipeline_service.py Add layout-mapper backend contract: fingerprinting + forced-mapping extraction (L.2) 2026-10-14 08:09:34 -04:00
suggested_fixes_service.py Add the suggested-fix engine for running-balance mismatches (R.3) 2026-10-13 16:09:16 -04:00