feat(datastore): Refuse configure from a secondary isolate (#5302) - #7271
Draft
cadivus wants to merge 1 commit into
Draft
feat(datastore): Refuse configure from a secondary isolate (#5302)#7271cadivus wants to merge 1 commit into
cadivus wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feat/isolate-category-guardrails #7271 +/- ##
===================================================================
Coverage ? 32.68%
===================================================================
Files ? 34
Lines ? 2374
Branches ? 915
===================================================================
Hits ? 776
Misses ? 1598
Partials ? 0 🚀 New features to boost your workflow:
|
cadivus
force-pushed
the
feat/isolate-category-guardrails
branch
from
August 12, 2026 16:46
8636810 to
16686a0
Compare
First of the per-category #5302 guardrails. DataStore is backed by a process-wide native SDK, so `AmplifyDataStore.configure` now fails fast in an isolate started with `Isolate.spawn` instead of either dying on the platform channel or quietly attaching to the root isolate's already-configured native SDK. The guard is checked before the config check: being on the wrong isolate cannot be fixed by supplying a config. Detection is `ServicesBinding.rootIsolateToken != null`, which is true for an app's main isolate and for a headless `FlutterEngine`, so it cannot fire in a single-isolate app. The predicate is duplicated from the canonical `@internal` getter in amplify_flutter because amplify_datastore does not depend on amplify_flutter, and adding that dependency to share four lines would invert the plugin dependency graph. The comment on each copy points at the other. 121 tests pass in amplify_datastore (117 pre-existing, 4 new).
cadivus
force-pushed
the
feat/isolate-guard-datastore
branch
from
August 12, 2026 16:46
c631f22 to
1f11e54
Compare
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AmplifyDataStore.configurenow fails fast with aPluginErrorin anIsolate.spawned isolate, naming the real cause (native DataStore is a single instance per process) and where to go instead. Checked before the config check, because being on the wrong isolate cannot be fixed by supplying a config.ServicesBinding.rootIsolateToken != null— true for an app main isolate and a headlessFlutterEngine, so it cannot fire in a single-isolate app. Predicate duplicated from the canonical@internalgetter inamplify_flutter(each copy comments the other) becauseamplify_datastoredoes not depend onamplify_flutter; no common Flutter-capable package exists, andamplify_coreis deliberately Flutter-free.ConfigurationError). Full suite 121/121 green, zero regression.amplifyBackgroundProcessingrunsaddPlugins([AmplifyAuthCognito(), AmplifyPushNotificationsPinpoint()])in a headless engine, so both those guards depend on the load-bearing claim that a headlessFlutterEnginereports a non-null root-isolate token — and it cannot be CI-verified: the push example has noe2e_androidleg and no push package in the repo has anintegration_test/dir. Details in the task report; DataStore is unaffected because it is not in that path.