Skip to content

find_commit.dart hardcodes master branch #115476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cbracken opened this issue Nov 16, 2022 · 12 comments
Closed

find_commit.dart hardcodes master branch #115476

cbracken opened this issue Nov 16, 2022 · 12 comments
Labels
c: crash Stack traces logged to the console team-infra Owned by Infrastructure team

Comments

@cbracken
Copy link
Member

cbracken commented Nov 16, 2022

When looking up git commits, find_commit.dart uses a git log invocation here:

return git(secondaryRepoDirectory, <String>[
'log',
'--format=%H',
'--until=${anchor.timestamp.toIso8601String()}',
'--max-count=1',
secondaryBranch,
'--',
]);

This is called from here:

print(findCommit(
primaryRepoDirectory: primaryRepo,
primaryBranch: git(primaryRepo, <String>['rev-parse', '--abbrev-ref', 'HEAD']).trim(),
primaryTrunk: 'master',
secondaryRepoDirectory: secondaryRepo,
secondaryBranch: 'master',
).trim());

Since we hardcode master as both the primary and secondary repo branches, it will fail for repos that have only a main branch and no master, such as flutter/cocoon.

See example failure here:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8797370543676737825/+/u/Customer_testing/customer_testing/test_stderr

Related, but we should probably fail whichever tools are using find_commit.dart if the lookup fails. In the log above it looks like even though the lookup fails, we continue on and run the tests anyway:

git -C ../../bin/cache/pkg/tests checkout
dart --enable-asserts run_tests.dart

Note the lack of SHA in the checkout command, which I presume is meant to be there.

@cbracken cbracken added c: crash Stack traces logged to the console team-infra Owned by Infrastructure team labels Nov 16, 2022
@cbracken
Copy link
Member Author

/cc @Hangyujin who spotted this in her patch's presubmits.

@ricardoamador
Copy link
Contributor

@HansMuller Can you reassign this please?

@keyonghan keyonghan added framework flutter/packages/flutter repository. See also f: labels. passed secondary triage labels Nov 17, 2022
@HansMuller HansMuller added the P1 label Nov 18, 2022
@HansMuller
Copy link
Contributor

@ricardoamador - not my area

@godofredoc - this issue is preventing us from landing an approved and time-critical PR

@HansMuller HansMuller removed the framework flutter/packages/flutter repository. See also f: labels. label Nov 18, 2022
@jmagman
Copy link
Member

jmagman commented Nov 18, 2022

The find_commit logic is old, and hasn't cocoon been missing a master branch for awhile?

Are you sure the real failure isn't the new analysis issues coming from flutter_cocoon?

|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • lib/build_dashboard_page.dart:436:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • lib/build_dashboard_page.dart:436:23 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • lib/index_page.dart:60:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • lib/index_page.dart:60:23 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • test/navigation_drawer_test.dart:30:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • test/navigation_drawer_test.dart:30:17 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • test/navigation_drawer_test.dart:48:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • test/navigation_drawer_test.dart:48:23 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • test/navigation_drawer_test.dart:71:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • test/navigation_drawer_test.dart:71:17 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • test/navigation_drawer_test.dart:87:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • test/navigation_drawer_test.dart:87:17 • missing_required_argument

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8797370543676737825/+/u/Customer_testing/customer_testing/test_stdout

When I run it locally on this PR I also see these, which definitely look related to #113894 (the PR where this is failing).

   info • The import of 'navigation_drawer.dart' is unnecessary because all of the used elements are also provided by the import of
          'package:flutter/material.dart' • lib/build_dashboard_page.dart:12:8 • unnecessary_import
  error • The name 'NavigationDrawer' is defined in the libraries 'package:flutter/src/material/navigation_drawer.dart (via package:flutter/material.dart)'
         and 'package:flutter_dashboard/navigation_drawer.dart' • lib/build_dashboard_page.dart:437:23 • ambiguous_import
   info • The import of 'navigation_drawer.dart' is unnecessary because all of the used elements are also provided by the import of
          'package:flutter/material.dart' • lib/index_page.dart:9:8 • unnecessary_import
  error • The name 'NavigationDrawer' is defined in the libraries 'package:flutter/src/material/navigation_drawer.dart (via package:flutter/material.dart)'
         and 'package:flutter_dashboard/navigation_drawer.dart' • lib/index_page.dart:61:23 • ambiguous_import
   info • The import of 'package:flutter_dashboard/navigation_drawer.dart' is unnecessary because all of the used elements are also provided by the import
          of 'package:flutter/material.dart' • test/navigation_drawer_test.dart:7:8 • unnecessary_import
  error • 'NavigationDrawer' isn't a function • test/navigation_drawer_test.dart:31:17 • invocation_of_non_function
  error • Invalid constant value • test/navigation_drawer_test.dart:31:17 • invalid_constant
  error • The name 'NavigationDrawer' is defined in the libraries 'package:flutter/src/material/navigation_drawer.dart (via package:flutter/material.dart)'
         and 'package:flutter_dashboard/navigation_drawer.dart' • test/navigation_drawer_test.dart:31:17 • ambiguous_import
  error • The name 'NavigationDrawer' is defined in the libraries 'package:flutter/src/material/navigation_drawer.dart (via package:flutter/material.dart)'
         and 'package:flutter_dashboard/navigation_drawer.dart' • test/navigation_drawer_test.dart:49:23 • ambiguous_import
  error • 'NavigationDrawer' isn't a function • test/navigation_drawer_test.dart:72:17 • invocation_of_non_function
  error • Invalid constant value • test/navigation_drawer_test.dart:72:17 • invalid_constant
  error • The name 'NavigationDrawer' is defined in the libraries 'package:flutter/src/material/navigation_drawer.dart (via package:flutter/material.dart)'
         and 'package:flutter_dashboard/navigation_drawer.dart' • test/navigation_drawer_test.dart:72:17 • ambiguous_import
  error • 'NavigationDrawer' isn't a function • test/navigation_drawer_test.dart:88:17 • invocation_of_non_function
  error • Invalid constant value • test/navigation_drawer_test.dart:88:17 • invalid_constant
  error • The name 'NavigationDrawer' is defined in the libraries 'package:flutter/src/material/navigation_drawer.dart (via package:flutter/material.dart)'
         and 'package:flutter_dashboard/navigation_drawer.dart' • test/navigation_drawer_test.dart:88:17 • ambiguous_import

https://github.com/flutter/cocoon/blob/7f0c5689961be85c2d621df52d88c31a29732ee9/dashboard/lib/navigation_drawer.dart#L10

@HansMuller HansMuller removed the P1 label Nov 18, 2022
@HansMuller
Copy link
Contributor

Right and thanks for tracking down the root of the problem! The actual problem is a simple one. The original error logs, https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8797303295761259729/+/u/Customer_testing/customer_testing/test_stdout, completely obscure the problem:

|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • lib/build_dashboard_page.dart:436:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • lib/build_dashboard_page.dart:436:23 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • lib/index_page.dart:60:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • lib/index_page.dart:60:23 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • test/navigation_drawer_test.dart:30:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • test/navigation_drawer_test.dart:30:17 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • test/navigation_drawer_test.dart:48:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • test/navigation_drawer_test.dart:48:23 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • test/navigation_drawer_test.dart:71:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • test/navigation_drawer_test.dart:71:17 • missing_required_argument
|   error • A value of type 'Null' can't be assigned to a parameter of type 'List<Widget>' in a const constructor • test/navigation_drawer_test.dart:87:17 • const_constructor_param_type_mismatch
|   error • The named parameter 'children' is required, but there's no corresponding argument • test/navigation_drawer_test.dart:87:17 • missing_required_argument

@XilaiZhang
Copy link
Contributor

Regarding the git log error in find_commit.dart, we tried fixing it with #119648 . The fix worked in most of the scenarios, but would fail in certain situations (e.g. check runs of #119384) due to possible luci git behavior. The luci git behavior was discussed in https://chat.google.com/room/AAAAc_4rqiI/_k6gi9syHTY and the conclusion was that, we cannot rely on the output of git commands in luci to find out the current branch.

It seems like the root cause of the failure was identified and solved in flutter/cocoon#2313 now?

@flutter-triage-bot flutter-triage-bot bot added the Bot is counting down the days until it unassigns the issue label Nov 25, 2023
@flutter-triage-bot
Copy link

This issue is assigned to @XilaiZhang but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

@ricardoamador
Copy link
Contributor

@XilaiZhang is this still happening?

@XilaiZhang
Copy link
Contributor

Re-reading this thread. It seems like the proposed fix landed in #119648 but it is impossible to handle all scenarios (due to systematic error of luci git)?

@flutter-triage-bot flutter-triage-bot bot removed the Bot is counting down the days until it unassigns the issue label Nov 27, 2023
auto-submit bot pushed a commit that referenced this issue Nov 28, 2023
This will allow Dart Team to run customer tests as part of monorepo and will be a step forward to remove ad_hoc tests.

Bug: dart-lang/sdk#51042
Bug: #115476
caseycrogers pushed a commit to caseycrogers/flutter that referenced this issue Dec 29, 2023
This will allow Dart Team to run customer tests as part of monorepo and will be a step forward to remove ad_hoc tests.

Bug: dart-lang/sdk#51042
Bug: flutter#115476
@flutter-triage-bot flutter-triage-bot bot added the Bot is counting down the days until it unassigns the issue label Apr 1, 2024
@flutter-triage-bot
Copy link

This issue is assigned to @XilaiZhang but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

@flutter-triage-bot
Copy link

This issue was assigned to @XilaiZhang but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.

@flutter-triage-bot flutter-triage-bot bot removed the Bot is counting down the days until it unassigns the issue label May 23, 2024
Copy link

github-actions bot commented Sep 6, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console team-infra Owned by Infrastructure team
Projects
No open projects
Development

No branches or pull requests

8 participants