mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-11 21:53:54 +01:00
The one file on the list that could not be fixed by moving code, so the
approach was agreed with the user first: extract a real collaborator rather
than change the public surface.
`push`, `pushManual` and `syncNow` were three near-identical bodies — same
configured-or-bail guard, same GitHubClient/Firebase/MirrorStore construction,
same getFileText/mergeLogs/syncLog round-trip, same catch-everything-and-report
handler, same close-both finally. They differed in the record they merged in
(one, one, none) and two strings. That shared body is now
WorkoutSyncSession.run(), and the three methods are thin wrappers holding only
their own guard and their own wording.
Why a collaborator and not a `part` extension: extension methods dispatch
statically. Four fakes in _home_test_fixtures.dart override `syncNow`, and
manual_workout_screen_test.dart overrides `pushManual` and
`readMergedManualPayloads` — with those in an extension the real
implementations would run while the fakes sat unused, which is how four tests
hung on pumpAndSettle in an earlier attempt. All four remain ordinary methods
on WorkoutSyncService, so every override still binds.
`successReason` and `failurePrefix` are passed in rather than derived from one
another, so the exact strings the tests assert on ('pushed' / 'push failed',
'synced' / 'sync failed') stay under the callers' control.
Unlike the part files, this is a real library with its own lcov SF: entry, so
it has to carry its own coverage — it does. The total drops 2751 -> 2728
covered lines, which is the duplication the extraction removed.
402 tests pass; dart analyze clean; coverage 100%.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EveB813BQ8abAP68VSqZ5Y
|
||
|---|---|---|
| .. | ||
| backup_service_session.dart | ||
| backup_service.dart | ||
| firebase_backend.dart | ||
| github_device_auth.dart | ||
| google_platform_io.dart | ||
| google_platform_web.dart | ||
| google_platform.dart | ||
| google_sign_in_backend.dart | ||
| http_server_service.dart | ||
| progression_sync_service_pull.dart | ||
| progression_sync_service_push.dart | ||
| progression_sync_service_session.dart | ||
| progression_sync_service.dart | ||
| storage_service_backup.dart | ||
| storage_service_exercises.dart | ||
| storage_service_schema.dart | ||
| storage_service_sessions.dart | ||
| storage_service.dart | ||
| sync_device_id.dart | ||
| sync_service.dart | ||
| sync_settings.dart | ||
| sync_state_factory.dart | ||
| sync_status.dart | ||
| workout_sync_service_read.dart | ||
| workout_sync_service.dart | ||
| workout_sync_session.dart | ||