diet-guard/docs/DOCS-sick-days.md
Krzysztof kuhy Rudnicki 8b82faf8f9
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Sick days: diet stands down only when the day does not keep it
due_slots asks sickdays.stands_down(LOCKER_DIET, day) instead of
is_sick_day, so a sick day that keeps diet is a normal day for the gate.
Bump sickdays pins to v0.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PAhbNszs5JKdtnD4uBi3xp
2026-10-16 15:12:59 +02:00

24 lines
1.4 KiB
Markdown

# Free days and sick days
`_gate.due_slots` returns `()` on a shared free day (`freedays`) or a sick day
(`sickdays` 0.2.0, one pool for every gate) -- unless that sick day *keeps*
diet (`sickdays.stands_down(LOCKER_DIET, day)` is False): a kept locker behaves
exactly as on a normal day. Nothing is due, so no lock opens,
nothing is said about missing meals and no debt accrues. Logging a meal works
as on any other day (the log path never consults the gate); diet-guard earns
nothing, so there is nothing to credit.
- Each pool is one local file, never the network, so the systemd-fired gate
cannot hang on it.
- **Fail closed:** an unreadable pool reads as "not free" / "not sick", so the
gate stays armed. `sickdays.stands_down` never raises for a data problem.
- Only the calendar day of `now` is asked (the last slot is at most 22:00, so
the gate never runs on yesterday's slots after midnight).
- Tests: `tests/_state_redirects.py` points both pools into `tmp_path`; a real
sick day on the dev machine must not stand the suite's gate down.
- **Phone gap:** the companion app does not read either pool.
`due_slot_check.dart` (`checkAndNotify`) still posts "log your meal"
notifications on a free or sick day. It would need `crdt_sync_dart` syncing
`sickdays-sync/devices/*/sick_days.json` (see the sickdays README) and an
early return before `_reconcileNotifications` that cancels pending ones.