Skip to content

Conversation

@matanlurey
Copy link
Contributor

Closes #173904.

It's not clear to me how git describe --tags HEAD ever ... worked to determine a fallback. From what I can tell, the intent was to use the latest (newest? closest?) tag as the base version, and then append -{commitCount}-{shortHash} as the fallback version number when on master (or any non-published branch).

So, I rewrote the implementation, unfortunately with 4 separate calls out to git ... instead of a single one.

There are 20+ tests that fail as a result of this change, mostly because they make specific expectations around git describe being invoked, and of course that is no longer the case - putting those aside, I'd like to double check that:

  1. I understand what the original command was intending to do
  2. We like the output of the updated command
  3. ... we either are okay with the implementation, or have an alternative in mind (I'm no git master)

Wdyt?

At this commit:

$ flutter-dev --version                                                            
Flutter 3.36.0-1.0.pre-170 • channel [user-branch] • https://github.com/matanlurey/flutter
Framework • revision 250381a185 (5 minutes ago) • 2025-08-19 18:57:36 -0700
Engine • hash f278b0aa3b8c6732ab636563eb8e896c35fc9c79 (revision 9ac4facf7e) (2 hours ago) • 2025-08-19 23:42:28.000Z
Tools • Dart 3.10.0 (build 3.10.0-115.0.dev) • DevTools 2.49.0

/cc @zanderso @jmagman for historics.

@matanlurey matanlurey requested review from bkonyi and jtmcdole August 20, 2025 02:02
@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 20, 2025
@zanderso
Copy link
Member

(1) Yes, I think you have it right. When the original logic was written, tagging happened much more frequently since there was a tag for every roll to g3. That was the 'dev' channel, which no longer exists.

(2) The new output is definitely less confusing! AFAIK that string is not load bearing, and it's mostly just us maintainers on master channel.

(3) Only concern from me about the implementation is whether the additional synchronous calls out to git impact tool startup time (or any other operation where we compute the version). Maybe Gemini can suggest a shorter sequence of commands? =)

@mdebbar
Copy link
Contributor

mdebbar commented Aug 20, 2025

/gemini review

Copy link
Contributor

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

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 replaces git describe with a more explicit sequence of git commands to resolve the framework version. This change improves the logic by using the latest version tag instead of the nearest one. My feedback focuses on improving the correctness and robustness of the new implementation. I've pointed out a potential issue with the commit counting logic and suggested adding checks to handle cases where git commands might fail, which will prevent unnecessary errors and process calls. With these changes, the version resolution will be more reliable.

@bkonyi
Copy link
Contributor

bkonyi commented Aug 20, 2025

This LGTM, although I'm also no Git master and have no idea if there's a better way to do this.

@matanlurey matanlurey marked this pull request as ready for review August 20, 2025 17:53
@matanlurey
Copy link
Contributor Author

I was able to reduce the number of git calls by one, and updated tests. PTAL @bkonyi @jtmcdole

@matanlurey
Copy link
Contributor Author

@stuartmorgan-g brings up a good point (in another chat/thread):

Well, without being able to jump to before a branch point all I know is it worked at head on my machine. If you gave me a version that just always picked the numerically highest tag in the repo it would have passed the manual testing I did.

@matanlurey:

I mean you bring up a point - that is essentially what it does - and I think if you did checkout an older commit it would still pretend to be the latest tag. I don't know if there is a way to say, given a ref, give me the closest published tag that my ref is otherwise not associated with.

Maybe there is a way to say, "list all tags older than my current commit" - let me take a look

@matanlurey
Copy link
Contributor Author

Re-thinking this. Will send out for review again when ready.

@matanlurey matanlurey marked this pull request as draft August 20, 2025 19:56
@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@matanlurey matanlurey changed the title Use an alternative to git describe for master version resolution Master version resolution: Use .../flutter-master.version instead of git describe Aug 20, 2025
@matanlurey
Copy link
Contributor Author

Ok here is my attempt based on some offline discussion with @stuartmorgan-g and others.

It's a lot less hacky, but will require a single manual step by the release team. If we like this change, I'll modify the release team documentation and let the team know (in practice I think this is fine, and we could even help automate it at a future point).

@matanlurey matanlurey marked this pull request as ready for review August 20, 2025 23:25
@matanlurey
Copy link
Contributor Author

Ugh, I missed something.

My original workaround ("use the highest tag number") only kicks in if a commit is so new it's not part of any release. That means, it was valid. I'm going to revert back to that point as it in general was more automated.

@matanlurey matanlurey force-pushed the patch-master-version branch from 68ca683 to 966f99b Compare August 20, 2025 23:48
@matanlurey matanlurey changed the title Master version resolution: Use .../flutter-master.version instead of git describe Use an alternative to git describe for master version resolution Aug 21, 2025
@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 21, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Aug 21, 2025
Merged via the queue into flutter:master with commit e45fd36 Aug 21, 2025
146 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 22, 2025
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 22, 2025
…lutter#174088)

Closes flutter#173904.

It's not clear to me how `git describe --tags HEAD` ever ... worked to
determine a fallback. From what I can tell, the _intent_ was to use the
latest (newest? closest?) tag as the base version, and then append
`-{commitCount}-{shortHash}` as the fallback version number when on
`master` (or any non-published branch).

So, I rewrote the implementation, unfortunately with 4 separate calls
out to `git ...` instead of a single one.

There are 20+ tests that fail as a result of this change, mostly because
they make specific expectations around `git describe` being invoked, and
of course that is no longer the case - putting those aside, I'd like to
double check that:

1. I understand what the original command was _intending_ to do
2. We like the _output_ of the updated command
3. ... we either are okay with the implementation, or have an
alternative in mind (I'm no `git` master)

Wdyt?

At this commit:
```sh
$ flutter-dev --version                                                            
Flutter 3.36.0-1.0.pre-170 • channel [user-branch] • https://github.com/matanlurey/flutter
Framework • revision 250381a (5 minutes ago) • 2025-08-19 18:57:36 -0700
Engine • hash f278b0aa3b8c6732ab636563eb8e896c35fc9c79 (revision 9ac4fac) (2 hours ago) • 2025-08-19 23:42:28.000Z
Tools • Dart 3.10.0 (build 3.10.0-115.0.dev) • DevTools 2.49.0
```

/cc @zanderso @jmagman for historics.
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 22, 2025
…lutter#174088)

Closes flutter#173904.

It's not clear to me how `git describe --tags HEAD` ever ... worked to
determine a fallback. From what I can tell, the _intent_ was to use the
latest (newest? closest?) tag as the base version, and then append
`-{commitCount}-{shortHash}` as the fallback version number when on
`master` (or any non-published branch).

So, I rewrote the implementation, unfortunately with 4 separate calls
out to `git ...` instead of a single one.

There are 20+ tests that fail as a result of this change, mostly because
they make specific expectations around `git describe` being invoked, and
of course that is no longer the case - putting those aside, I'd like to
double check that:

1. I understand what the original command was _intending_ to do
2. We like the _output_ of the updated command
3. ... we either are okay with the implementation, or have an
alternative in mind (I'm no `git` master)

Wdyt?

At this commit:
```sh
$ flutter-dev --version                                                            
Flutter 3.36.0-1.0.pre-170 • channel [user-branch] • https://github.com/matanlurey/flutter
Framework • revision 250381a (5 minutes ago) • 2025-08-19 18:57:36 -0700
Engine • hash f278b0aa3b8c6732ab636563eb8e896c35fc9c79 (revision 9ac4fac) (2 hours ago) • 2025-08-19 23:42:28.000Z
Tools • Dart 3.10.0 (build 3.10.0-115.0.dev) • DevTools 2.49.0
```

/cc @zanderso @jmagman for historics.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 22, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Aug 22, 2025
flutter/flutter@d2ac021...26bb33b

2025-08-22 [email protected] [HCPP] Clean up overlay layer when last frame had overlay content and current doesn't (flutter/flutter#173881)
2025-08-22 [email protected] Migrate more files to use WidgetStateProperty (flutter/flutter#174176)
2025-08-22 [email protected] Roll Skia from 75fef9fb3ed7 to cb15e1452399 (1 revision) (flutter/flutter#174255)
2025-08-22 [email protected] Roll Skia from 006241a7fbe1 to 75fef9fb3ed7 (1 revision) (flutter/flutter#174254)
2025-08-22 [email protected] Skip wasm build when dry run is disabled and --wasm is not specified. (flutter/flutter#174184)
2025-08-22 [email protected] Roll Dart SDK from c153c5259e62 to 4f9623f024ab (2 revisions) (flutter/flutter#174250)
2025-08-22 [email protected] Roll Skia from d70087007490 to 006241a7fbe1 (2 revisions) (flutter/flutter#174252)
2025-08-22 [email protected] Roll Skia from c09589f7ca69 to d70087007490 (22 revisions) (flutter/flutter#174245)
2025-08-21 [email protected] [ Widget Preview ] Add regression test for issue 173895 (flutter/flutter#174037)
2025-08-21 [email protected] Improve xcresult comment and naming (flutter/flutter#173129)
2025-08-21 [email protected] Update `.gemini/styleguide.md` to encourage `master`-only (flutter/flutter#174065)
2025-08-21 [email protected] [ Widget Preview ] Fix crash when attempting to provide non-const params to a `Preview` (flutter/flutter#174242)
2025-08-21 [email protected] Roll Skia from 721e68fe652a to c09589f7ca69 (12 revisions) (flutter/flutter#174162)
2025-08-21 [email protected] Roll Dart SDK from 0d0a0c394381 to c153c5259e62 (7 revisions) (flutter/flutter#174235)
2025-08-21 [email protected] [ Tool ] Throw `ToolExit` when asset entries use absolute paths (flutter/flutter#174230)
2025-08-21 [email protected] Roll Dart SDK from 0d0a0c394381 to c153c5259e62 (7 revisions) (flutter/flutter#174227)
2025-08-21 [email protected] [ Tool ] Cleanup widget preview and frontend server shutdown (flutter/flutter#173863)
2025-08-21 [email protected] Use an alternative to `git describe` for `master` version resolution (flutter/flutter#174088)
2025-08-21 [email protected] Report a correct display ID in the window metrics event on win32 (flutter/flutter#174156)
2025-08-21 [email protected] Revert "Update the AccessibilityPlugin::Announce method to account fo… (flutter/flutter#174223)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
…lutter#174088)

Closes flutter#173904.

It's not clear to me how `git describe --tags HEAD` ever ... worked to
determine a fallback. From what I can tell, the _intent_ was to use the
latest (newest? closest?) tag as the base version, and then append
`-{commitCount}-{shortHash}` as the fallback version number when on
`master` (or any non-published branch).

So, I rewrote the implementation, unfortunately with 4 separate calls
out to `git ...` instead of a single one.

There are 20+ tests that fail as a result of this change, mostly because
they make specific expectations around `git describe` being invoked, and
of course that is no longer the case - putting those aside, I'd like to
double check that:

1. I understand what the original command was _intending_ to do
2. We like the _output_ of the updated command
3. ... we either are okay with the implementation, or have an
alternative in mind (I'm no `git` master)

Wdyt?

At this commit:
```sh
$ flutter-dev --version                                                            
Flutter 3.36.0-1.0.pre-170 • channel [user-branch] • https://github.com/matanlurey/flutter
Framework • revision 250381a (5 minutes ago) • 2025-08-19 18:57:36 -0700
Engine • hash f278b0aa3b8c6732ab636563eb8e896c35fc9c79 (revision 9ac4fac) (2 hours ago) • 2025-08-19 23:42:28.000Z
Tools • Dart 3.10.0 (build 3.10.0-115.0.dev) • DevTools 2.49.0
```

/cc @zanderso @jmagman for historics.
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
…lutter#174088)

Closes flutter#173904.

It's not clear to me how `git describe --tags HEAD` ever ... worked to
determine a fallback. From what I can tell, the _intent_ was to use the
latest (newest? closest?) tag as the base version, and then append
`-{commitCount}-{shortHash}` as the fallback version number when on
`master` (or any non-published branch).

So, I rewrote the implementation, unfortunately with 4 separate calls
out to `git ...` instead of a single one.

There are 20+ tests that fail as a result of this change, mostly because
they make specific expectations around `git describe` being invoked, and
of course that is no longer the case - putting those aside, I'd like to
double check that:

1. I understand what the original command was _intending_ to do
2. We like the _output_ of the updated command
3. ... we either are okay with the implementation, or have an
alternative in mind (I'm no `git` master)

Wdyt?

At this commit:
```sh
$ flutter-dev --version                                                            
Flutter 3.36.0-1.0.pre-170 • channel [user-branch] • https://github.com/matanlurey/flutter
Framework • revision 250381a (5 minutes ago) • 2025-08-19 18:57:36 -0700
Engine • hash f278b0aa3b8c6732ab636563eb8e896c35fc9c79 (revision 9ac4fac) (2 hours ago) • 2025-08-19 23:42:28.000Z
Tools • Dart 3.10.0 (build 3.10.0-115.0.dev) • DevTools 2.49.0
```

/cc @zanderso @jmagman for historics.
Jaineel-Mamtora pushed a commit to Jaineel-Mamtora/flutter_forked that referenced this pull request Sep 24, 2025
…lutter#174088)

Closes flutter#173904.

It's not clear to me how `git describe --tags HEAD` ever ... worked to
determine a fallback. From what I can tell, the _intent_ was to use the
latest (newest? closest?) tag as the base version, and then append
`-{commitCount}-{shortHash}` as the fallback version number when on
`master` (or any non-published branch).

So, I rewrote the implementation, unfortunately with 4 separate calls
out to `git ...` instead of a single one.

There are 20+ tests that fail as a result of this change, mostly because
they make specific expectations around `git describe` being invoked, and
of course that is no longer the case - putting those aside, I'd like to
double check that:

1. I understand what the original command was _intending_ to do
2. We like the _output_ of the updated command
3. ... we either are okay with the implementation, or have an
alternative in mind (I'm no `git` master)

Wdyt?

At this commit:
```sh
$ flutter-dev --version                                                            
Flutter 3.36.0-1.0.pre-170 • channel [user-branch] • https://github.com/matanlurey/flutter
Framework • revision 250381a (5 minutes ago) • 2025-08-19 18:57:36 -0700
Engine • hash f278b0aa3b8c6732ab636563eb8e896c35fc9c79 (revision 9ac4fac) (2 hours ago) • 2025-08-19 23:42:28.000Z
Tools • Dart 3.10.0 (build 3.10.0-115.0.dev) • DevTools 2.49.0
```

/cc @zanderso @jmagman for historics.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
…lutter#174088)

Closes flutter#173904.

It's not clear to me how `git describe --tags HEAD` ever ... worked to
determine a fallback. From what I can tell, the _intent_ was to use the
latest (newest? closest?) tag as the base version, and then append
`-{commitCount}-{shortHash}` as the fallback version number when on
`master` (or any non-published branch).

So, I rewrote the implementation, unfortunately with 4 separate calls
out to `git ...` instead of a single one.

There are 20+ tests that fail as a result of this change, mostly because
they make specific expectations around `git describe` being invoked, and
of course that is no longer the case - putting those aside, I'd like to
double check that:

1. I understand what the original command was _intending_ to do
2. We like the _output_ of the updated command
3. ... we either are okay with the implementation, or have an
alternative in mind (I'm no `git` master)

Wdyt?

At this commit:
```sh
$ flutter-dev --version                                                            
Flutter 3.36.0-1.0.pre-170 • channel [user-branch] • https://github.com/matanlurey/flutter
Framework • revision 250381a (5 minutes ago) • 2025-08-19 18:57:36 -0700
Engine • hash f278b0aa3b8c6732ab636563eb8e896c35fc9c79 (revision 9ac4fac) (2 hours ago) • 2025-08-19 23:42:28.000Z
Tools • Dart 3.10.0 (build 3.10.0-115.0.dev) • DevTools 2.49.0
```

/cc @zanderso @jmagman for historics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

Flutter stable is 3.35.1 while main is 3.33.0-1.0.pre-1446

5 participants