Skip to content

feat(app_dart): fall back to ciStaging in GetPresubmitGuard when no guards found#5094

Merged
auto-submit[bot] merged 3 commits into
mainfrom
check-run-list
Jun 30, 2026
Merged

feat(app_dart): fall back to ciStaging in GetPresubmitGuard when no guards found#5094
auto-submit[bot] merged 3 commits into
mainfrom
check-run-list

Conversation

@jtmcdole

Copy link
Copy Markdown
Member

In the Unified Check Run flow, if no modern UnifiedCheckRun presubmit guards are found for a commit, retrieve the legacy ciStaging documents as a fallback. This will make waiting for check-runs to pass universal.

  • Implement CiStaging.getCiStagingForCommitSha to query staging documents by repository and commit SHA.
  • Refactor GetPresubmitGuard to invoke _getCiStagingFallback when no guards are present.
  • Extract check_run_id from the staging checkRunGuard JSON, and look up pull request and author metadata via PrCheckRuns.
  • Add unit tests verifying ciStaging fallback execution and JSON response structure.
  • Clean up related linter warnings (redundant imports, type annotations, and curly braces).

fixes flutter/flutter#188756

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read the [Flutter Style Guide] recently, and have followed its advice.
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

…guards found

In the Unified Check Run flow, if no modern `UnifiedCheckRun` presubmit
guards are found for a commit, retrieve the legacy `ciStaging` documents
as a fallback. This will make waiting for check-runs to pass universal.

- Implement `CiStaging.getCiStagingForCommitSha` to query staging documents by repository and commit SHA.
- Refactor `GetPresubmitGuard` to invoke `_getCiStagingFallback` when no guards are present.
- Extract `check_run_id` from the staging `checkRunGuard` JSON, and look up pull request and author metadata via `PrCheckRuns`.
- Add unit tests verifying `ciStaging` fallback execution and JSON response structure.
- Clean up related linter warnings (redundant imports, type annotations, and curly braces).
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 30, 2026
@jtmcdole jtmcdole requested a review from ievdokdm June 30, 2026 16:53

@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 implements a fallback mechanism in GetPresubmitGuard to query CiStaging records when no presubmit guards are found. It introduces the getCiStagingForCommitSha query method, maps task conclusions to statuses, and adds corresponding unit tests. Feedback on the changes suggests removing a redundant ciStagings.isNotEmpty check to simplify the code, and replacing DateTime.parse with DateTime.tryParse to prevent potential crashes from malformed timestamps.

Comment thread app_dart/lib/src/request_handlers/get_presubmit_guard.dart
Comment thread app_dart/lib/src/request_handlers/get_presubmit_guard.dart Outdated
Comment thread app_dart/lib/src/request_handlers/get_presubmit_guard.dart Outdated
@jtmcdole jtmcdole requested a review from ievdokdm June 30, 2026 18:32
@jtmcdole jtmcdole added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App. and removed CICD Run CI/CD labels Jun 30, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App. label Jun 30, 2026
@auto-submit

auto-submit Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/cocoon/5094, because This PR has not met approval requirements for merging. Changes were requested by {ievdokdm}, please make the needed changes and resubmit this PR.
The PR author is a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@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

@ievdokdm ievdokdm added the autosubmit Merge PR when tree becomes green via auto submit App. label Jun 30, 2026
@auto-submit auto-submit Bot merged commit e9537ac into main Jun 30, 2026
26 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cocoon: offer fallback for ciStaging to get-presubmit-guard

2 participants