Skip to content

183602 Fix an issue with updating proper job attempt numbers on re-run#4988

Merged
auto-submit[bot] merged 11 commits into
mainfrom
183602-find-pr-by-sha
Mar 18, 2026
Merged

183602 Fix an issue with updating proper job attempt numbers on re-run#4988
auto-submit[bot] merged 11 commits into
mainfrom
183602-find-pr-by-sha

Conversation

@ievdokdm
Copy link
Copy Markdown
Contributor

@ievdokdm ievdokdm commented Mar 17, 2026

1. Refactored Pull Request Retrieval

  • Updated Handlers: The logic in rerun_all_failed_jobs.dart and rerun_failed_job.dart has been updated to consistently use PrCheckRuns.findPullRequestFor to resolve the pull request via the commit SHA (guard.commitSha), rather than querying by PR number.
  • Fixed Re-run Workflows: Ensured that the handlers fetch the correct active pull request during re-runs and store the proper retry number/attempt information when invoking reScheduleTryBuilds.

2. Removed pull_request_num Field and Cache

  • Model Cleanups: The pull_request_num field was entirely removed from the PrCheckRuns Firestore model, including its related mappings and integration test matchers (_pr_check_run.dart).
  • Removed Methods: Deleted the obsolete findPullRequestCachedForPullRequestNum lookup method from both PrCheckRuns and the Scheduler service. Additionally, removed its related caching tests.

3. Service/Dependencies Cleanup

  • Removed Unused Services: Dropped the previously injected but unused _githubService from scheduler.dart.
  • Code Formatting: Ran standard Dart formatting rules (dart format) to ensure code uniformity in edited files.

4. Test Suite Adjustments

  • Updated Mocks & Setup: rerun_all_failed_jobs_test.dart and rerun_failed_job_test.dart were updated to properly seed data using PrCheckRuns.initializeDocument(...) mirroring production behavior.
  • Updated Assertions: Test assertions were updated to verify correct PR handling, most notably checking that reScheduleTryBuilds receives accurate target configurations (e.g., proper attempt increments like containsPair(targetA, 2)).
  • Removed Deprecated Mocks: Scrubbed generated files like mocks.mocks.dart and testing data_seeder.dart to remove references to the deleted fields and getters.

fix: flutter/flutter#183602

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Hi @ievdokdm, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

## 📋 Review Summary

This Pull Request removes the caching functionality for pull requests by number from the Scheduler and relies instead on finding the pull request by SHA from Firestore in the API handlers for rerunning jobs. While the code changes align with simplifying the caching logic, they introduce a logical flaw related to how pull requests are queried.

🔍 General Feedback

  • The refactoring nicely cleans up the API handlers by unifying the logic used for rerunning failed jobs.
  • Removing pullRequestNum and relying solely on the SHA to fetch PRs introduces a potential conflict since a single SHA can be associated with multiple Pull Requests.
  • Please consider retaining the PR number lookup to ensure the API precisely operates on the intended pull request context.

Comment thread app_dart/lib/src/request_handlers/rerun_all_failed_jobs.dart Outdated
Comment thread app_dart/lib/src/request_handlers/rerun_failed_job.dart Outdated
@ievdokdm ievdokdm changed the title 183602 find pr by sha 183602 Fix an issue with updating proper job attempt numbers on re-run Mar 17, 2026
@ievdokdm ievdokdm added the CICD Run CI/CD label Mar 17, 2026
@ievdokdm ievdokdm requested a review from jtmcdole March 17, 2026 22:22
Comment thread app_dart/lib/src/request_handlers/rerun_all_failed_jobs.dart Outdated
Comment thread app_dart/lib/src/request_handlers/rerun_failed_job.dart Outdated
@ievdokdm ievdokdm added the autosubmit Merge PR when tree becomes green via auto submit App. label Mar 17, 2026
@auto-submit
Copy link
Copy Markdown
Contributor

auto-submit Bot commented Mar 17, 2026

auto label is removed for flutter/cocoon/4988, Failed to merge flutter/cocoon/4988 with Pull request flutter/cocoon/4988 could not be merged: Required status check "ci.yaml validation" is expected..

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App. label Mar 17, 2026
@ievdokdm ievdokdm added the autosubmit Merge PR when tree becomes green via auto submit App. label Mar 18, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App. label Mar 18, 2026
@auto-submit
Copy link
Copy Markdown
Contributor

auto-submit Bot commented Mar 18, 2026

auto label is removed for flutter/cocoon/4988, Failed to merge flutter/cocoon/4988 with Pull request flutter/cocoon/4988 could not be merged: Required status check "ci.yaml validation" is expected..

@ievdokdm ievdokdm added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App. and removed CICD Run CI/CD labels Mar 18, 2026
@auto-submit auto-submit Bot merged commit abb4b58 into main Mar 18, 2026
44 checks passed
@ievdokdm ievdokdm deleted the 183602-find-pr-by-sha branch March 24, 2026 18:24
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.

Re-run failed does not updates presubmit_checks with corresponding attemptNumber

2 participants