mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-12 08:30:51 +01:00
The button ran a full sync tick inline on the Tk thread, so the fullscreen lock was dead for its whole duration -- ~18-27s measured against the live remote, and unbounded in the worst case. Two changes, and the second is what makes the first cheap: * the pull moves to a daemon worker thread, with the result marshalled back through a queue polled on the Tk thread. The worker touches no widget, by construction: Tcl is not thread-safe and that includes `after`. Polling also makes the completion path testable with no thread at all. * the button now runs the *narrow* pull. Its question is identical to the gate's -- "did a peer log this slot?" -- and `_reconcile_after_fetch` reads only `due_slots()`, so the budget and food banks it used to fetch were never consulted here. The full tick still runs after the window closes. Measured 84ms against the live remote. Narrowing also shrinks the write race from tens of seconds to imperceptible: the pull persists its merge, so a meal logged mid-fetch could be overwritten by a snapshot taken before it. A second click while a fetch is in flight is now ignored, which is the reentrancy guard and the race fix in one. That guard started out as a disabled button, which is how it surfaced a latent bug worth recording: the fetch button widget is never stored on `GateWidgets`, so `self._widgets.fetch_button` did not exist and the disable was a silent no-op -- hidden because the suppression tuple included `AttributeError`. Coverage would have reported 100% on a guard that did nothing. Guarding on `_fetch_result` needs no widget at all. Also adds `INTERACTIVE_TIMEOUT_SECONDS = 2.0` for the paths a user waits on. `SYNC_TIMEOUT_SECONDS` only ever reached GitHub: crdt_sync v0.6.0's `firebase_client_for` takes no timeout, so Firebase used its 15s default and one hung session refresh stalled the lock window -- the journal has five such refresh failures in five days. Verified to fail closed to the local decision. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJ5YnA3CERitQ57HjMu2Qz
75 lines
2.1 KiB
YAML
75 lines
2.1 KiB
YAML
name: diet_guard_app
|
|
description: "Companion phone app for diet_guard: log meals on the go."
|
|
publish_to: 'none'
|
|
|
|
version: 1.0.42+1
|
|
|
|
environment:
|
|
sdk: ^3.12.2
|
|
|
|
dependencies:
|
|
crdt_sync:
|
|
git:
|
|
url: https://github.com/kuhyx/utils
|
|
ref: crdt_sync_dart-v0.10.0
|
|
path: crdt_sync_dart
|
|
crypto: ^3.0.6
|
|
flutter:
|
|
sdk: flutter
|
|
flutter_local_notifications: ^22.0.1
|
|
flutter_secure_storage: ^10.3.1
|
|
|
|
# One-tap sign-in for the sync account. App-side only: crdt_sync stays pure
|
|
# Dart so it keeps working on Linux desktop and headless.
|
|
github_device_auth:
|
|
git:
|
|
url: https://github.com/kuhyx/utils
|
|
ref: github_device_auth-v0.3.0
|
|
path: github_device_auth
|
|
google_sign_in: ^7.2.0
|
|
http: ^1.6.0
|
|
idb_shim: ^2.9.6+2
|
|
path: ^1.9.1
|
|
path_provider: ^2.1.5
|
|
permission_handler: ^12.0.3
|
|
shared_preferences: ^2.5.5
|
|
|
|
# Shared "Sync settings" screen (Firebase + optional local backup), reused
|
|
# across every kuhy app that syncs. GitHub mirror stays app-local (see
|
|
# lib/screens/github_mirror_screen.dart) since connecting it here also
|
|
# triggers a real log sync, not just a settings save.
|
|
sync_settings_ui:
|
|
git:
|
|
url: https://github.com/kuhyx/utils
|
|
ref: sync_settings_ui-v0.1.0
|
|
path: sync_settings_ui
|
|
url_launcher: ^6.3.2
|
|
uuid: ^4.5.3
|
|
web: ^1.1.1
|
|
workmanager: ^0.9.0+3
|
|
|
|
dev_dependencies:
|
|
# Generates the Android launcher icons from assets/icon/ (see
|
|
# python_pkg/app_icons in testsAndMisc for the shared style).
|
|
flutter_launcher_icons: ^0.14.4
|
|
flutter_test:
|
|
sdk: flutter
|
|
plugin_platform_interface: any
|
|
url_launcher_platform_interface: ^2.3.2
|
|
very_good_analysis: ^10.2.0
|
|
|
|
flutter:
|
|
uses-material-design: true
|
|
|
|
# Launcher icon generation. Source art is produced by the shared generator:
|
|
# PYTHONPATH=~/testsAndMisc python3 -m python_pkg.app_icons generate --app <key>
|
|
# then run: dart run flutter_launcher_icons
|
|
flutter_launcher_icons:
|
|
android: true
|
|
ios: false
|
|
image_path: "assets/icon/icon.png"
|
|
adaptive_icon_background: "#211D1B"
|
|
adaptive_icon_foreground: "assets/icon/icon_foreground.png"
|
|
adaptive_icon_monochrome: "assets/icon/icon_monochrome.png"
|
|
min_sdk_android: 21
|