Skip to content

Fix analytics regression#46242

Merged
fluttergithubbot merged 3 commits intoflutter:masterfrom
chris-forks:fix-analytics-regression
Dec 9, 2019
Merged

Fix analytics regression#46242
fluttergithubbot merged 3 commits intoflutter:masterfrom
chris-forks:fix-analytics-regression

Conversation

@christopherfujino
Copy link
Copy Markdown
Contributor

@christopherfujino christopherfujino commented Dec 6, 2019

Description

In #45267, the tool stopped sending target device information on run command analytics events. This happened because the setting of List<Device> devices was moved from the run validateCommand() method to the runCommand() method. However, the order of events in the verifyThenRunCommand() method is to:

  1. call validateCommand()
  2. update the cache
  3. send usage event
  4. call runCommand()

This PR fixes the regression by moving the setting of devices back to validateCommand(), but changing the order of events in verifyThenRunCommand() to:

  1. update the cache
  2. call validateCommand()
  3. send the usage event
  4. call runCommand()

Related Issues

Fixes #46165.

Tests

I fixed the "updates before checking devices" test, and added a new test verifying that we send the command event with the proper device data.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read [Handling breaking changes].

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@fluttergithubbot fluttergithubbot added tool Affects the "flutter" command-line tool. See also t: labels. work in progress; do not review labels Dec 6, 2019
Copy link
Copy Markdown
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

lgtm w/ question

}
devices = await findAllTargetDevices();
if (devices == null) {
throwToolExit(null);
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 this give a message like "Failed to find a target device" ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In findAllTargetDevices(), before returning null, the appropriate userMessages will be printed to stdout; in this case:

~/git/flutter/examples/hello_world$ flutter run
Building flutter tool...
No supported devices connected.

So we're covered. I'll add a test verifying this (we have one for attach, but not for run) though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a test, PTAL

Copy link
Copy Markdown
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

still lgtm

@fluttergithubbot fluttergithubbot merged commit 0268510 into flutter:master Dec 9, 2019
@christopherfujino christopherfujino deleted the fix-analytics-regression branch December 9, 2019 23:20
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 2, 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.

Target platform name not set for "run" command analytics screen

4 participants