diet-guard/diet_guard/tests
Krzysztof kuhy Rudnicki 84bd550331
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
Migrate diet_guard to gatelock v0.2.0 per-output locking
The gate is laid out once per live output instead of once on the primary,
and claims the screen through an Arbiter at RANK_DIET_GUARD so the wake alarm
and the workout locker can both outrank it.

Three kinds of state needed three different answers. The display fields
already fanned out for free -- GateVars holds root-mastered StringVars bound
to labels. The typed-in fields did not: amount, per, meal name and the four
macro cells were bare tk.Entry widgets, so N copies would have been N
independent forms. They are variable-backed now, which is what makes logging
work from whichever screen the user is actually looking at. The description
box and the suggestion list cannot be shared at all -- tk.Text and tk.Listbox
have no variable -- so those genuinely diverge and reads answer from the copy
the user touched.

The History tab is per-surface too: its grid, budget field and edit button
are driven across every monitor, with the budget likewise variable-backed so
the value cannot differ between screens mid-edit.

Laying the gate out on the primary monitor only was considered and rejected:
not having to hunt for the screen the form landed on is the entire point of
per-output locking.

Tests: the suite hung rather than failed on first run -- diet_guard patches
its own `tk`, but LockWindow builds Toplevels through gatelock's, and real
tkinter over a MagicMock root recurses without bound. `_hermetic_gatelock`
closes that and redirects the runtime dir so no test can stand a production
locker down. Every other test runs single-output, where fan-out is
unobservable, so test_gatelock_fanout runs on two; each assertion was checked
by cropping the fan-out loops to the first surface and confirming it goes red.

_gatelock_ui and _gatelock_calendar were each split in two to stay under the
500-line limit, and GateVars' typed-in fields moved into a nested
GateEntryVars rather than raising pylint's attribute cap.

470 tests, 100% branch coverage, pre-commit clean, no lint suppressions.
2026-07-25 16:56:13 +02:00
..
__init__.py feat(diet_guard): add meal-logging screen-lock gate with trigger fix 2026-06-10 22:32:39 +02:00
conftest.py Migrate diet_guard to gatelock v0.2.0 per-output locking 2026-07-25 16:56:13 +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_view.py Migrate diet_guard to gatelock v0.2.0 per-output locking 2026-07-25 16:56:13 +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 Add budget-adherence calendar, streaks, and freely-editable synced budget 2026-07-13 21:31:45 +02:00
test_estimator.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
test_foodbank.py Add cross-device log sync (Python half of Milestone 3) 2026-06-22 19:36:27 +02:00
test_fuzzy.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +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_mealflow.py Add budget-adherence calendar, streaks, and freely-editable synced budget 2026-07-13 21:31:45 +02:00
test_gatelock.py Migrate diet_guard to gatelock v0.2.0 per-output locking 2026-07-25 16:56:13 +02:00
test_main.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +02:00
test_mcp.py Add MCP server exposing diet status + a gated log_meal 2026-07-10 21:36:46 +02:00
test_meal.py Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +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 Extract diet_guard from testsAndMisc as a standalone repo 2026-06-22 12:18:39 +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_merge.py Add budget-adherence calendar, streaks, and freely-editable synced budget 2026-07-13 21:31:45 +02:00
test_sync.py Add budget-adherence calendar, streaks, and freely-editable synced budget 2026-07-13 21:31:45 +02:00