Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flutter_tools] fix response format of flutterVersion, flutterMemoryInfo #54786

Merged
merged 5 commits into from Apr 14, 2020

Conversation

jonahwilliams
Copy link
Member

Description

When the response structure of this JSON is incorrect, it causes the client to crash. Fix the format and write an integration test that confirms registration and calling works correctly.

Fixes #54755

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 14, 2020
Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

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

lgtm

@bkonyi, it would be worth thinking about ways we could improve either the VM service protocol or the VM service lib so that service protocol extensions could just return their results (instead of carefully packing their results into well-formed data structures).

return versionJson;
return <String, dynamic>{
'result': <String, Object>{
'type': 'Success',
Copy link
Member

Choose a reason for hiding this comment

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

This looks correct (comparing to the compileExpression implementation).

cc @bkonyi - it looks like each client registering a vm service extension needs to be very careful about the response it creates

@Hixie
Copy link
Contributor

Hixie commented Apr 14, 2020

Might be worth seeing if there's something we can do to abstract this out and make it easier to get it right -- e.g. having a general API for sending responses so that only one place needs to create this JSON blob. (As a separate PR, obviously, not trying to hold this up.)

@jonahwilliams
Copy link
Member Author

Yeah, Ideally the callback here would accept a vm_service.Response type. Then we could construct a well-typed object like vm_service.Success and avoid trying to match up the JSON structure

@jonahwilliams jonahwilliams merged commit 159710e into flutter:master Apr 14, 2020
@jonahwilliams jonahwilliams deleted the fix_vm_service_Registry branch April 14, 2020 22:37
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regression wrt flutter_tools use of the vm service protocol
5 participants