mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-10 20:27:11 +01:00
The gate's pre-lock refresh ran a *full* sync tick -- peer logs, budget,
both food banks, a rebuild and a push -- in front of the fullscreen lock.
Measured against the live remote: ~18-27s, of which the curated-bank loop
alone was 17s spent fetching nothing (absent on Firebase for every peer, so
each of ~21 peers fell through to a GitHub round trip returning `{}`).
It was also failing: five `sync unavailable (network error trying to refresh
the session)` entries in the last five days, one of them a meal that logged
locally but never published.
The gate has one question -- "has a peer already logged this slot?" -- and
only the peer logs can answer it. `_sync_refresh` does that and nothing
else: one bulk revision-map read, a fetch of only the peers whose revision
moved, merge, re-sign, write. No budget, no banks, no push. The full tick
still runs, after the window closes, so nothing is permanently skipped --
the exhaustive pass just moves off the path the user waits on.
Three state invariants have their own regression tests, because each is
silent when broken: `pushed_rev` survives verbatim (this pass never pushes,
and overwriting it would make the device stop publishing forever),
`peer_revs` is merged rather than replaced (only changed peers are visited),
and the log is written before the state.
Separately, `gate --check` was importing an HTTP stack and a GUI it never
uses. `requests` (~78ms) arrived via `_cli_sync` -> `crdt_sync` and via
`_resolve` -> `_estimator_off`; both are now resolved through module-level
`__getattr__` (PEP 562) and `import_module`, which keeps every existing
`patch.object` target and needs no lint suppression.
Measured: `gate --check` 216ms -> ~110ms; narrow pull 92ms against the live
remote. Accepted trade, documented in `_sync_refresh`: a budget edited on
the phone is not visible in the lock dashboard until the post-window tick.
It cannot affect the lock decision, which is why it is safe to defer.
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.40+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
|