Commit Graph

2 Commits

Author SHA1 Message Date
74be875900 workout_app: offline-first workout sync
A finished workout's record now lands in a local crdt log
(workout_log.json) before any network call. Every sync tick pushes that
log, so a failed or unconfigured push goes out with the next tick (home
open, app resume, a 5-minute WorkoutResync retry). The re-push carries
the same record and clock; the PC credits once per type:date anyway.

Every tick and every live history read merges what it pulled into the
same log, so PC records stay readable offline and after a restart.
History shows local rows plus cached synced rows at once, then refreshes
from the live read in the background. Ticks run one at a time, each
cut off after 2 min so a hung request cannot block the queue.

Bug-class-check: stronglift_replacement/workout_app/test/services/workout_sync_offline_test.dart, test/screens/workout_finish_keeps_record_test.dart, test/screens/history_offline_test.dart
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:09:54 +01:00
0921146044 Tests can no longer write the live desktop Firebase credential
`flutter test` runs on a Linux host, so credentialStore()'s Platform.isLinux
branch wrote $HOME/.config/screen_locker/firebase_auth.json -- the refresh
token the screen-locker daemon signs in with. firebase_backend_google_test's
"stores the account under the email Firebase reports" case overwrote it with
the fixture token 'refresh' on every local run; the daemon only survived by
self-healing from a cached token.

Dart:
- lib/services/desktop_config_dir.dart: one resolver, desktopConfigRoot(),
  for every desktop path (the credential file's read/write/delete and the
  ~/.config/crdt-sync account read). @visibleForTesting override; under
  FLUTTER_TEST it throws StateError if the root is, or is inside, the real
  $HOME/.config -- so a test that bypasses the override fails loudly instead
  of writing. HOME unset now yields null instead of a cwd-relative .config.
- The crdt-sync read resolves the root outside its catch-all, so the guard
  cannot be swallowed as "not connected".
- test/flutter_test_config.dart gives every test its own temp config root.
- The Google sign-in test now asserts the token landed in that temp root.
- path_provider is unbound under flutter test (MissingPluginException), so
  the getApplicationSupportDirectory callers cannot reach live dirs.

Python (tests only): isolate_sync_token now patches every import-time
binding of SYNC_TOKEN_FILE (_constants, _manual_push, _sync_status were
missed), and test_home_isolation scans all runtime modules for any Path
still bound inside the real ~/.config/screen_locker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KFwA9nymhUdTrVF65kigTV
2026-09-27 08:35:18 +02:00