Repository navigation
[camera_android_camerax] Correct pre-push skill version validation logic - #12371
Conversation
|
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. |
There was a problem hiding this comment.
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.
| '$upstream/main~1..$upstream/main', | ||
| '--name-only', | ||
| ], workingDirectory: packageDir.path); | ||
| if (diffResult.exitCode != 0) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>[ |
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
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.
| // 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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++) { |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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}') |
There was a problem hiding this comment.
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.
|
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. |
…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
Corrects the version and merge conflict validation logic in the
pre-pushskill 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:
setup_behind_upstream.sh)upstream/main, stop immediately without updating release infoupstream/main, halted immediately with# NO, you are not ready to push, and leftpubspec.yamlandCHANGELOG.mdunmodified.setup_behind_upstream_conflict.dart)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
[shared_preferences]///).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-assistbot 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
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