Sitelet https://github.com/flutter/packages/pull/12371
Skip to content

[camera_android_camerax] Correct pre-push skill version validation logic - #12371

Merged
auto-submit[bot] merged 22 commits into
flutter:mainfrom
camsim99:cos_version
Sep 30, 2026
Merged

auto-submit[bot] merged 22 commits into
flutter:mainfrom
camsim99:cos_version

Conversation

@camsim99

@camsim99 camsim99 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Corrects the version and merge conflict validation logic in the pre-push skill to compare the local branch against the upstream branch. If the merge conflict check fails, then the skill immediately reports that the code is not ready to push now.

Also, adds an eval to ensure this update works as expected. Result of running it:

Eval ID Scenario Expected Outcome Result Justification
1 Behind Upstream (setup_behind_upstream.sh) Detect branch is behind upstream/main, stop immediately without updating release info PASS Checked merge-base against upstream/main, halted immediately with # NO, you are not ready to push, and left pubspec.yaml and CHANGELOG.md unmodified.
2 Behind Upstream with Conflicts (setup_behind_upstream_conflict.dart) Detect that the branch is behind the upstream repository PASS Detected that the branch is behind the upstream repository, Ran git merge-tree and detected merge conflicts (CONFLICT (content): Merge conflict in .ci/flutter_master.version), Stopped immediately without running subsequent checks, Output # NO, you are not ready to push. and provided actionable instructions on how to resolve conflicts before pushing

Ideally #12369 lands first so I can update the references of origin to upstream.


Follow up from one-shot attempt #12302. See go/flutter-project-one-shot for more information on the project.

Pre-Review Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

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

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 4, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@camsim99 camsim99 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 Aug 4, 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 pre-push skill documentation and evaluation scripts to use upstream/main instead of origin/main for branch comparisons, and introduces new evaluation test cases and setup scripts to verify the skill's behavior. The feedback suggests fetching with a depth of at least 2 in setup_behind_upstream.sh to prevent failures in shallow-clone environments, and updating comments in the setup scripts to consistently reference upstream/main instead of origin/main.

@camsim99
camsim99 requested a review from reidbaker August 5, 2026 17:40
Comment thread packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md Outdated
@camsim99
camsim99 requested a review from reidbaker August 13, 2026 19:37
'$upstream/main~1..$upstream/main',
'--name-only',
], workingDirectory: packageDir.path);
if (diffResult.exitCode != 0) {

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.

There are probably corner cases here around empty commits or commits that modify other packages etc. I am not sure how much time we want to spend on those usecases before landing this pr.

Maybe have your agent brainstorm in specifically this areas and see if there are any non complex changes you can make to handle the more likely set of changes.

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.

The agent decided to go back 10 commits rather than 2 for greater chances of finding a conflict and added a fallback for specifically filtering for a modified file by looking upstream and adds another change to a file to ensure a modified file is picked up to begin with. PTAL

exit(1);
}

final ProcessResult commitResult = await Process.run('git', <String>[

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.

nit and not blocking for this pr. If this test data code folder grows we should probably extract some of these to shared code.

"expected_chat_output": [
"The agent detected that the branch is behind the upstream main branch.",
"The agent verified that there are no merge conflicts with the upstream main branch.",
"The agent warned the user that the branch must be pulled or merged before pushing.",

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.

This line and line 16 are the only lines that actually have expections against chat output. The rest need to move to expected repo state.

@camsim99
camsim99 requested a review from reidbaker August 19, 2026 17:33
@camsim99
camsim99 requested a review from reidbaker August 20, 2026 16:33
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: avoid_print

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.

Ignore for file is something agents usually do and it normally an codesmell. Confirm you are ok with it and or there is not better alternative.

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.

to the point of I am considering banning ignore_for_file in the codebase entirely it happens so often and is so likely to be wrong.

'remote',
'-v',
], workingDirectory: workingDirectory);
if (result.exitCode != 0) {

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.

Can you describe an error we would get from git remote -v where an error code means that we should return "upstream"?

/// conflicts with the latest changes on upstream/main, and verifies that
/// pre-push-skill detects the conflict and stops immediately.
void main() async {
// The root of the packages directory.

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.

nonblocking nit: Can you document what directory this is suppose to be?

// 2. Find a modified file in recent commits of upstream/main that exists in the repo
print('Finding modified file in recent upstream commits...');
String? fileToConflict;
for (var i = 1; i <= 5; i++) {

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.

Can you add a comment for why we are looping 5 times?

final ProcessResult diffResult = await Process.run('git', <String>[
'diff',
'--name-only',
'--diff-filter=M',

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.

can/should diff-filter include a filter for commits that have modified the package we are interested in?

'--diff-filter=M',
'$upstream/main~$i..$upstream/main',
], workingDirectory: repoRoot.path);
if (diffResult.exitCode == 0) {

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.

instead of doing this logic inside the if on the good case can you check for the bad case, return out early and then let this code be after the bad case?

import 'dart:io';

/// Detects the remote name pointing to the main flutter/packages repository.
Future<String> getUpstreamRemote(String workingDirectory) async {

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.

I am open to the argument that it is out of scope especially because you are just trying to write good evals for your good skill updates. BUT, this appears to be duplicate code and not super simple duplicate code. Lets figure out how to share code or maybe land your skill changes and keep working on the evals.

```bash
git fetch origin main
git merge-base --is-ancestor origin/main HEAD
UPSTREAM_PREPUSH=$(git remote -v | grep 'flutter/packages' | head -n 1 | awk '{print $1}')

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.

Nonblocking. These are fine for now. I think there is a level of complexity where we would want the bash commands to instead run scripts from the skills directory. One of the advantages is we could have the evals "mock" the output of the script and throw a non zero exit code then behave as if there is a conflict or we could verify that the script was actually run. Eventually if this part is slow we might even build in caching to the script if we wanted.

@camsim99
camsim99 requested a review from reidbaker September 2, 2026 19:25
@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit

auto-submit Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12371, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@camsim99 camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 30, 2026
@auto-submit
auto-submit Bot merged commit d4fb76a into flutter:main Sep 30, 2026
13 checks passed
jesswrd pushed a commit to jesswrd/flutter that referenced this pull request Oct 1, 2026
…er#193641)

flutter/packages@0ba9a82...d5ec6db

2026-10-01 faheemabbas766@gmail.com [tool] Enforce README package table
order (flutter/packages#12316)
2026-09-30 jessiewong401@gmail.com [various] Allow plugin example apps
to build and test on JDK 25 (flutter/packages#13031)
2026-09-30 149176071+m1roxx@users.noreply.github.com [go_router] Expose
Navigator clipBehavior on ShellRoute and StatefulShellBranch
(flutter/packages#12646)
2026-09-30 stuartmorgan@google.com [google_maps_flutter] Convert unit
tests to Kotlin (flutter/packages#13072)
2026-09-30 36861262+QuncCccccc@users.noreply.github.com [material_ui]
Migrate M3 ListTile template to use new gen_defaults
(flutter/packages#13056)
2026-09-30 15619084+vashworth@users.noreply.github.com Allow tests to
use macOS 15.7 or macOS 26.6 (flutter/packages#13007)
2026-09-30 43054281+camsim99@users.noreply.github.com
[camera_android_camerax] Fix exposure offset setting error thrown when
canceled by a new request (flutter/packages#12582)
2026-09-30 engine-flutter-autoroll@skia.org Roll Flutter from
55b8f88 to d649d2b (27 revisions) (flutter/packages#13080)
2026-09-30 36861262+QuncCccccc@users.noreply.github.com [material_ui]
Migrate M3 InputDecorator template to use new gen_defaults
(flutter/packages#13024)
2026-09-30 tarrinneal@gmail.com [pigeon] Fix JNI/FFI typed data memory
lifetime bugs and update docs (flutter/packages#13061)
2026-09-30 43054281+camsim99@users.noreply.github.com
[camera_android_camerax] Correct `pre-push` skill version validation
logic (flutter/packages#12371)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com 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 CICD Run CI/CD 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: camera

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants