mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-19 09:54:32 +01:00
The PC gate forced a re-log when a meal was already logged on the phone but the 15-min sync had not yet propagated it. Two ways to close that gap: - The gate now pulls the shared log right before it would lock -- and only when a lock is otherwise due, so the network cost is paid on the rare tick that matters. A meal already pushed by the phone then unlocks without re-entry. Fails closed: any sync error (no token, network, disk write-back) falls through to the local lock decision, never skips it. - A "Fetch from sync" button on the lock screen runs the same pull on manual request: it auto-unlocks when the pull satisfies every pending slot, advances to the next meal on a partial pull, or reports no change. Disabled in --demo so the sandbox never triggers a real sync/push. - Both paths share one fail-closed wrapper, _sync.pull_shared_log(), which also keeps the single broad-except in one place. - _write_log is now atomic (temp file + Path.replace): the gate and the 15-min sync timer can now both write the log, so a torn read must be impossible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FtSmzACzJSGyEatgK9exkd |
||
|---|---|---|
| .. | ||
| tests | ||
| __init__.py | ||
| __main__.py | ||
| _budget.py | ||
| _cli_gate.py | ||
| _cli_sync.py | ||
| _cli.py | ||
| _coerce.py | ||
| _constants.py | ||
| _estimator.py | ||
| _foodbank.py | ||
| _fuzzy.py | ||
| _gate.py | ||
| _gatelock_core.py | ||
| _gatelock_mealflow.py | ||
| _gatelock_nutrition.py | ||
| _gatelock_support.py | ||
| _gatelock_ui.py | ||
| _gatelock.py | ||
| _mcp.py | ||
| _meal.py | ||
| _portions.py | ||
| _resolve.py | ||
| _slots.py | ||
| _state.py | ||
| _sync_merge.py | ||
| _sync.py | ||