check_patch_targets reads PEP 562 _LAZY_ATTRS tables when a
module cannot import under the hook python. Bumps gatelock 0.15.0,
rtdb-relay 0.2.0 (Python side unchanged), gradle 9.9.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crdt_sync_flutter 0.9.0 installAppErrors: uncaught errors and every
loader over 1 s (WaitWatch) upload to RTDB with the versionCode; the
PC app-errors ingest files board tickets. Bumps ssui 0.8.3, gda 0.5.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bump sync_settings_ui 0.8.3, crdt_sync_flutter 0.8.3 and
github_device_auth 0.5.1; material_ui 1.11.1 now resolves, so the
transitive exception is gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC
RtdbClaudeRelay against the contract fixture, ULID ids, uuid5 entry ids, withdraw on local log.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC
The narrow pull, the log write and the publish each read, merge and write
the food log. Run at once (a publish in flight while a second request
logs) they lose the append: the phone is told "logged" and the only copy
is gone. The new race test lost an entry before this change (1 of 2) and
keeps both after it; the shared temp-file name of the log writer also
collided between threads.
One asyncio lock now covers the pull, "resolve slot + log" and the
publish. A request arriving during a publish waits for it (up to one full
tick); the model call stays outside the lock.
Also: a test that the relay unlocks the header diet_guard's devices store
wrote (same key, a blob sealed by one opens on the other), the skill
returns grams 0 for nothing to estimate (parse fails closed, nothing is
logged), and the doc's session note is corrected: the pull and publish
refresh the gate's session file as the CLI's publish does.
Failure paths: a lost append is now impossible in-process (fail closed by
waiting); the pull failure, locked key, estimator and cleanup paths are
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC
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
estimate_meal(text, photo) -> Estimate runs Claude through
claude_agent_sdk in an isolated CLAUDE_CONFIG_DIR: a copy of the access
token (no refresh token, no MCP tokens) and the diet-food skill, never
kuhy's ~/.claude. The skill text is the system prompt; the closest curated
and derived food-bank rows ride in the user message; the photo is an image
block; the answer is constrained by a JSON schema and validated again.
Failure paths, all fail closed (an EstimateError code, nothing logged):
- no host login, CLI/API error, bad transport: estimate_failed
- more than 45 s: estimate_timeout
- no object, missing/mistyped field, NaN/inf/negative/absurd number,
grams 0, blank or long desc: estimate_invalid
- neither text nor photo: ValueError before any model call
- failed token refresh is logged, the call then fails as estimate_failed
Live smoke (scratch HOME, nothing logged): "2 jajka sadzone i kromka
chleba" -> 315 kcal in 4.3 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC
Dependencies (exact pins): claude-agent-sdk 0.2.183, rtdb-relay 0.1.1,
httpx 0.28.1, hypothesis 6.170.15 (dev). The pylint hook env gets the
same pins.
Entry points, each reachable only through one module attribute:
_claude_connect.connect_sealed (RTDB + e2e unlock), _claude_sdk.run_model
(the model call), _claude_sync.pull_peers / publish (narrow pull, full
tick). SDK and rtdb_relay are imported only by these modules, never by the
gate or CLI at load time.
Test isolation, all fail closed: connect_sealed and run_model are replaced
by a function that raises; pull/publish return None; the sandbox dir and
kuhy's real Claude login path point into tmp_path; _test_guard also
protects ~/.config/diet_guard_claude and ~/.cache/diet_guard. Each of the
six redirects was removed once and its canary went red (fail closed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC
The freshness gate was red for every commit: the version-bump hook stages
app/pubspec.yaml, and material_ui 1.11.1 (released after the last green
run) cannot resolve because sync_settings_ui 0.8.2 pins 1.11.0 exactly
(flutter pub get fails on the conflict).
A transitive predicate entry: it clears itself when sync_settings_ui
moves. Added without asking because no commit could pass otherwise; drop
this commit if you prefer to fix it in utils first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC
Contract for the phone "send to Claude" button, written before any code:
docs/DOCS-claude-relay.md, the shared Python/Dart fixture and its
builder script. No code runs from this commit.
Failure paths named in the contract:
- locked sync / locked e2e key: fail closed, worker writes nothing, the
request stays pending (phone keeps its hourglass)
- invalid body, request older than 24 h, Claude timeout/failure/invalid
JSON: fail closed, an error result is written and nothing is logged
- duplicate event, expired lease or crash replay: idempotent by rid (entry
id is uuid5 of the rid, checked before the Claude call)
- due mode with nothing due: not an error, falls back to slot_for_log
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC
wait_for_turn sleeps its 1.5 s startup grace for real, so every test
that builds a gate paid it. With the grace zeroed in the hermetic
gatelock fixture the 1427 tests run in 11 s instead of overrunning
the 60 s action cap, so the ci-mirror-pytest gate step can finish.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
pre-commit --all-files failed the file-length gate on AGENTS.md (262),
test_sync_e2e.py (309) and test_sync_refresh.py (254), which would turn
CI red. AGENTS.md prose is rewrapped (same words), test_sync_e2e.py
moves its last three classes to test_sync_e2e_copy.py unchanged, and
two docstrings in test_sync_refresh.py are tightened.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
Flutter 3.50 deprecates package:flutter/material.dart; 73 deprecation
infos failed flutter analyze --fatal-infos, and four Dart pins were
behind (crdt_sync_flutter 0.8.2, flutter_local_notifications 23.0.2,
github_device_auth 0.5.0, sync_settings_ui 0.8.2). Those UI packages
now sit on material_ui, so the app has to as well or their widgets lose
MaterialLocalizations.
Imports swap one-for-one and dart fix re-sorted the directives; no
behaviour change. analyze is clean and all six test shards pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
A meal logged on the phone while the gate window was up changed nothing
until Fetch was pressed: the new credit watch only fires on a local
write to the food log, and the PC never pulled on its own.
While a non-demo window is open it now pulls peer logs every 30 s, with
the Fetch button's own narrow pull on a worker thread. One pull is in
flight at a time (shared with the button), failures are logged and
retried, and the window stays up. The pull's write trips the watch,
which closes through the usual reconcile path. gatelock moves to 0.14.0
for watch_credit.
refresh_peer_logs also read the local log before the peer downloads and
wrote it after, so a meal logged during the pull was overwritten. It now
merges the peers first and reads the local log just before the write.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
The hook environment pinned its own gatelock 0.12.0, which predates
watch_credit, so pylint reported the import as missing; moved to the
pyproject pins. The env also ran on pre-commit's own Python 3.15, where
pylint's parallel jobs crash in dill (no co_lnotab) whenever two files
are linted together; it now uses the repo's 3.14.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
The dependency-freshness hook failed on nine stale pins (crdt-sync
0.11.1, freedays 0.4.3, sickdays 0.5.4, coverage 7.17.3, pylint 4.1.4,
ruff 0.17.5) and blocked every push. gatelock moves to 0.14.0 here too,
which is the newest tag; the code that needs it follows separately.
Full suite green on the new pins, 100% branch coverage.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
Every sync payload (food log, banks, budget, catering credential,
Body, export keyring) now lives on diet-guard-sync/devices-e2e, sealed
with the Argon2id key from the shared crdt-sync passphrase; record
ids, tombstones and clocks stay clear. Old plaintext nodes are copied
once and never written or deleted. Locked = no pull, no push.
- PC: _sync_e2e.open_e2e over crdt-sync 0.11.0, key and copy memo in
~/.local/share/diet_guard/e2e; undecryptable peers are skipped.
- Phone/desktop: sync_e2e.dart, crdt_sync_flutter 0.8.1, lock icon
in Settings; pullExportKeys goes through the same open.
- wake-alarm weigh-ins read from wake-alarm-sync/devices-e2e (own
header), on both sides.
Todo: fda71ed1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace showDatePicker, showDateRangePicker and showTimePicker with
numeral grid/wheel dialogs confirmed by check and close icons. Adds a
no-words picker guard and a repo invariant banning the framework pickers.
Todo: e09dac36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>