[flutter_tools] Fix macOS flutter attach VM service discovery#183253
[flutter_tools] Fix macOS flutter attach VM service discovery#183253mayanksharma9 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates flutter attach on macOS to use both mDNS and log scanning for VM service discovery. It introduces an override for getVMServiceDiscoveryForAttach in MacOSDevice that delegates to both MdnsVMServiceDiscoveryForAttach and the existing LogScanningVMServiceDiscoveryForAttach. A corresponding test has been added to verify this behavior. My review found one opportunity for improvement regarding documentation.
| return flutterProject.macos.existsSync(); | ||
| } | ||
|
|
||
| @override |
There was a problem hiding this comment.
This new public method override is missing a documentation comment. The style guide requires all public members to be documented. Please add a /// doc comment explaining that this implementation uses both mDNS and log scanning for VM service discovery.
/// Returns a [VMServiceDiscoveryForAttach] that uses both mDNS and log scanning.
@overrideReferences
- All public members should have documentation. (link)
|
Addressed — added a doc comment on explaining it uses both mDNS and log scanning.\n\nCommit: 29ca58f |
|
Follow-up: added the requested method doc comment in commit 29ca58f. |
bkonyi
left a comment
There was a problem hiding this comment.
LGTM from a tool's perspective. Will let @vashworth sign off as the platform TL.
|
I'm a bit confused with how this PR fixes the linked issue:
I'm surprised that the logging based VM service discovery only checks the terminal. Looking at the code, it seems to check the device log, so it shouldn't matter which terminal runs |
|
@hellohuanlin Thanks for calling that out. You are right to question the wording there. The issue is not about the app being started from a different terminal by itself. The real problem is that the current macOS attach path can miss the VM service URI when log based discovery does not surface it reliably, and this change makes attach use mDNS as well instead of depending only on that path. I will tighten up the PR description so it matches the actual failure mode more accurately. |
|
Note to reviewers: this user appears to be running an unsupervised or poorly-supervised agent, and has received a warning and temporary ban. If interaction resumes next week, approach the review with caution. |
|
From triage: we have decided not to proceed with this PR given the past interaction. |
#182972 (comment) attempted to add mac-reviewers to flutter_tool PRs in addition to ios-reviewers, but it didn't apply both: #183253 ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
flutter#182972 (comment) attempted to add mac-reviewers to flutter_tool PRs in addition to ios-reviewers, but it didn't apply both: flutter#183253 ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This updates macOS
flutter attachVM service discovery to use both mDNS and log scanning.Before this change, macOS attach relied on log-based VM service discovery on the macOS path. In cases where that path did not surface the VM service URI reliably, attach could miss it and time out.
This change matches the iOS simulator/device attach strategy by delegating to:
Fixes #183248
Pre-launch Checklist
///).Tests
../../bin/cache/dart-sdk/bin/dart analyze lib/src/macos/macos_device.dart test/general.shard/macos/macos_device_test.dart../../bin/cache/dart-sdk/bin/dart test test/general.shard/macos/macos_device_test.dart