diff --git a/CLAUDE.md b/CLAUDE.md index d9a9c24..72de550 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -30,7 +30,7 @@ to rough effort: | Phase | Contains | Status here | |---|---|---| | **1** | Extraction + 6 checks + Excel export, dual-engine, measurement harness | **In progress — see gaps below** | -| 2 | Review screen, suggested-fix patterns, OCR, 2nd+ bank support | OCR routing + working Docling-fallback (`raw_ocr_extract.py`) built and verified against a real multi-page scan 2026-10-11 — one known single-page edge case remains unreliable, see "OCR / scanned statements" below — review screen **in progress, staged R.1-R.5** (see "Review screen"/"R.2"/"R.3" under Key decisions & lessons) — R.1 (source-position capture + the pdf.js highlighting viewer), R.2 (plain-language flags + jump-to-flagged navigation), and R.3 (the suggested-fix engine - debit/credit swap, transposed digits, OCR digit misread) all shipped 2026-10-13; "date format swapped" investigated and found not to apply to this pipeline's own data shape (see R.3's own entry); R.4's structural row edits and R.5's accept/acknowledge + edit log are not started yet | +| 2 | Review screen, suggested-fix patterns, OCR, 2nd+ bank support | OCR routing + working Docling-fallback (`raw_ocr_extract.py`) built and verified against a real multi-page scan 2026-10-11 — one known single-page edge case remains unreliable, see "OCR / scanned statements" below — review screen **in progress, staged R.1-R.5** (see "Review screen"/"R.2"/"R.3"/"R.4" under Key decisions & lessons) — R.1 (source-position capture + the pdf.js highlighting viewer), R.2 (plain-language flags + jump-to-flagged navigation), R.3 (the suggested-fix engine - debit/credit swap, transposed digits, OCR digit misread), and R.4 (structural row edits - flip sign, insert, split, merge, delete, behind a "more actions" menu) all shipped 2026-10-13; "date format swapped" and a separate "bulk column fix" both investigated and found not to apply to this pipeline's own data shape (see R.3/R.4's own entries); only R.5 (accept/acknowledge + edit log) remains, not started yet | | 3 | Layout mapper (fingerprinting, versioning, drift detection) | Not started | | 4 | Multi-tenant practice/client accounts, Frappe data model | Not started | | 5 | Free front door, public accuracy page | Not started | @@ -345,6 +345,14 @@ security only, not the full SaaS-shaped doc — and the judgment call on what co re-settles `activeIndex` to keep pointing at the right document after a splice, see "Document delete/rename..." under Key decisions & lessons for the exact rules. + `applyCheckResults` also sets `suggestions` as of R.3 (not + just `status`/`checks`), re-applied on every recheck so a + stale one a manual edit already resolved disappears on its + own. `flipTransactionSign`/`deleteTransaction`/ + `insertTransactionAfter(index, template?)`/`mergeWithNext` + (NEW 2026-10-13, review screen R.4 - see that entry under + Key decisions & lessons for the full record, including why + there's no separate `splitTransaction` action). uiStore.js — `resultsOpen`/`toggleResultsOpen()`/`closeResultsOpen()` (renamed from `resultExpanded`/`toggleResultExpanded` - 2026-10-13, now drives TransactionsTable's own Results @@ -1720,6 +1728,57 @@ unaffected. Not machine-verified: the actual click-through - the flag icon, the evidence text, the "Apply fix" button - Claude-in-Chrome still did not connect this session. +**R.4 — structural row edits, shipped 2026-10-13.** Frontend-only, as planned - +`/api/recheck` already accepted any `transactions` array regardless of length, so +add/delete/merge/split only needed new `extractionStore.js` actions: +`flipTransactionSign`, `deleteTransaction`, `insertTransactionAfter(index, template?)`, +`mergeWithNext`. + +**Two deliberate deviations from the original plan, both decided for the same reason - +don't build something that doesn't actually apply or doesn't actually need building:** +- **No separate `splitTransaction` action.** "Split this row" is + `insertTransactionAfter(index, {...row})` - duplicates the row's OWN current values + into a new row right after it, rather than guessing where to divide the amount (the + same "never silently correct" rule as everywhere else in this app) - the user then + edits both rows manually to the real figures. One action, two UI entry points ("Insert + row after" passes no template - blank, for a row the extractor genuinely missed; + "Split this row" passes the current row's own values as the template). +- **No "bulk column fix" (date-format swap).** R.3 already established this pipeline's + dates have no day/month ambiguity left by the time a transaction reaches this layer + (already normalized to `"DD Mon YYYY"` at extraction time) - there was nothing left + for a bulk date fix to do, so it was dropped from scope rather than built as a + no-op. + +All four actions live behind a new "more actions" popover menu on `TransactionRow.vue` +(`.row-menu`, opened by a new `row-btn.more` icon) rather than more always-visible row +icons - these are rarer than edit/flag, and two are destructive. Delete and merge each +go through the same `ConfirmModal` (`danger`/`busy`) pattern every other destructive +action in this app already uses (move-to-project, document delete, project delete) - +flip/insert/split don't need one (additive, or trivially reversible by doing it again). +`mergeWithNext` concatenates descriptions, sums amounts, keeps the LATER row's own +balance (it reflects the cumulative state after both), and unions `source_bbox` when +both rows share a page, so "Show on source" still boxes the full merged area afterward, +not just the first row's original position. + +A new shared `persistAndRecheck()` in `TransactionRow.vue` replaces what R.3's +`applySuggestedFix` had inline - now one function all five of this component's own +mutation paths (suggestion apply + the four structural actions) call, instead of a +sixth near-duplicate copy of the same three steps (manual field edits keep using +`useRowEditing.js`'s own separate copy, since that composable has its own draft/ +cancel state these don't need). + +Verified: all four actions executed directly against real Pinia plus the real running +backend, not reimplemented - flip-then-restore (status returns to original), an +insert-then-delete round trip (status returns to original), and a real merge checked +field-by-field (description concatenation, summed amount, the later row's own balance, +and the unioned bbox's own top/bottom both confirmed against the two original rows' +real values) - including persisting the resulting SHORTER array for real and confirming +both `/api/recheck` and the PocketBase record itself correctly accept and reflect a +31-row statement that started at 32. `measure.py` re-run, unaffected (no backend +touched). Not machine-verified: the actual "more actions" menu, the two confirm +modals, and the resulting table row changes - Claude-in-Chrome still did not connect +this session. + **Governing rule: never silently correct or exclude data.** This shows up in several concrete places, not just as an abstract principle: - A row with an unusual status (e.g. HSBC's "Cancelled" wires) stays in the output and is @@ -2101,6 +2160,12 @@ restructure; the behavior itself predates it and is unchanged: note the fix can apply to a DIFFERENT row than the one the panel was opened from (the balance-chain check's own bridging logic means the row that's actually wrong isn't always the one the mismatch is reported against - see R.3's own entry). +- Every row also has a "more actions" popover (added 2026-10-13, review screen R.4, + `row-btn.more`) with structural edits: flip debit/credit, insert a row after (blank, + for one the extractor missed), split this row (duplicates the row's own values into + a new one right after - the user divides them manually, nothing is auto-split), + merge with the next row, delete this row. Delete and merge each confirm via the same + `ConfirmModal` pattern every other destructive action in this app uses. - All numeric displays are comma-formatted (`formatService.js`'s `fmtMoney`/`fmtNum`). - Edits persist to PocketBase (`documentsService.js`'s `saveDocument`/`updateDocument` - as of 2026-10-13, replacing the earlier localStorage-only version entirely, not diff --git a/frontend/src/assets/main.css b/frontend/src/assets/main.css index fc99a96..6e83d96 100644 --- a/frontend/src/assets/main.css +++ b/frontend/src/assets/main.css @@ -241,7 +241,7 @@ tr.editing .cell-input:not(:read-only):focus{ outline:none; border-color:var(--b } td.amt .cell-input{ text-align:right; font-family:var(--fm); } -.row-actions{ width:54px; padding:3px 0 3px 4px !important; white-space:nowrap; } +.row-actions{ width:74px; padding:3px 0 3px 4px !important; white-space:nowrap; } .row-btn{ background:transparent; border:none; cursor:pointer; padding:4px; border-radius:5px; font-size:13px; line-height:1; color:var(--t4); transition:color .15s, background .15s; @@ -255,6 +255,32 @@ td.amt .cell-input{ text-align:right; font-family:var(--fm); } .row-btn.flag-toggle.active:hover{ background:var(--amber); color:var(--navy-2); } tr.editing td{ background:rgba(37,99,235,.03); } +/* Structural row edits (review screen R.4) - a small popover menu off + the row's own "more actions" icon, not Teleported (unlike the app's + modals - see ConfirmModal.vue's own comment on why those need to + escape their ancestor's stacking context entirely): this only needs + to sit above nearby rows within the SAME table, which plain z-index + already handles. Known, accepted limitation: opened on a row flush + against the scrollable table's own bottom edge, the menu can get + clipped by .table-wrap's overflow-y:auto - not fixed here, revisit if + it's ever actually reported as a real problem. */ +.row-btn.more{ font-size:12px; } +.row-menu-wrap{ position:relative; display:inline-block; } +.row-menu{ + position:absolute; top:100%; right:0; z-index:5; width:180px; margin-top:4px; + background:var(--navy-2); border:1px solid var(--border); border-radius:8px; box-shadow:var(--shadow-h); + padding:4px; display:flex; flex-direction:column; gap:1px; +} +.row-menu button{ + display:flex; align-items:center; gap:9px; width:100%; text-align:left; background:transparent; border:none; + cursor:pointer; padding:7px 9px; border-radius:5px; font-size:12.5px; color:var(--t2); font-family:var(--fb); +} +.row-menu button i{ width:14px; text-align:center; color:var(--t4); font-size:11px; flex-shrink:0; } +.row-menu button:hover{ background:rgba(37,99,235,.08); color:var(--blue); } +.row-menu button:hover i{ color:var(--blue); } +.row-menu button.row-menu-danger:hover{ background:var(--red-l); color:var(--red); } +.row-menu button.row-menu-danger:hover i{ color:var(--red); } + /* The review screen's plain-language flag explanation - a second