c6df2ab8f5
contracts/openapi.yaml (OpenAPI 3.1, E-1..E-33, error shape and the exhaustive error code enum, device bearer scheme), contracts/schema/ server-v1.sql (SPEC §14.1 verbatim), seven test-vector files per §14.5.5, 80 examples (every JSON body of §14.3.4, every error code, sync pull/push, every FCM push type), and tools/contracts-check.py (stdlib-only reference of §9.1, §9.3, §9.4 and §14.5.4 plus shape checks; the M1 gate). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
214 lines
4.9 KiB
JSON
214 lines
4.9 KiB
JSON
{
|
|
"format": 1,
|
|
"function": "resolve_range",
|
|
"cases": [
|
|
{
|
|
"name": "this_month",
|
|
"input": {
|
|
"preset": "this_month",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": "2024-03-05",
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-10-01",
|
|
"end_inclusive": "2026-10-17"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "last_3_months: the current month and the two before",
|
|
"input": {
|
|
"preset": "last_3_months",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": "2024-03-05",
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-08-01",
|
|
"end_inclusive": "2026-10-17"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "last_6_months",
|
|
"input": {
|
|
"preset": "last_6_months",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": "2024-03-05",
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-05-01",
|
|
"end_inclusive": "2026-10-17"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "last_12_months: crosses into the previous year",
|
|
"input": {
|
|
"preset": "last_12_months",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": "2024-03-05",
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2025-11-01",
|
|
"end_inclusive": "2026-10-17"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "this_year",
|
|
"input": {
|
|
"preset": "this_year",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": "2024-03-05",
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-01-01",
|
|
"end_inclusive": "2026-10-17"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "all_time with an earliest expense",
|
|
"input": {
|
|
"preset": "all_time",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": "2024-03-05",
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2024-03-05",
|
|
"end_inclusive": "2026-10-17"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "all_time without expenses: today to today",
|
|
"input": {
|
|
"preset": "all_time",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": null,
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-10-17",
|
|
"end_inclusive": "2026-10-17"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "custom in order, future dates allowed",
|
|
"input": {
|
|
"preset": "custom",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": null,
|
|
"custom_start": "2026-11-01",
|
|
"custom_end": "2026-12-31"
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-11-01",
|
|
"end_inclusive": "2026-12-31"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "custom swapped when start is after end",
|
|
"input": {
|
|
"preset": "custom",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": null,
|
|
"custom_start": "2026-12-31",
|
|
"custom_end": "2026-11-01"
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-11-01",
|
|
"end_inclusive": "2026-12-31"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "custom single day",
|
|
"input": {
|
|
"preset": "custom",
|
|
"today": "2026-10-17",
|
|
"earliest_expense": null,
|
|
"custom_start": "2026-02-28",
|
|
"custom_end": "2026-02-28"
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-02-28",
|
|
"end_inclusive": "2026-02-28"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "last_3_months in January crosses the year",
|
|
"input": {
|
|
"preset": "last_3_months",
|
|
"today": "2027-01-01",
|
|
"earliest_expense": null,
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-11-01",
|
|
"end_inclusive": "2027-01-01"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "last_12_months on 31 March: first of April the year before",
|
|
"input": {
|
|
"preset": "last_12_months",
|
|
"today": "2027-03-31",
|
|
"earliest_expense": null,
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-04-01",
|
|
"end_inclusive": "2027-03-31"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "this_month on the first day of the month",
|
|
"input": {
|
|
"preset": "this_month",
|
|
"today": "2026-11-01",
|
|
"earliest_expense": null,
|
|
"custom_start": null,
|
|
"custom_end": null
|
|
},
|
|
"expected": {
|
|
"ok": {
|
|
"start": "2026-11-01",
|
|
"end_inclusive": "2026-11-01"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |