Skip to content

add dt flutter-bisect cmd - #10017

Open
khanak0509 wants to merge 2 commits into
flutter:masterfrom
khanak0509:add-flutter-bisect-command-9467
Open

khanak0509 wants to merge 2 commits into
flutter:masterfrom
khanak0509:add-flutter-bisect-command-9467

Conversation

@khanak0509

@khanak0509 khanak0509 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #9467

this PR adds dt flutter-bisect so we can find which Flutter SDK commit broke a DevTools test. Right now after a candidate bump you have to manually checkout Flutter commits and re-run the failing test until you find the first bad one.

How I implemented it:
you pass a known-good --from, known-bad --to, and the failing --test. It uses tool/flutter-sdk, verifies that --from passes and --to fails (unless --skip-verify), then binary-searches the commit range with git checkout + flutter test at each midpoint until it finds the first bad commit. When finished it restores flutter-candidate.txt (unless --keep-sdk). Also added --dry-run and unit tests for the binary search helper.

Example:
dt flutter-bisect --from <good> --to <bad> --test path/to/failing_test.dart

Pre-launch Checklist

General 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 the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I updated/added relevant documentation (doc comments with ///).

Issues checklist

Tests checklist

  • I added new tests to check the change I am making...
  • OR there is a reason for not adding tests, which I explained in the PR description.

AI-tooling checklist

  • I did not use any AI tooling in creating this PR.
  • OR I did use AI tooling, and...
    • I read the AI contributions guidelines and agree to follow them.
    • I reviewed all AI-generated code before opening this PR.
    • I understand and am able to discuss the code in this PR.
    • I have verifed the accuracy of any AI-generated text included in the PR description.
    • I commit to verifying the accuracy of any AI-generated code or text that I upload in response to review comments.

Feature-change checklist

  • This PR does not change the DevTools UI or behavior and...
    • I added the release-notes-not-required label or left a comment requesting the label be added.
  • OR this PR does change the DevTools UI or behavior and...
    • I added an entry to packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.
    • I included before/after screenshots and/or a GIF demo of the new UI to my PR description.
    • I ran the DevTools app locally to manually verify my changes.

build.yaml badge

If you need help, consider asking for help on Discord.

@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 introduces a new command, dt flutter-bisect, to binary-search Flutter SDK commits and identify the first commit introducing a DevTools test regression. The changes include the command implementation, helper utilities, documentation, and unit tests. Feedback on the implementation suggests escaping dots and adding anchors to the pre-release tag regular expression, wrapping the git fetch command in a try-catch block to handle offline scenarios gracefully, and utilizing a blobless clone (--filter=blob:none) to speed up the initial Flutter repository clone.

const _keepSdkArg = 'keep-sdk';
const _skipVerifyArg = 'skip-verify';

final _flutterPreReleaseTagRegExp = RegExp(r'[0-9]+.[0-9]+.0-[0-9]+.0.pre');

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

[CONCERN] The regular expression uses unescaped dots (.), which match any character instead of literal dots, and lacks start/end anchors (^ and $). This could lead to incorrect matches or partial substring matches. Escaping the dots and adding anchors makes the pattern precise and robust.

Suggested change
final _flutterPreReleaseTagRegExp = RegExp(r'[0-9]+.[0-9]+.0-[0-9]+.0.pre');
final _flutterPreReleaseTagRegExp = RegExp(r'^[0-9]+\.[0-9]+\.0-[0-9]+\.0\.pre$');
References
  1. Categorize maintainability issues or potential bugs as [CONCERN] per the AI Review Protocol. (link)

@khanak0509 khanak0509 Sep 22, 2026 •

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.

leaving this as-is to match update-flutter-sdk.

Comment thread tool/lib/commands/flutter_bisect.dart Outdated
Comment on lines +287 to +295
await processManager.runProcess(
CliCommand.git([
'clone',
'--no-checkout',
'https://github.com/flutter/flutter',
repo.sdkDirectoryName,
]),
workingDirectory: repo.toolDirectoryPath,
);

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

[CONCERN] Cloning the entire Flutter repository history can be extremely slow and consume significant disk space and bandwidth. Since bisecting only requires checking out a few specific revisions, using a blobless clone (--filter=blob:none) will dramatically speed up the initial clone while still allowing arbitrary checkouts on demand.

Suggested change
await processManager.runProcess(
CliCommand.git([
'clone',
'--no-checkout',
'https://github.com/flutter/flutter',
repo.sdkDirectoryName,
]),
workingDirectory: repo.toolDirectoryPath,
);
await processManager.runProcess(
CliCommand.git([
'clone',
'--no-checkout',
'--filter=blob:none',
'https://github.com/flutter/flutter',
repo.sdkDirectoryName,
]),
workingDirectory: repo.toolDirectoryPath,
);
References
  1. Categorize maintainability issues or potential bugs as [CONCERN] per the AI Review Protocol. (link)

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.

i think we can skip for now so we match update-flutter-sdk’s clone. if cold clones are too slow we can do...

@khanak0509

Copy link
Copy Markdown
Contributor Author

Hii @kenzieschmoll, @srawlins this is just a dt infra command can you please add the release-notes-not-required label?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dt command for bisecting a Flutter regression

1 participant