Skip to content

Conversation

@royarg02
Copy link
Contributor

@royarg02 royarg02 commented May 7, 2022

Fixes #102035.

Makes the version and the upstream repository message display an issue in cases where flutter upgrade is not supported.

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.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 7, 2022
@zanderso zanderso requested a review from christopherfujino May 7, 2022 13:56
Copy link
Contributor

Choose a reason for hiding this comment

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

can you pull some of this logic into helper methods? This cascade of if/else's is very difficult for my poor brain to parse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made each statement have its separate function returning ValidationMessage. Hope that suffices.

@royarg02 royarg02 force-pushed the fluttervalidator branch 2 times, most recently from 4d5d1e0 to e6f6019 Compare May 21, 2022 12:18
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, when is this value 0.0.0-unknown? And can you add a comment with the answer so I don't ask you next time :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be before run the validator on line 544?

Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than doing this check for gitUrl != null, can we not re-use the error message of upstreamValidationError? If that doesn't make sense, I think we should at least sub-class VersionCheckError for the different types of errors, rather than doing a check for the value of gitUrl here. It would be better for that implementation detail to be encapsulated inside of the VersionUpstreamValidator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That actually sounds like a good idea.

@royarg02 royarg02 force-pushed the fluttervalidator branch 2 times, most recently from 0ef7ca3 to 38bb6eb Compare May 27, 2022 12:08
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great!

Copy link
Contributor

Choose a reason for hiding this comment

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

should this be a hint? is it not a legitimate state to be in to be on a non-release branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because I want to nudge users towards hints that might cause flutter upgrade to fail. The tool sets channel unknown if the branch doesn't have an upstream.

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't seem like this message gives the user actionable information, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we recommend the user to reinstall here(and other errors where applicable)?

Copy link
Contributor

Choose a reason for hiding this comment

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

what if the if i'm tracking branch delta from my own mirror? Won't that also resolve to "Unknown"? This seems like a reasonable workflow.

Copy link
Contributor Author

@royarg02 royarg02 Jun 6, 2022

Choose a reason for hiding this comment

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

The tool parses the information from this command for the channel:

final String gitChannel = _runGit(
'git rev-parse --abbrev-ref --symbolic $kGitTrackingUpstream',

and sets 'unknown' if the above returns nothing(or fails), which shouldn't be possible if the current branch is tracking something, be it a remote or a local branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, ok, I assumed we were validating that this was in a known set. Thanks for educating me!

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the assumption here that git describe ... outputted something we can't parse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

@royarg02 royarg02 force-pushed the fluttervalidator branch from 8377c7b to edb657d Compare June 3, 2022 05:43
Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

LGTM

@royarg02
Copy link
Contributor Author

It doesn't seem like this message gives the user actionable information, though.

This is what I have in mind:

  • If upstream repository is a non-standard remote, we show a message to set FLUTTER_GIT_URL to the non-standard remote.
  • If upstream repository is unknown, we display a message to reinstall Flutter.
  • If channel is unknown, we display a message to switch to a release channel using flutter channel(to fix detached HEAD), and if that doesn't work, reinstall Flutter.
  • If frameworkVersion is unknown, we display a message that the tool was unable to resolve version possibly due to local changes, and if is okay to lose changes, reinstall Flutter.

Copy link
Contributor

@Jasguerrero Jasguerrero left a comment

Choose a reason for hiding this comment

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

LGTM

@christopherfujino christopherfujino added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 19, 2022
@auto-submit auto-submit bot merged commit 47b4060 into flutter:master Jun 20, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 21, 2022
@royarg02 royarg02 deleted the fluttervalidator branch August 4, 2022 17:48
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tool] Doctor should warn on non-ideal git configuration of the Flutter repo

3 participants