Skip to content

feat(wait-action): add wait_for_tests shared GitHub Action and CLI tool#5097

Merged
jtmcdole merged 7 commits into
flutter:mainfrom
jtmcdole:wait-action
Jul 1, 2026
Merged

feat(wait-action): add wait_for_tests shared GitHub Action and CLI tool#5097
jtmcdole merged 7 commits into
flutter:mainfrom
jtmcdole:wait-action

Conversation

@jtmcdole

@jtmcdole jtmcdole commented Jul 1, 2026

Copy link
Copy Markdown
Member

Add the wait_for_tests action package to the Cocoon workspace. This will allow flutter/flutter and flutter/packages to wait on Cocoon scheduled tests to complete. This is made more important with the upcoming Universal Presubmits on the flutter dashboard.

Key additions:

  • Configured the GitHub Action workflow definition in action.yml.
  • Created the wait_for_tests CLI tool in bin/wait_for_tests.dart supporting environment-variable or command-line arguments
  • Implemented robust polling, status clamping (between 30 and 600 seconds), and evaluation logic in lib/wait_for_tests.dart using the shared TaskStatus from package:cocoon_common.
  • Added tests.
  • Registered the package in the workspace root pubspec.yaml.

Add the wait_for_tests package to the Cocoon workspace. This package provides a shared GitHub Action and a companion CLI tool written in Dart that polls the Cocoon API until requested pre-submit tests are complete.

Key additions:
- Created the wait_for_tests CLI tool in `bin/wait_for_tests.dart` supporting environment-variable or command-line arguments, strict 40-character hexadecimal SHA validation, and help outputs.
- Implemented robust polling, status clamping (between 30 and 600 seconds), and evaluation logic in `lib/wait_for_tests.dart` using the shared `TaskStatus` from `package:cocoon_common`.
- Configured the GitHub Action workflow definition in `action.yml`.
- Added comprehensive unit tests in `test/wait_for_tests_test.dart` and integration/CLI tests in `test/bin_test.dart` covering API error handling, interval clamping, and argument parsing.
- Registered the package in the workspace root `pubspec.yaml`.
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jul 1, 2026
@jtmcdole jtmcdole requested a review from ievdokdm July 1, 2026 19:13
@jtmcdole jtmcdole requested a review from zanderso July 1, 2026 19:14
@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@jtmcdole

jtmcdole commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown

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 Dart package, wait_for_tests, which functions as a shared GitHub Action to poll the Cocoon API and wait for pre-submit tests to complete. The feedback focuses on improving the robustness of the tool. Key suggestions include handling potential runtime TypeErrors when parsing the API response, immediately failing on non-transient 4xx HTTP errors to save CI minutes, adding a timeout to the HTTP request to prevent indefinite hangs, and validating the repository slug format during parsing.

Comment thread packages/wait_for_tests/lib/wait_for_tests.dart Outdated
Comment thread packages/wait_for_tests/lib/wait_for_tests.dart
Comment thread packages/wait_for_tests/lib/wait_for_tests.dart Outdated
Comment thread packages/wait_for_tests/lib/wait_for_tests.dart Outdated
Comment thread packages/wait_for_tests/bin/wait_for_tests.dart Outdated
@jtmcdole

jtmcdole commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Switching to rpc_model.PresubmitGuardResponse

Comment thread packages/wait_for_tests/lib/wait_for_tests.dart Outdated
Comment thread packages/wait_for_tests/lib/wait_for_tests.dart
jtmcdole and others added 3 commits July 1, 2026 15:49
…h resolution

- Migrate response parsing in the polling loop to use the typed PresubmitGuardResponse model instead of manual Map parsing.
- Refactor stage job collection construction using modern Dart collection spread operators.
- Fix high CPU hammering bug by sleeping properly when receiving empty or malformed JSON.
- Improve CLI test robustness by dynamically resolving wait_for_tests.dart path, allowing test suite to run successfully from either package or workspace root.
- Ensure 0 warnings or errors on static analysis.
404: retry because CICD might not have been created yet!
while loop handling
level shifting

@ievdokdm ievdokdm 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.

LGTM

@jtmcdole jtmcdole merged commit 25ad54e into flutter:main Jul 1, 2026
26 checks passed
@jtmcdole

jtmcdole commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

I'll work on the tree-analyzer on monday!

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

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants