Repository navigation
Conversation
The `exportWorkout delete-then-write` group tests the Health Connect reading of a false delete, and assumed a non-Apple host. flutter test on a Mac runs on a macOS host VM, where HealthExporter.isApple is true: the exporter takes the HealthKit branch (a false delete is the documented empty-range answer and the write proceeds, by design) and "a failed delete does not write a duplicate" fails. CI runs on Linux, so only contributors on a Mac saw it. Add a @VisibleForTesting HealthExporter.isAppleOverride (null = the real platform, so the app is unchanged), the same pattern as ScreenWake.platformOverride, and pin it to false in that group.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Reviewer's GuideImplementationAdd a test-only override for the Apple-platform check while preserving the real platform check by default.
TestsPin the delete-gate test group to Health Connect and reset the override after each test so behavior is consistent across hosts.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Closing this myself: it only matters when running the suite on macOS, which CI doesn't do. Glad to reopen if it's wanted. |
Why
health_workout_export_delete_gate_test("a failed delete does not write a duplicate on top of it") fails on every Mac and passes in CI.The
exportWorkout delete-then-writegroup tests the Health Connect reading of afalsedelete, and its comment assumed "the host VM is neither iOS nor macOS". ButHealthExporter.isAppleisPlatform.isIOS || Platform.isMacOS, andflutter teston a Mac runs on a macOS host VM. ThereisAppleis true, the exporter takes the HealthKit branch (where afalsedelete is the documented empty-range answer and the write goes ahead, by design), and the test's Health Connect expectation fails. CI runs onubuntu-latest, so it never sees it; a contributor on a Mac sees a red test unrelated to their change.The app is fine on both platforms. Only the test was host-dependent.
What changes
lib/health/health_export.dart: a@visibleForTesting static bool? isAppleOverride, read first byisApple. null (the default, and always in the app) keeps the real platform check, so production behaviour is unchanged. Same pattern asScreenWake.platformOverrideinlib/gps/screen_wake.dart.test/health_workout_export_delete_gate_test.dart: the group pinsisAppleOverride = falseinsetUpand resets it intearDown, so it tests Health Connect on every host.Tests
test/health_workout_export_delete_gate_test.dart: 11/11 pass on macOS (was 10/11).flutter analyze: no issues.flutter test --concurrency=1: 7010 passed, 28 skipped, 8 failed. The 8 are the ones fix main's test run: missing translations and gallery case #683 fixes (ui2_tokens gallery, russian_localization, russian_review_findings, settings_report_l10n es/fr/hi/zh, thai_l10n); this test is no longer among them.Not related to #683, which fixes the other red tests on main (translations, gallery); this one is a macOS-only failure #683 doesn't cover.
🤖 Generated with Claude Code
Summary by Sourcery
Stabilize Health Connect delete-gate coverage across development and CI environments.
Bug Fixes:
Enhancements:
Tests:
Summary by CodeRabbit