M12b: category contract v2 on the server (schema 2, fourteen defaults, finer import mapping)

- migrations/0002_categories_v2.sql, byte-identical to contracts/schema/migrations/0002_categories_v2.sql
  (SPEC §14.1.1), with an identity test; SCHEMA_VERSION = 2 (E-1 reports it, the importer's check follows).
- Seed test on a fresh database (the fourteen rows of AC-7.2, server_version 11 to 14) and an upgrade test of a
  v1 database in use (0001 applied through the migrator, then users, a custom, a renamed and an archived default,
  an account, a recurring template, expenses): every earlier row unchanged, the four rows above the old
  sequence, foreign_key_check empty, schema_version 2, a pull from the old cursor returns exactly the four rows.
- DefaultCategoryKey with the fourteen keys (wire enum and contracts/openapi.yaml); icons 33 and colours 14
  (§9.7) in validation.
- The two category examples M12a held back (E-26 response-default, sync/pull-page-categories-v2) and its
  contracts-check patch for them and the enum.
- Importer: splitwise_categories.csv per the §10.8 v0.8 table (D-053), DEFAULT_KEYS of fourteen, synthetic
  fixtures for the finer mapping (Insurance/Försäkringar to insurance among them), a schema-1 refusal test.
- Test harnesses seed users at server_version 15/16 (after the fourteen seeds); pull counts 10 -> 14.

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 08:23:37 +02:00
parent b09f3220a1
commit 6eaccec7ac
21 changed files with 790 additions and 57 deletions
@@ -0,0 +1,8 @@
Date,Description,Category,Cost,Currency,Alex Example,Robin Sample
2025-03-01,Home insurance,Insurance,600.00,SEK,300.00,-300.00
2025-03-02,Preschool fee,Childcare,1500.00,SEK,-750.00,750.00
2025-03-03,Car tax,Taxes,400.00,SEK,200.00,-200.00
2025-03-04,Mortgage March,Mortgage,5000.00,SEK,2500.00,-2500.00
2025-03-05,Total balance, , ,SEK,2250.00,-2250.00
1 Date Description Category Cost Currency Alex Example Robin Sample
2 2025-03-01 Home insurance Insurance 600.00 SEK 300.00 -300.00
3 2025-03-02 Preschool fee Childcare 1500.00 SEK -750.00 750.00
4 2025-03-03 Car tax Taxes 400.00 SEK 200.00 -200.00
5 2025-03-04 Mortgage March Mortgage 5000.00 SEK 2500.00 -2500.00
6 2025-03-05 Total balance SEK 2250.00 -2250.00
@@ -0,0 +1,11 @@
Datum,Beskrivning,Kategori,Kostnad,Valuta,Robin Sample,Alex Example
2025-04-01,Hemförsäkring,Försäkringar,240.00,SEK,-120.00,120.00
2025-04-02,Förskola,Barnomsorg,1000.00,SEK,500.00,-500.00
2025-04-03,Fastighetsskatt,Skatter,300.00,SEK,-150.00,150.00
2025-04-04,Hyra april,Hyra,8000.00,SEK,4000.00,-4000.00
2025-04-05,Amortering april,Avbetalning/Amortering,2000.00,SEK,-1000.00,1000.00
2025-04-06,Elräkning,El,500.00,SEK,250.00,-250.00
2025-04-07,Hundmat,Husdjur,100.00,SEK,-50.00,50.00
2025-04-08,Totalsumma, , ,SEK,3430.00,-3430.00
1 Datum Beskrivning Kategori Kostnad Valuta Robin Sample Alex Example
2 2025-04-01 Hemförsäkring Försäkringar 240.00 SEK -120.00 120.00
3 2025-04-02 Förskola Barnomsorg 1000.00 SEK 500.00 -500.00
4 2025-04-03 Fastighetsskatt Skatter 300.00 SEK -150.00 150.00
5 2025-04-04 Hyra april Hyra 8000.00 SEK 4000.00 -4000.00
6 2025-04-05 Amortering april Avbetalning/Amortering 2000.00 SEK -1000.00 1000.00
7 2025-04-06 Elräkning El 500.00 SEK 250.00 -250.00
8 2025-04-07 Hundmat Husdjur 100.00 SEK -50.00 50.00
9 2025-04-08 Totalsumma SEK 3430.00 -3430.00