feat(wait-action): add wait_for_tests shared GitHub Action and CLI tool#5097
Conversation
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`.
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
There was a problem hiding this comment.
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.
|
Switching to |
…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
|
I'll work on the tree-analyzer on monday! |
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:
action.yml.bin/wait_for_tests.dartsupporting environment-variable or command-line argumentslib/wait_for_tests.dartusing the sharedTaskStatusfrompackage:cocoon_common.pubspec.yaml.