Skip to content

[flutter_tools] Fix package URI resolution in --experimental-faster-testing - #190875

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
bkonyi:issue-190784
Aug 11, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
bkonyi:issue-190784

Conversation

@bkonyi

@bkonyi bkonyi commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

When --experimental-faster-testing is enabled, the runner reads the package config using Uri.file(flutterProject.directory.path) which lacked a trailing slash. This caused relative resolution (using ../) to resolve to the parent of the project directory (one level too high).

This fix replaces the base URI with packageConfigFile.uri which correctly resolves. A regression test verifying the output rootUri was added.

Fixes #190784

Pre-launch Checklist

…esting

When `--experimental-faster-testing` is enabled, the runner reads the package config using `Uri.file(flutterProject.directory.path)` which lacked a trailing slash. This caused relative resolution (using `../`) to resolve to the parent of the project directory (one level too high).

This fix replaces the base URI with `packageConfigFile.uri` which correctly resolves. A regression test verifying the output `rootUri` was added.

Fixes flutter#190784
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 10, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 10, 2026

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

Copy link
Copy Markdown
Contributor

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 updates the Flutter test runner to parse the package configuration using the URI of the package configuration file itself rather than the project directory path, and adds a test to verify the root URI of the package configuration. The feedback suggests using the absolute URI of the package configuration file to prevent potential resolution failures if the path is relative.

projectPackageConfig = PackageConfig.parseBytes(
packageConfigFile.readAsBytesSync(),
Uri.file(flutterProject.directory.path),
packageConfigFile.uri,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using packageConfigFile.absolute.uri instead of packageConfigFile.uri is safer and more robust. If packageConfigFile is resolved from a relative path, packageConfigFile.uri will also be relative. This can cause PackageConfig.parseBytes to resolve package root URIs as relative URIs, which may lead to resolution failures if the current working directory changes or if other parts of the tool expect absolute URIs. Ensuring the base URI is absolute prevents these potential issues.

Suggested change
packageConfigFile.uri,
packageConfigFile.absolute.uri,

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.

Updated to use packageConfigFile.absolute.uri across all package config parsing calls in this file in commit 1cf6a42.

@bkonyi
bkonyi requested a review from chingjun August 10, 2026 22:12
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 11, 2026
Merged via the queue into flutter:master with commit 05ee849 Aug 11, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--experimental-faster-testing cannot resolve the project's own package: URIs — regression in #169556

2 participants