Skip to content

test(core): Multi-isolate spike evidence for Amplify configure (#5302) - #7266

Draft
cadivus wants to merge 1 commit into
mainfrom
feat/isolate-spike-bg-messenger
Draft

test(core): Multi-isolate spike evidence for Amplify configure (#5302)#7266
cadivus wants to merge 1 commit into
mainfrom
feat/isolate-spike-bg-messenger

Conversation

@cadivus

@cadivus cadivus commented Aug 12, 2026

Copy link
Copy Markdown
Member
  • Spike for Isolate Support #5302 (1st of a stacked series). Test-only — no production code touched.
  • Proven: Amplify's Dart state is already isolate-local — a spawned isolate inherits nothing and completes configure() on its own, without disturbing the parent. The per-instance AmplifyAlreadyConfiguredException guard is unchanged. → packages/amplify_core/test/amplify_class_isolate_test.dart
  • Proven: a bare Isolate.spawned isolate has no BinaryMessenger, so platform-channel calls throw; RootIsolateToken + BackgroundIsolateBinaryMessenger.ensureInitialized installs one (the binding still does not exist). → packages/amplify/amplify_flutter/test/isolate_binary_messenger_test.dart (first tests in this package, so flutter test now runs there)
  • Proven on device: the native SDK is a process-wide singleton — a spawned isolate with empty Dart state still gets AmplifyAlreadyConfiguredException back from Kotlin (dartStateWasEmpty: true + errorCode: AmplifyAlreadyConfiguredException in one run). Runs and passes on the existing e2e_android legs (API 24 + 35), skipped on e2e_ios. → packages/amplify_datastore/example/integration_test/isolate_native_singleton_test.dart. The secure-storage Pigeon harness stays device-gated with a testing plan (that example has web/wasm legs; dart:io/dart:isolate do not compile for web).

@codecov-commenter

codecov-commenter commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.98%. Comparing base (b0c2048) to head (5f163d7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7266      +/-   ##
==========================================
+ Coverage   40.97%   40.98%   +0.01%     
==========================================
  Files         121      121              
  Lines        8273     8273              
  Branches     3598     3598              
==========================================
+ Hits         3390     3391       +1     
+ Misses       4883     4882       -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cadivus
cadivus force-pushed the feat/isolate-spike-bg-messenger branch 2 times, most recently from 2702123 to a0416c8 Compare August 12, 2026 12:19
…5302)

Spike for #5302. Test-only; no production code touched.

- amplify_core: a spawned isolate inherits no Amplify state and completes
  `configure()` on its own, without disturbing the parent. The per-instance
  `AmplifyAlreadyConfiguredException` guard is unchanged.
- amplify_flutter: a bare `Isolate.spawn`ed isolate has no `BinaryMessenger`,
  so platform channel calls throw; passing `RootIsolateToken` to
  `BackgroundIsolateBinaryMessenger.ensureInitialized` installs one.
- amplify_datastore example: proves the native SDK is a process-wide
  singleton, so a spawned isolate with fresh Dart state still hits an
  already-configured native Amplify. Registered in `main_test.dart` so it runs
  on the existing e2e_android legs; gated to Android, skipped on e2e_ios.
- amplify_secure_storage example: the native Pigeon round trip from a
  background isolate. Left device-gated and out of CI -- that example has web
  and wasm legs, and `dart:io`/`dart:isolate` do not compile for web. Carries
  a testing plan in its header.
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.

2 participants