M9: kvitt-import Splitwise importer (SPEC §10.8, FR-17)

CLI per §10.8 with --help, --dry-run and a summary; English and Swedish
headers with member columns matched by name; CSV quoting; payments as
settlements with one allocation; trailing totals row used to reconcile
the account balance (mismatch rolls back, exit 4); non-SEK rows abort
unless --fx; committed category table data/splitwise_categories.csv;
idempotent re-runs through import_key; rows validated with the server's
push checks, audited with source import, no pushes; one BEGIN IMMEDIATE
transaction. Tests over synthetic fixtures only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
2026-10-18 07:45:32 +02:00
parent d9dd5848fe
commit 50339aef6d
21 changed files with 3097 additions and 13 deletions
@@ -0,0 +1,2 @@
Date,Description,Category,Amount,Currency,Alex Example,Robin Sample
2025-05-01,Fine row,Groceries,10.00,SEK,5.00,-5.00
1 Date Description Category Amount Currency Alex Example Robin Sample
2 2025-05-01 Fine row Groceries 10.00 SEK 5.00 -5.00
+15
View File
@@ -0,0 +1,15 @@
Date,Description,Category,Cost,Currency,Alex Example,Robin Sample
2025-01-05,Weekly shop,Groceries,300.00,SEK,150.00,-150.00
2025-01-06,"Paint, brushes and tape",Household supplies,120.50,SEK,-60.25,60.25
2025-01-07,Cinema,Movies,200.00,SEK,0.00,0.00
2025-01-08,Bus card,Bus/train,100.00,SEK,-100.00,100.00
2025-01-09,Mystery box,Widgets,50.00,SEK,25.00,-25.00
2025-01-10,Coffee,Dining out,40.00,SEK,20.00,-20.00
2025-01-10,Coffee,Dining out,40.00,SEK,20.00,-20.00
2025-01-11,An extremely long synthetic description written only to exercise the truncation rule of the importer at one hundred code points,General,10.00,SEK,5.00,-5.00
2025-01-12,Robin paid Alex,Payment,100.00,SEK,-100.00,100.00
2025-01-13,"Rent, January",Rent,1000.00,SEK,500.00,-500.00
2025-01-14,Total balance, , ,SEK,459.75,-459.75
1 Date Description Category Cost Currency Alex Example Robin Sample
2 2025-01-05 Weekly shop Groceries 300.00 SEK 150.00 -150.00
3 2025-01-06 Paint, brushes and tape Household supplies 120.50 SEK -60.25 60.25
4 2025-01-07 Cinema Movies 200.00 SEK 0.00 0.00
5 2025-01-08 Bus card Bus/train 100.00 SEK -100.00 100.00
6 2025-01-09 Mystery box Widgets 50.00 SEK 25.00 -25.00
7 2025-01-10 Coffee Dining out 40.00 SEK 20.00 -20.00
8 2025-01-10 Coffee Dining out 40.00 SEK 20.00 -20.00
9 2025-01-11 An extremely long synthetic description written only to exercise the truncation rule of the importer at one hundred code points General 10.00 SEK 5.00 -5.00
10 2025-01-12 Robin paid Alex Payment 100.00 SEK -100.00 100.00
11 2025-01-13 Rent, January Rent 1000.00 SEK 500.00 -500.00
12 2025-01-14 Total balance SEK 459.75 -459.75
@@ -0,0 +1,7 @@
Date,Description,Category,Cost,Currency,Alex Example,Robin Sample
2025-04-01,Fine row,Groceries,10.00,SEK,5.00,-5.00
2025-13-01,Bad date,Groceries,10.00,SEK,5.00,-5.00
2025-04-03,Total balance, , ,SEK,10.00,-10.00
1 Date Description Category Cost Currency Alex Example Robin Sample
2 2025-04-01 Fine row Groceries 10.00 SEK 5.00 -5.00
3 2025-13-01 Bad date Groceries 10.00 SEK 5.00 -5.00
4 2025-04-03 Total balance SEK 10.00 -10.00
@@ -0,0 +1,7 @@
Date,Description,Category,Cost,Currency,Alex Example,Robin Sample
2025-04-01,Fine row,Groceries,10.00,SEK,5.00,-5.00
2025-04-02,Broken row,Groceries,10.00,SEK,5.00,-4.00
2025-04-03,Total balance, , ,SEK,10.00,-9.00
1 Date Description Category Cost Currency Alex Example Robin Sample
2 2025-04-01 Fine row Groceries 10.00 SEK 5.00 -5.00
3 2025-04-02 Broken row Groceries 10.00 SEK 5.00 -4.00
4 2025-04-03 Total balance SEK 10.00 -9.00
@@ -0,0 +1,6 @@
Date,Description,Category,Cost,Currency,Alex Example,Robin Sample
2025-05-01,Fine row,Groceries,10.00,SEK,5.00,-5.00
2025-05-02,Total balance, , ,SEK,7.00,-7.00
1 Date Description Category Cost Currency Alex Example Robin Sample
2 2025-05-01 Fine row Groceries 10.00 SEK 5.00 -5.00
3 2025-05-02 Total balance SEK 7.00 -7.00
@@ -0,0 +1,2 @@
Date,Description,Category,Cost,Currency,Alex Example,Robin Sample
2025-05-01,Fine row,Groceries,10.00,SEK,5.00,-5.00
1 Date Description Category Cost Currency Alex Example Robin Sample
2 2025-05-01 Fine row Groceries 10.00 SEK 5.00 -5.00
+8
View File
@@ -0,0 +1,8 @@
Date,Description,Category,Cost,Currency,Alex Example,Robin Sample
2025-03-01,Market,Groceries,100.00,SEK,50.00,-50.00
2025-03-02,Hotel abroad,Hotel,10.00,EUR,5.00,-5.00
2025-03-03,Total balance, , ,SEK,50.00,-50.00
2025-03-03,Total balance, , ,EUR,5.00,-5.00
1 Date Description Category Cost Currency Alex Example Robin Sample
2 2025-03-01 Market Groceries 100.00 SEK 50.00 -50.00
3 2025-03-02 Hotel abroad Hotel 10.00 EUR 5.00 -5.00
4 2025-03-03 Total balance SEK 50.00 -50.00
5 2025-03-03 Total balance EUR 5.00 -5.00
+10
View File
@@ -0,0 +1,10 @@
Datum,Beskrivning,Kategori,Kostnad,Valuta,Robin Sample,Alex Example
2025-02-01,Matkasse,Livsmedel,200.00,SEK,-100.00,100.00
2025-02-02,"Lampa, golv",Möbler,80.00,SEK,40.00,-40.00
2025-02-03,Okänd sak,Påhittad kategori,10.00,SEK,5.00,-5.00
2025-02-04,Betalning till Alex,Betalning,55.00,SEK,55.00,-55.00
2025-02-05,Biljett,Buss/tåg,30.00,SEK,-15.00,15.00
2025-02-06,Totalsumma, , ,SEK,-15.00,15.00
1 Datum Beskrivning Kategori Kostnad Valuta Robin Sample Alex Example
2 2025-02-01 Matkasse Livsmedel 200.00 SEK -100.00 100.00
3 2025-02-02 Lampa, golv Möbler 80.00 SEK 40.00 -40.00
4 2025-02-03 Okänd sak Påhittad kategori 10.00 SEK 5.00 -5.00
5 2025-02-04 Betalning till Alex Betalning 55.00 SEK 55.00 -55.00
6 2025-02-05 Biljett Buss/tåg 30.00 SEK -15.00 15.00
7 2025-02-06 Totalsumma SEK -15.00 15.00
@@ -0,0 +1,4 @@
Date,Description,Category,Cost,Currency,Alex Example,Sam Other
2025-05-01,Fine row,Groceries,10.00,SEK,5.00,-5.00
2025-05-02,Total balance, , ,SEK,5.00,-5.00
1 Date Description Category Cost Currency Alex Example Sam Other
2 2025-05-01 Fine row Groceries 10.00 SEK 5.00 -5.00
3 2025-05-02 Total balance SEK 5.00 -5.00