Skip to content

[flutter_tools] Implement generic extension protocol base and isolate runner - #190734

Merged
auto-submit[bot] merged 6 commits into
flutter:masterfrom
bkonyi:ft-ext-step02-protocol-and-runner-base
Aug 15, 2026
Merged

auto-submit[bot] merged 6 commits into
flutter:masterfrom
bkonyi:ft-ext-step02-protocol-and-runner-base

Conversation

@bkonyi

@bkonyi bkonyi commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Part of the tool extensibility prototype effort.

Implements the generic JSON-RPC protocol framing, capability handshake, and isolate runner infrastructure for Flutter tool extensions:

  • ToolExtensionEntryPoint, ToolExtensionService, ToolExtensionRunner in package:flutter_tools_extension.
  • Host-side ExtensionManager and ExtensionDiscovery in package:flutter_tools.

Part of #190746
Part of #190755

Pre-launch Checklist

@bkonyi
bkonyi requested a review from a team as a code owner August 7, 2026 19:22
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 7, 2026
@github-actions github-actions Bot added tool Affects the "flutter" command-line tool. See also t: labels. team-linux Owned by the Linux platform team labels Aug 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a pub workspace architecture and protocol implementation for Flutter Tools extensibility, including core models, isolate-based RPC transport, and host-side management via ExtensionManager and ExtensionDiscovery. Feedback focuses on improving robustness and preventing resource leaks, specifically by handling individual spawn failures in spawnAll, ensuring isolates are killed during disposal even if peer closure fails, validating the handshake response type, checking for duplicate RPC method registrations, logging RPC handler exceptions within the isolate, and using eager list copying instead of lazy casting during deserialization.

Comment thread packages/flutter_tools/lib/src/experimental/extension_discovery.dart Outdated
Comment thread packages/flutter_tools/lib/src/experimental/extension_discovery.dart Outdated
Comment thread packages/flutter_tools/lib/src/experimental/extension_discovery.dart Outdated
@bkonyi
bkonyi force-pushed the ft-ext-step02-protocol-and-runner-base branch 5 times, most recently from f2c4ad5 to ba000ed Compare August 7, 2026 20:50
@bkonyi
bkonyi force-pushed the ft-ext-step02-protocol-and-runner-base branch from ba000ed to dd28bb0 Compare August 7, 2026 21:10
@bkonyi
bkonyi removed the request for review from a team August 8, 2026 16:41
@bkonyi
bkonyi force-pushed the ft-ext-step02-protocol-and-runner-base branch 4 times, most recently from fe2d124 to defa25b Compare August 10, 2026 19:46
@bkonyi
bkonyi force-pushed the ft-ext-step02-protocol-and-runner-base branch from defa25b to ec51621 Compare August 11, 2026 17:59
@bkonyi
bkonyi requested a review from loic-sharma August 11, 2026 18:05
Comment on lines +340 to +341
beta: FeatureChannelSetting(available: true),
stable: FeatureChannelSetting(available: true),

@loic-sharma loic-sharma Aug 11, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this feature isn't fully implemented yet, should we make it unavailable on beta and stable? I don't feel strongly about this.

Comment thread packages/flutter_tools/lib/src/experimental/extension_discovery.dart Outdated
Comment thread packages/flutter_tools/lib/src/experimental/extension_discovery.dart Outdated
_featureFlags = featureFlags ?? context.get<FeatureFlags>()!;

/// The active host operating system platform (e.g. `'linux'`, `'macos'`, `'windows'`).
final String hostPlatform;

@loic-sharma loic-sharma Aug 12, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we plumb enums around and convert to strings right before entering the protocol layer? It's very easy to mix up strings and cause unintended values to be passed around. Strong types would help us prevent mistakes.

Alternatively, could we add a platform enum to flutter_tools_extension?

final services = servicesList is List ? List<String>.from(servicesList) : <String>[];
final Object? platformsList = json['supportedPlatforms'];
final supportedPlatforms = platformsList is List
? List<String>.from(platformsList)

@loic-sharma loic-sharma Aug 12, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we lower case these platform strings, to mirror how supportsHostPlatform lower cases strings? (If we switch to enums, that'd address this concern)

loic-sharma
loic-sharma previously approved these changes Aug 12, 2026

@loic-sharma loic-sharma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good to me modulo nitpicks!

@bkonyi
bkonyi requested a review from loic-sharma August 12, 2026 16:08

@loic-sharma loic-sharma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD team-linux Owned by the Linux platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants