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
@@ -3,12 +3,12 @@ Groceries,en,groceries
Food and drink - Other,en,groceries
Liquor,en,groceries
Dining out,en,restaurants
Rent,en,housing
Mortgage,en,housing
Electronics,en,home
Furniture,en,home
Household supplies,en,home
Maintenance,en,home
Mortgage,en,home
Rent,en,home
Services,en,home
Pets,en,home
Home - Other,en,home
@@ -19,6 +19,7 @@ Trash,en,utilities
TV/Phone/Internet,en,utilities
Cleaning,en,utilities
Utilities - Other,en,utilities
Insurance,en,insurance
Bicycle,en,transport
Bus/train,en,transport
Car,en,transport
@@ -34,30 +35,35 @@ Music,en,entertainment
Sports,en,entertainment
Entertainment - Other,en,entertainment
Medical expenses,en,health
Childcare,en,children
Clothing,en,shopping
Gifts,en,shopping
Taxes,en,fees
General,en,other
Childcare,en,other
Education,en,other
Insurance,en,other
Taxes,en,other
Life - Other,en,other
Other,en,other
Livsmedel,sv,groceries
Mat och dryck - Övrigt,sv,groceries
Alkohol,sv,groceries
Restaurangbesök,sv,restaurants
Hyra,sv,housing
Avbetalning/Amortering,sv,housing
Elektronik,sv,home
Möbler,sv,home
Förbrukningsvaror,sv,home
Skötsel/underhåll,sv,home
Avbetalning/Amortering,sv,home
Hyra,sv,home
Tjänster,sv,home
Husdjur,sv,home
Hem - Övrigt,sv,home
El,sv,utilities
Värme/gas,sv,utilities
Vatten,sv,utilities
Sophämtning,sv,utilities
TV/telefon/internet,sv,utilities
Städning,sv,utilities
Verktyg - Övrigt,sv,utilities
Försäkringar,sv,insurance
Cykel,sv,transport
Buss/tåg,sv,transport
Bil,sv,transport
@@ -68,16 +74,15 @@ Transport - Övrigt,sv,transport
Hotell,sv,travel
Flyg,sv,travel
Spel,sv,entertainment
Musik,sv,entertainment
Filmer,sv,entertainment
Musik,sv,entertainment
Sport,sv,entertainment
Underhållning - Övrigt,sv,entertainment
Sjukvård/medicin,sv,health
Presenter,sv,shopping
Barnomsorg,sv,children
Kläder,sv,shopping
Presenter,sv,shopping
Skatter,sv,fees
Allmänt,sv,other
Barnomsorg,sv,other
Utbildning,sv,other
Försäkringar,sv,other
Skatter,sv,other
Livet - Övrigt,sv,other
1 splitwise_name language default_key
3 Food and drink - Other en groceries
4 Liquor en groceries
5 Dining out en restaurants
6 Rent en housing
7 Mortgage en housing
8 Electronics en home
9 Furniture en home
10 Household supplies en home
11 Maintenance en home
Mortgage en home
Rent en home
12 Services en home
13 Pets en home
14 Home - Other en home
19 TV/Phone/Internet en utilities
20 Cleaning en utilities
21 Utilities - Other en utilities
22 Insurance en insurance
23 Bicycle en transport
24 Bus/train en transport
25 Car en transport
35 Sports en entertainment
36 Entertainment - Other en entertainment
37 Medical expenses en health
38 Childcare en children
39 Clothing en shopping
40 Gifts en shopping
41 Taxes en fees
42 General en other
Childcare en other
43 Education en other
Insurance en other
Taxes en other
44 Life - Other en other
45 Other en other
46 Livsmedel sv groceries
47 Mat och dryck - Övrigt sv groceries
48 Alkohol sv groceries
49 Restaurangbesök sv restaurants
50 Hyra sv housing
51 Avbetalning/Amortering sv housing
52 Elektronik sv home
53 Möbler sv home
54 Förbrukningsvaror sv home
55 Skötsel/underhåll sv home
Avbetalning/Amortering sv home
Hyra sv home
56 Tjänster sv home
57 Husdjur sv home
58 Hem - Övrigt sv home
59 El sv utilities
60 Värme/gas sv utilities
61 Vatten sv utilities
62 Sophämtning sv utilities
63 TV/telefon/internet sv utilities
64 Städning sv utilities
65 Verktyg - Övrigt sv utilities
66 Försäkringar sv insurance
67 Cykel sv transport
68 Buss/tåg sv transport
69 Bil sv transport
74 Hotell sv travel
75 Flyg sv travel
76 Spel sv entertainment
Musik sv entertainment
77 Filmer sv entertainment
78 Musik sv entertainment
79 Sport sv entertainment
80 Underhållning - Övrigt sv entertainment
81 Sjukvård/medicin sv health
82 Presenter Barnomsorg sv shopping children
83 Kläder sv shopping
84 Presenter sv shopping
85 Skatter sv fees
86 Allmänt sv other
Barnomsorg sv other
87 Utbildning sv other
Försäkringar sv other
Skatter sv other
88 Livet - Övrigt sv other