diet-guard/docs
Krzysztof kuhy Rudnicki 642467dc1d Add the Claude relay worker
python -m diet_guard claude-worker serves the phone's meal requests from
RTDB (rtdb_relay RequestServer, one SSE stream, reconnects with backoff):
validate, estimate with Claude, log through the signed log with
source=claude under the oldest due slot (normal mode: nearest slot of the
phone's hint), write the sealed result, delete only the request payload,
then publish in the background. diet-guard-claude.service (Restart=on-failure,
WantedBy=default.target) is installed by install.sh and started once the
worker's own Firebase session exists. Nothing is deployed by this commit.

Failure paths:
- narrow peer pull fails (sync locked/unreachable): fail closed, no claim, no
  answer, no model call; the request stays pending, retried every 30 s
- e2e key locked, no passphrase, no session: fail closed, nothing read or
  written; the worker waits and retries every 60 s
- bad body, request older than 24 h (or no created): fail closed, an error
  result, nothing logged
- Claude failure/timeout/invalid JSON: fail closed, an error result with
  retry, nothing logged
- crash between log and result, or a duplicate event: idempotent, the entry
  id is uuid5 of the rid and is looked up (tombstones included) before the
  model call
- request payload delete, old-answer cleanup and the post-answer publish
  failing: fail open on purpose (logged only); the answer and the local
  entry are already durable
- due mode with nothing due: falls back to slot_for_log, not an error

New log helpers log_meal_as / find_entry; log_meal's body is split into
_entry_fields / _store_entry with the same output. The gate and CLI import
none of the worker's dependencies at load time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC
2026-11-17 21:15:08 +01:00
..
explanations Add change explanation: desktop-web-build 2026-07-20 17:27:42 +02:00
DOCS-body.md Ideal weight: drop Broca family and Hamwi 2026-11-01 18:54:38 +01:00
DOCS-claude-relay.md Add the Claude relay worker 2026-11-17 21:15:08 +01:00
DOCS-design.md Adopt the four markdown namespaces and gate them 2026-08-24 15:57:20 +02:00
DOCS-flutter-rules-design.md Adopt the four markdown namespaces and gate them 2026-08-24 15:57:20 +02:00
DOCS-flutter-rules-language.md Adopt the four markdown namespaces and gate them 2026-08-24 15:57:20 +02:00
DOCS-flutter-rules-state-and-data.md Adopt the four markdown namespaces and gate them 2026-08-24 15:57:20 +02:00
DOCS-flutter-rules-testing-and-assets.md Adopt the four markdown namespaces and gate them 2026-08-24 15:57:20 +02:00
DOCS-flutter-rules-ui.md Adopt the four markdown namespaces and gate them 2026-08-24 15:57:20 +02:00
DOCS-kuchnia-wikinga-phone.md Update app/diet_guard (17 files) 2026-10-10 13:49:58 +02:00
DOCS-kuchnia-wikinga.md Catering: answer the panel's CSRF 403 at login; kuchnia --log publishes 2026-10-17 12:42:13 +02:00
DOCS-meal-schedule.md gate: HH:MM spinboxes instead of comboboxes for the meal schedule 2026-10-10 20:13:03 +02:00
DOCS-sick-days.md Sick days: diet stands down only when the day does not keep it 2026-10-16 15:12:59 +02:00
DOCS-sync-latency.md Adopt the four markdown namespaces and gate them 2026-08-24 15:57:20 +02:00
DOCS-textgate-keep.md Icon-only date and time pickers 2026-11-11 12:05:11 +01:00