Skip to content

test(app): fix pre-existing test drift (env fakes + DeviceType.frame)#8583

Merged
mdmohsin7 merged 4 commits into
mainfrom
fix/test-env-devicetype-drift
Jun 29, 2026
Merged

test(app): fix pre-existing test drift (env fakes + DeviceType.frame)#8583
mdmohsin7 merged 4 commits into
mainfrom
fix/test-env-devicetype-drift

Conversation

@mdmohsin7

@mdmohsin7 mdmohsin7 commented Jun 29, 2026

Copy link
Copy Markdown
Member

What

Fixes pre-existing test failures that had drifted from the app code. These were surfaced while verifying the Flutter 3.41.9 upgrade (#8581) but are independent of it — they fail on main today.

Env fakes out of sync with EnvFields (3 files)

lib/env/env.dart swapped Mixpanel → PostHog: dropped mixpanelProjectToken + growthbookApiKey, added posthogApiKey. The test fakes in env_test.dart, env_staging_test.dart, env_empty_staging_test.dart were stale, causing:

  • error Missing concrete implementation of 'getter EnvFields.posthogApiKey'
  • warning override_on_non_overriding_member (the removed getters)

Fix: rename mixpanelProjectTokenposthogApiKey, drop growthbookApiKey → fakes now match the interface exactly.

DeviceType.frame removed (capture_provider_test.dart)

frame was removed from the DeviceType enum (commit ecb30e1cb). Three tests still referenced it → error There's no constant named 'frame' in 'DeviceType', which meant the entire file failed to compile and never ran.

Fixes:

  • Dropped the 2 redundant "no native route" cases for Frame (that path is already covered by bee/fieldy/limitless/plaud).
  • Switched the unique "switching from no-route device to Omi gains route" case to fieldy.

Once the file compiled, it exposed two further latent bugs in tests that had never executed:

  • Env never initializedLateInitializationError on omi-route paths reading Env.apiBaseUrl. Added an Env.init(stub) in setUpAll.
  • Wrong assertionSharedPreferencesUtil.getString returns a non-nullable String defaulting to '', so a cleared nativeBleStreamConfig is '', not null. Changed isNullisEmpty (2 spots).

Verification (Flutter 3.41.9 / Dart 3.11.5)

  • flutter analyze on the 4 files: 0 errors (was 6).
  • flutter test on the 4 files: 72 tests pass (was: 6 compile errors + 10 runtime failures).

Out of scope

The full suite still has 4 unrelated pre-existing logic failures in files this PR doesn't touch — audio_wave_painter_test (shouldRepaint 0.01 epsilon boundary) and ring_protocol_test (off-by-one buffer boundary). Both are SDK-version-independent pure-Dart logic and need their own investigation; left for a separate fix.

Review in cubic

… init Env, correct cleared-config assertions

- Replace removed DeviceType.frame: drop 2 redundant no-route cases (covered by bee/fieldy/limitless/plaud), switch the unique 'gains route' case to fieldy.
- Init Env in setUpAll so omi-route paths reading Env.apiBaseUrl don't throw LateInitializationError.
- getString returns '' (non-nullable) for missing keys, so assert isEmpty not isNull on cleared nativeBleStreamConfig.

These ran for the first time after the DeviceType.frame compile error was fixed.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

mdmohsin7 added a commit that referenced this pull request Jun 29, 2026
## What

Bumps the repo's Flutter toolchain from **3.35.3** (10 months old) to
**3.41.9** (latest patch in the 3.41 line, bundles Dart 3.11.5, released
2026-04-30).

- **codemagic.yaml** — all 8 `flutter:` pins `3.35.3` → `3.41.9` (this
is what actually drives app builds)
- **app/setup.sh** + **app/setup/scripts/setup.ps1** — informational
`Flutter SDK (v…)` strings updated (macOS + Windows setup scripts)
- **docs/doc/developer/AppSetup.mdx** — `flutter doctor` example output
+ "Recommended versions" bumped to 3.41.9
- **app/.fvmrc** — removed. It was stale (pinned `3.24.1`, ~13 months
old), unreferenced in any docs/CI/scripts, and FVM isn't part of the
workflow. Dead config.
- **app/pubspec.lock** — `matcher` 0.12.18→0.12.19 and `test_api`
0.7.9→0.7.10, the versions the 3.41.9 SDK pins

`.github/workflows/lint.yml` is intentionally left on `channel: stable`
(unpinned) — unchanged.

## Verification (run locally on Flutter 3.41.9 / Dart 3.11.5)

| Check | Result |
|---|---|
| `flutter pub get` | ✅ resolves |
| `flutter gen-l10n` | ✅ no changes, zero untranslated warnings |
| `flutter analyze` | ✅ **0 errors in `lib/`** (shipping code) |
| `flutter build apk --debug --flavor dev` | ✅ APK built — full
Gradle/AGP toolchain (primary 3.35→3.41 risk) |

iOS not built locally (CocoaPods/Xcode) — will be validated by
Codemagic.

### Pre-existing test errors (NOT from this upgrade)
`flutter analyze` reports errors in `test/` that are pre-existing
test/code drift independent of the SDK version (`DeviceType.frame`
removed; `EnvFields.posthogApiKey` not implemented in fakes). Fixed
separately in #8583.
@mdmohsin7 mdmohsin7 merged commit f1819e1 into main Jun 29, 2026
3 checks passed
@mdmohsin7 mdmohsin7 deleted the fix/test-env-devicetype-drift branch June 29, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant