diet-guard/diet_guard/tests
Krzysztof kuhy Rudnicki e07284d3e1 Show weekly and monthly average intake on both devices
The calendar already said which individual days went over budget, but not
whether the week as a whole did. A run of small overages reads as four
harmless yellow squares; averaged, it is the thing that actually moves the
needle.

Three rules are load-bearing, and are documented in CLAUDE.md because getting
any of them wrong silently changes what "under budget" means:

- The denominator is logged days, not elapsed days. An unlogged day is not a
  zero-kcal day, and averaging gaps in as zeros would make a badly-tracked
  week look like the best week of the year.
- The yardstick is the mean of the per-day budgets over those same days,
  resolved through BudgetSchedule -- never today's budget, which would
  retroactively reclassify past weeks on every budget edit.
- Today is excluded. A half-logged today drags the mean far enough to flip
  the band, so every period ends at yesterday.

Band boundaries reuse the calendar's own OVER_BUDGET_YELLOW_CEILING by
import rather than by copy, so a period and its days can never disagree
about what "over" means; that constant loses its underscore to say so.

The MCP get_averages tool returns the average and the band but drops the
average budget, keeping the module's existing invariant that the budget
number never leaves this machine. The CLI, the gate and the phone all show
both, since it is hidden from the network, not from the user.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DjJqpcEsaV5WRhPXyxCThd
2026-08-09 14:59:40 +02:00
..
__init__.py feat(diet_guard): add meal-logging screen-lock gate with trigger fix 2026-06-10 22:32:39 +02:00
_gate_keyboard_probe.py Make the meal gate usable without a pointer on a 1366x768 screen 2026-07-30 16:21:27 +02:00
_gate_layout_probe.py Fit the meal gate on 1366x768 with a full day logged, and stop the auto-scroll 2026-08-03 16:00:13 +02:00
_tk_fakes.py Fit the meal gate on 1366x768 with a full day logged, and stop the auto-scroll 2026-08-03 16:00:13 +02:00
conftest.py Sync meals and the food bank through Firebase, mirroring to GitHub 2026-08-05 08:35:21 +02:00
test_averages.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
test_budget_history.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_budget.py Add budget-adherence calendar, streaks, and freely-editable synced budget 2026-07-13 21:31:45 +02:00
test_calendar_averages.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
test_calendar_view.py Migrate diet_guard to gatelock v0.2.0 per-output locking 2026-07-25 16:56:13 +02:00
test_cli_averages.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
test_cli_gate.py Review fixes: specific sync exceptions, clearer names 2026-07-11 18:33:43 +02:00
test_cli_sync.py Migrate sync to shared crdt_sync library (Python + Dart) 2026-07-10 23:49:43 +02:00
test_cli.py Add budget-adherence calendar, streaks, and freely-editable synced budget 2026-07-13 21:31:45 +02:00
test_daystatus.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_estimator.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
test_foodbank_manual.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_foodbank.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_fuzzy.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
test_gate_layout_fits.py Fit the meal gate on 1366x768 with a full day logged, and stop the auto-scroll 2026-08-03 16:00:13 +02:00
test_gate.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
test_gatelock_calendar.py Migrate diet_guard to gatelock v0.2.0 per-output locking 2026-07-25 16:56:13 +02:00
test_gatelock_fanout.py Migrate diet_guard to gatelock v0.2.0 per-output locking 2026-07-25 16:56:13 +02:00
test_gatelock_keyboard.py Fit the meal gate on 1366x768 with a full day logged, and stop the auto-scroll 2026-08-03 16:00:13 +02:00
test_gatelock_mealflow.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_gatelock.py Make the meal gate usable without a pointer on a 1366x768 screen 2026-07-30 16:21:27 +02:00
test_main.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
test_mcp_averages.py Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
test_mcp.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_portions.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
test_resolve.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
test_slots.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_state.py Add budget-adherence calendar, streaks, and freely-editable synced budget 2026-07-13 21:31:45 +02:00
test_sync_banks.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_sync_merge_banks.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_sync_merge.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
test_sync.py Sync meals and the food bank through Firebase, mirroring to GitHub 2026-08-05 08:35:21 +02:00
test_test_guard.py Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00