screen-locker/screen_locker/tests/fixtures/manual_budget_merge.json
Krzysztof kuhy Rudnicki e12b840f8c manual workout: log for future dates (credited on the day)
A manual workout may be dated today..today+7 days (no past dates). A future
entry is held out of log.json and earns nothing until its date; the first
sync/lock/reset pass on that day ingests and credits it like a workout logged
that day.

- ingest_manual_records defers records dated after the local day and counts
  the budget (2/7d, 10/30d) against the workout's own date over logged credits
  plus pending future records (a pending record never rejects itself)
- PC-logged future entries (Tk dialog, --log-manual-workout --date) go to a
  durable pending ledger re-published on every push (a one-shot publish to
  devices/pc is overwritten by the next push); tombstones win, entries leave
  the ledger once logged or deleted
- one shared date helper (validate_workout_date) used by the dialog and CLI;
  the form's date field rides in the sport row to keep the lock screen fitting
- poke start_the_day also ingests due local entries after the daily reset
- PC admission rule pinned to the phone's by the shared budget fixture
  (planned.expected_by_date)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mmTBiMpvyfLuEAXc6nDYT
2026-10-16 15:34:15 +02:00

107 lines
3.3 KiB
JSON

{
"_comment": [
"Shared cross-language fixture for manual-workout budget counting.",
"Derived from a real divergence on 2026-08-27: the phone showed",
"'Manual: 2/2w 4/10m -- budget exhausted' while the PC read 1/2w 2/10m.",
"Two Dart-only defects caused it, both represented below:",
" 1. the phone's merge ignored tombstones, so the deleted duplicate",
" manual:2026-08-21T21:00 still consumed a weekly slot;",
" 2. the phone counted the evidence-less stub manual_workout:2026-08-15,",
" which the PC refuses to ingest, costing an extra monthly slot.",
"Each side's own round-trip test passed while the pair disagreed, so this",
"literal -- read by both -- is the only thing that catches the drift."
],
"today": "2026-08-27",
"records": [
{
"id": "manual:2026-08-11T18:00",
"deleted": false,
"payload": {
"kind": "manual_workout",
"type": "manual_workout",
"date": "2026-08-11",
"start_time": "18:00",
"end_time": "19:00"
}
},
{
"id": "manual_workout:2026-08-15",
"deleted": false,
"payload": {
"kind": "manual_workout",
"type": "manual_workout",
"date": "2026-08-15"
}
},
{
"id": "manual:2026-08-21T20:00",
"deleted": false,
"payload": {
"kind": "manual_workout",
"type": "manual_workout",
"date": "2026-08-21",
"start_time": "20:00",
"end_time": "21:00"
}
},
{
"id": "manual:2026-08-21T21:00",
"deleted": true,
"payload": {
"kind": "manual_workout",
"type": "manual_workout",
"date": "2026-08-21",
"start_time": "21:00",
"end_time": "22:00"
}
}
],
"expected": {
"week": 1,
"month": 2,
"exhausted": false
},
"planned": {
"_comment": [
"Future-dated (planned) manual entries, added 2026-10-16. Readers of the",
"top-level today/records/expected above ignore this key, so those",
"expectations are unchanged.",
"Scenario: the top-level records PLUS extra_records, still as of 'today'.",
"A manual workout may be dated up to 7 days ahead; the PC credits it on",
"its own date. Budget for adding an entry dated D = the fullest 7-/30-day",
"window CONTAINING D, counting past and future live entries (stubs and",
"tombstones excluded, as above). expected_by_date maps D to that budget.",
"The deleted 08-30 plan proves a cancelled plan frees its slot: live, it",
"would put 08-28 and 08-30 in one 7-day window (2/2, exhausted)."
],
"extra_records": [
{
"id": "manual:2026-08-28T10:00",
"deleted": false,
"payload": {
"kind": "manual_workout",
"type": "manual_workout",
"date": "2026-08-28",
"start_time": "10:00",
"end_time": "11:00"
}
},
{
"id": "manual:2026-08-30T09:00",
"deleted": true,
"payload": {
"kind": "manual_workout",
"type": "manual_workout",
"date": "2026-08-30",
"start_time": "09:00",
"end_time": "10:00"
}
}
],
"expected_by_date": {
"2026-08-27": {"week": 1, "month": 3, "exhausted": false},
"2026-08-28": {"week": 1, "month": 3, "exhausted": false}
}
}
}