feat: Add root-isolate predicate and pin secondary-isolate plugin behaviour (#5302) - #7270
Draft
cadivus wants to merge 1 commit into
Draft
feat: Add root-isolate predicate and pin secondary-isolate plugin behaviour (#5302)#7270cadivus 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-bootstrap-helper #7270 +/- ##
=================================================================
+ Coverage 41.03% 41.58% +0.54%
=================================================================
Files 122 124 +2
Lines 8285 8193 -92
Branches 3607 3587 -20
=================================================================
+ Hits 3400 3407 +7
+ Misses 4885 4786 -99 🚀 New features to boost your workflow:
|
) Groundwork for the #5302 category guardrails. No behaviour change: the only production change is a new `@internal` getter, and nothing in this commit consumes it. - `amplifyIsInRootIsolate` in amplify_flutter: true for an app's main isolate and for a headless `FlutterEngine` entry point, false only inside `Isolate.spawn`. Built on `ServicesBinding.rootIsolateToken`, so it cannot false-positive on the root isolate. - Pins the behaviour of the layer above the guards: `AmplifyCategory.addPlugin` (amplify_core/lib/src/category/amplify_categories.dart:91-101) swallows `AmplifyAlreadyConfiguredException` and registers the plugin anyway, so nothing is left for amplify_flutter to observe. That swallow is why the guards cannot live at this layer. `amplify_core` is Flutter-free and cannot tell which isolate it is on, so each native-backed plugin guards inside its own native call path instead. A guard in `hybrid_impl.dart` was written, proven dead by test, and reverted.
cadivus
force-pushed
the
feat/isolate-category-guardrails
branch
from
August 12, 2026 16:46
8636810 to
16686a0
Compare
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.
@internalgetter, nothing here consumes it.AmplifyCategory.addPlugin(amplify_core/lib/src/category/amplify_categories.dart:91-101) already catchesAmplifyAlreadyConfiguredExceptionand registers the plugin anyway, so nothing is left foramplify_flutterto observe. I wrote the guard inhybrid_impl.dart, proved it dead with a test, and reverted it.amplify_coreis Flutter-free and cannot tell which isolate it is on, so each native-backed plugin guards in its own native call path instead — see feat(datastore): Refuse configure from a secondary isolate (#5302) #7271 (DataStore) and feat(auth): Refuse addPlugin from a secondary isolate without a messenger (#5302) #7272 (Auth).amplifyIsInRootIsolate— true for an app main isolate and a headlessFlutterEngine, false only insideIsolate.spawn. Cannot false-positive on the root isolate.integration_test/harness for theamplify_push_notifications_pinpointexample, ane2e_androidleg (neither exists today), and a test-only native hook to invoke the background service and reportamplifyIsInRootIsolatefrom inside the real headless engine. Native work with its own testing plan; the guard must not ship on static analysis alone.