Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

This fixes two issues with the format command's language resolution handling:

  • It was not running pub get in sub-packages, so for the rare case of sub-packages with different min versions than their enclosing package, format behavior was inconsistent, and incorrect in CI where the tree starts clean.
  • It was not detecting stale resolution, which was annoying when formatting locally since it's not uncommon to have last run pub get for some package before the last min SDK bump for that package, causing local formatting to be incorrect. This was especially problematic when doing min SDK bumps for the entire repo after stable releases.

It also fixes the related problem that fetch-deps was not running pub get in sub-packages, which would have prevented the pigeon issue in CI, but not locally. Even with format fixed, we still want everything fetched in fetch-deps.

The parsing does depend on internal implementation details of Dart, but we don't expect those to change frequently, and if it does we can update the detection logic as necessary. The failure mode should either be to throw, which we'll catch during the roll, or to run pub get more than necessary, which would just be an optimization issue rather than a correctness issue.

Includes pigeon format changes, since now CI is enforcing the correct format instead of the incorrect format that was checked in.

Fixes flutter/flutter#178072
Helps with flutter/flutter#176853

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@stuartmorgan-g stuartmorgan-g added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels Nov 6, 2025
@stuartmorgan-g
Copy link
Collaborator Author

CHANGELOG/version override: the format change to a small part of example/lib/main.dart isn't worth publishing for; we can just pick it up during the next normal publish.

}

/// Returns all Dart package folders (e.g., examples) under the given package.
Stream<RepositoryPackage> getSubpackages(RepositoryPackage package,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just drive-by refactoring; this helper being here predates the creation of RepositoryPackage, and that class is a better home for this method (especially since it already has a similar method to find all example apps).

It changed its return from Stream to Iterable to match the existing helper function, and because we don't actually benefit from using Stream.

Copy link

@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 improves the format and fetch-deps commands to correctly handle language versions in packages and their sub-packages. The changes ensure that pub get is run when needed, fixing inconsistencies in formatting, especially in CI environments. The logic for detecting stale language version resolution has been added, which is a great improvement for local development workflows. The related refactoring to move getSubpackages into RepositoryPackage and make it synchronous simplifies the code. The included tests for the new logic are comprehensive. I have one suggestion to make the SDK version constraint handling more robust.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 6, 2025
@auto-submit auto-submit bot merged commit b4decd8 into flutter:main Nov 6, 2025
80 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 7, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Nov 7, 2025
flutter/packages@f13bad3...3caa48b

2025-11-06 [email protected] [go_router]
Migrates test for leak testing (flutter/packages#10276)
2025-11-06 [email protected] Run tests on macOS 15.5 or 15.7
(flutter/packages#10336)
2025-11-06 [email protected] [pigeon] Encode custom enum as
long in Kotlin generator (flutter/packages#10085)
2025-11-06 [email protected] [tool] Ensure that all packages
format with correct language version (flutter/packages#10374)
2025-11-06 [email protected] Roll Flutter from
e5d5c01 to c5e809a (29 revisions) (flutter/packages#10369)

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-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
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
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 override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: pigeon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[packages] Run pub get in all subpackages before formatting

2 participants