Contracts for 14 default categories and the category suggestion (UX-3, UX-8)

- contracts/schema/migrations/0002_categories_v2.sql: server migration 0002 rebuilds categories with the
  14-key default_key CHECK, inserts housing, insurance, children and fees with server_versions taken from
  the global sequence, sets schema_version 2. server-v1.sql unchanged.
- contracts/category-keywords.csv: the keyword table of the suggestion (148 entries, from docs/ux).
- contracts/test-vectors/suggest_category.json: 65 Kotlin-only cases of CS-4 to CS-6.
- contracts/examples/E-1-health: schema_version 2.
- tools/contracts-check.py: reference suggestCategory, keyword-table checks, 0002 load checks on a fresh
  and an in-use database, plain icon/color check, new icon and colour tokens.
- android/domain: suggestCategory (CS-4 to CS-6, code points, platform NFC and categories through
  UnicodeText), vector runner for suggest_category, eight vector files.
- server/crates/kvitt-domain/tests/vectors.rs: suggest_category is Kotlin-only.

The OpenAPI DefaultCategoryKey extension and the two new category examples are held back until the
server's wire types know the new keys (M12b).

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:10:57 +02:00
parent 86e08a12cf
commit aa765bbb48
12 changed files with 8295 additions and 13 deletions
+3 -3
View File
@@ -2,7 +2,7 @@
//!
//! The directory is read at test time (path from `CARGO_MANIFEST_DIR`), so a new vector file is picked up without a
//! code change; a file for a function this crate does not know fails the test unless it is one of the Kotlin-only
//! analytics functions (SPEC §14.5.4).
//! functions (SPEC §14.5.4 analytics and the category suggestion).
use std::collections::BTreeMap;
use std::path::PathBuf;
@@ -15,8 +15,8 @@ use serde::Deserialize;
use serde::de::DeserializeOwned;
use serde_json::{Value, json};
/// Functions that exist only in Kotlin (SPEC §14.5.4); their files are parsed but not run here.
const KOTLIN_ONLY: &[&str] = &["spend_series", "resolve_range"];
/// Functions that exist only in Kotlin (SPEC §14.5.4, the category suggestion); their files are parsed but not run here.
const KOTLIN_ONLY: &[&str] = &["spend_series", "resolve_range", "suggest_category"];
/// Every Rust function of SPEC §14.5.2; each must have a vector file.
const RUST_FUNCTIONS: &[&str] = &[
"compute_split",