Receipt booking pipeline, AI grouping & accountant admin board #14

Merged
julian merged 1 commit from feat/supabase-database into main 2026-06-23 01:51:00 +02:00
Owner

Summary

Backs the app with Supabase and adds the deterministic receipt extraction & booking pipeline, an AI grouping tier, and the start of the accountant admin board.

Booking pipeline (src/lib/booking)

  • Pure, deterministic harmonize + mapAndBook engine (integer-cent math, typed review reasons, GoBD-replayable snapshots).
  • On-device + cloud OCR extraction (src/lib/ocr) feeding the engine.

Predefined groups + AI grouping

  • Group catalog with a (group, rate) → account map.
  • assign-groups edge function tags each line with a catalog group, frozen at scan; the engine resolves merchant-table → AI → residual, deterministic on replay.
  • Owners confirm an AI group on the review screen to promote it to a merchant alias (tier 1 thereafter).

Accountant admin board (web + admin only, /admin)

  • Manage the group catalog + account map.
  • Merchant registry with multiple name aliases (ALDI = ALDI GmbH).
  • Allocate receipt lines to groups.
  • All writes target shared reference tables, guarded by an is_admin() RLS function.

Also

  • Opt-in Face ID app lock (BiometricGate).
  • Web output switched to single-page SPA (fixes window is not defined during static render).
  • Manual VAT selector removed from the new-receipt form.

Verification

  • tsc --noEmit clean, expo lint 0 errors.
  • Booking determinism tests: 43/43 pass.
  • assign-groups deployed; migrations applied to the live DB and apply_all.sql regenerated.
  • Web export builds cleanly.

🤖 Generated with Claude Code

## Summary Backs the app with Supabase and adds the deterministic receipt extraction & booking pipeline, an AI grouping tier, and the start of the accountant admin board. ### Booking pipeline (`src/lib/booking`) - Pure, deterministic `harmonize` + `mapAndBook` engine (integer-cent math, typed review reasons, GoBD-replayable snapshots). - On-device + cloud OCR extraction (`src/lib/ocr`) feeding the engine. ### Predefined groups + AI grouping - Group catalog with a `(group, rate) → account` map. - `assign-groups` edge function tags each line with a catalog group, **frozen at scan**; the engine resolves **merchant-table → AI → residual**, deterministic on replay. - Owners confirm an AI group on the review screen to promote it to a merchant alias (tier 1 thereafter). ### Accountant admin board (web + admin only, `/admin`) - Manage the group catalog + account map. - Merchant registry with multiple name aliases (ALDI = ALDI GmbH). - Allocate receipt lines to groups. - All writes target shared reference tables, guarded by an `is_admin()` RLS function. ### Also - Opt-in Face ID app lock (`BiometricGate`). - Web output switched to single-page SPA (fixes `window is not defined` during static render). - Manual VAT selector removed from the new-receipt form. ## Verification - `tsc --noEmit` clean, `expo lint` 0 errors. - Booking determinism tests: **43/43 pass**. - `assign-groups` deployed; migrations applied to the live DB and `apply_all.sql` regenerated. - Web export builds cleanly. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Deterministic scan→booking engine (src/lib/booking): harmonize + mapAndBook,
integer-cent math, typed review reasons, GoBD-replayable snapshots. On-device +
cloud OCR extraction (src/lib/ocr) feeding the engine.

Predefined booking groups with a (group, rate) → account map. AI grouping tier
(assign-groups edge function) tags each line with a catalog group, frozen at
scan; the engine resolves merchant-table → AI → residual, fully deterministic on
replay. Owners confirm an AI group on the review screen to promote it to a
merchant alias (tier 1 from then on).

Accountant admin board (web + admin only, /admin): manage the group catalog +
account map, a merchant registry with multiple name aliases (ALDI = ALDI GmbH),
and allocate receipt lines to groups. Writes shared reference tables, guarded by
an is_admin() RLS function.

Also: opt-in Face ID app lock (BiometricGate), web output switched to single-page
SPA (fixes "window is not defined" during static render), and the manual VAT
selector removed from the new-receipt form.

Migrations + apply_all regenerated; assign-groups deployed and booking tests pass
(43/43).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
julian merged commit 6cd9079aaa into main 2026-06-23 01:51:00 +02:00
julian deleted branch feat/supabase-database 2026-06-23 01:51:08 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
julian/quickfin!14
No description provided.