diet-guard/app/test
Krzysztof kuhy Rudnicki 8905d072d0 feat: carry the catering credential to the phone
The Dart half of the credential sync: a `KuchniaCredentialService` that owns
the value locally, a `sync_merge_kuchnia.dart` adapter mirroring the Python
one, and a `_syncKuchniaCredential` tick alongside the banks and budget. The
phone can now receive the panel password, which is the prerequisite for it
fetching anything itself.

One source of truth, per the answered question: the value lives in the synced
document store and nowhere else. Deliberately *not* mirrored into
`flutter_secure_storage` -- two homes for one value is how a stale password
survives a change made on the other device, and the credential has to be
readable synchronously at merge time anyway.

Gated by a second shared fixture, `tests/fixtures/kuchnia_credential.json`,
asserted by both suites. Two cases carry the weight:

- an **unparsable** edit time must fall back to the same clock on both sides
  (Python catches `ValueError` from `fromisoformat`, Dart's `tryParse` returns
  null). Verified they agree on `wall_time_ms == 0`; mutating that expectation
  fails both suites.
- a **blank half** contributes nothing, so a half-filled settings form cannot
  push an empty-string password that wins LWW against a real one.

`KuchniaCredentialService.init()` is called in the WorkManager isolate as well
as `main()`. A fresh isolate has its own static state and `_syncKuchniaCredential`
no-ops when the singleton is missing, so without it a background tick would
neither publish this device's credential nor receive a peer's -- and on the
phone the background tick is most of the syncing there is. Same class of trap
as the `initSyncDeviceId()` one already documented there.

`.toDouble()` came off the bank record: the fields are already `double`, so it
was a no-op the analyzer flags. The field *types* are what keep the encoding
byte-identical to Python's, and `kuchnia_parity_test.dart` asserts that.

654 Dart tests, 1040 Python tests, 100% Python branch coverage.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QQpCiPaSbyRpwsLkH3dgsX
2026-08-23 08:25:27 +02:00
..
desktop Split the remaining seven Dart test files 2026-08-15 20:53:55 +02:00
models Read the meal schedule from a forward-only history (Dart) 2026-08-16 14:41:37 +02:00
screens Rebuild the slot row when settings changes the schedule 2026-08-16 15:12:57 +02:00
services feat: carry the catering credential to the phone 2026-08-23 08:25:27 +02:00
widgets Read the meal schedule from a forward-only history (Dart) 2026-08-16 14:41:37 +02:00
fake_notifications.dart Add OAuth device flow, background notifications, and fix AGP9 release crash (Milestones 3–4) 2026-06-25 17:29:23 +02:00
fake_secure_storage.dart Add Flutter half of cross-device sync (Milestone 3) 2026-06-22 22:42:27 +02:00
firebase_backend_google_test.dart Split the last four Dart lib files; file-length gate now reports zero 2026-08-15 21:07:24 +02:00
google_platform_test.dart Add Google sign-in support for the Firebase sync account 2026-08-12 23:36:10 +02:00
google_sign_in_backend_test.dart Add Google sign-in support for the Firebase sync account 2026-08-12 23:36:10 +02:00
keyboard_operability_test.dart Stop two keyboard tests hanging, and make the CI mirror mirror CI 2026-08-04 21:50:15 +02:00
kuchnia_bank_interop_test.dart fix: keep the catering dish queue alive across a submit 2026-08-22 23:36:53 +02:00
kuchnia_parity_test.dart feat: mirror the catering parser and slot spread in Dart, gated by one fixture 2026-08-23 08:00:54 +02:00
repo_invariants_test.dart Automate CLAUDE.md's structural rules, then cut it to 189 lines 2026-08-15 16:39:57 +02:00
sync_merge_kuchnia_test.dart feat: carry the catering credential to the phone 2026-08-23 08:25:27 +02:00
widget_test.dart app: run the companion app's desktop target as a web build 2026-07-20 16:31:32 +02:00