Revert "176989 unifiedCheckRunFlow flag removal" - #5145
Conversation
This reverts commit 777f0ce.
|
Gota land the code before you land the flag delete :) |
There was a problem hiding this comment.
Code Review
This pull request introduces a unified check run flow feature, allowing consolidated check runs for presubmit tests based on user-specific or global configuration flags. It updates the scheduler, build services, and subscription handlers to support this flow, alongside updating associated tests and fixing platform-related mock usages in the device doctor package. The code review feedback highlights a critical issue where the stage defaults incorrectly to CiStage.fusionTests instead of CiStage.genericTests for non-fusion repositories. Additionally, the reviewer recommends replacing unsafe null assertions (!) on pullRequest.user and pullRequest.user!.login with null-safe fallbacks across several files to prevent potential runtime crashes.
| (slug == Config.flutterSlug | ||
| ? CiStage.fusionTests | ||
| : CiStage.genericTests), | ||
| stage: stage ?? CiStage.fusionTests, |
There was a problem hiding this comment.
Defaulting the stage to CiStage.fusionTests for non-fusion repositories (where slug != Config.flutterSlug) is incorrect and can cause mismatches when querying or updating staging documents in Firestore. It should default to CiStage.genericTests for non-fusion repositories.
| stage: stage ?? CiStage.fusionTests, | |
| stage: | |
| stage ?? | |
| (slug == Config.flutterSlug | |
| ? CiStage.fusionTests | |
| : CiStage.genericTests), |
| if (dashboardChecks != null && | ||
| pullRequest != null && | ||
| config.flags.isUnifiedCheckRunFlowEnabledForUser( | ||
| pullRequest.user!.login!, | ||
| )) { | ||
| // Create the presubmit_guard and associated presubmit_job documents. | ||
| log.info( | ||
| 'Storing UnifiedCheckRun data for ${slug.fullName}#${pullRequest.number}.', | ||
| 'Storing UnifiedCheckRun data for ${slug.fullName}#${pullRequest.number} as it enabled for user ${pullRequest.user!.login}.', | ||
| ); |
There was a problem hiding this comment.
Using the null assertion operator ! on pullRequest.user and pullRequest.user!.login can lead to runtime crashes if the user or login is null (e.g., for certain automated actions or deleted accounts). Use null-safe access with a fallback instead.
if (dashboardChecks != null &&
pullRequest != null &&
config.flags.isUnifiedCheckRunFlowEnabledForUser(
pullRequest.user?.login ?? '',
)) {
// Create the presubmit_guard and associated presubmit_job documents.
log.info(
'Storing UnifiedCheckRun data for ${slug.fullName}#${pullRequest.number} as it enabled for user ${pullRequest.user?.login}.',
);| final isUnifiedCheckRunFlow = _config.flags | ||
| .isUnifiedCheckRunFlowEnabledForUser(pullRequest.user!.login!); | ||
| final isOrderedPresubmit = _config.flags.isOrderedPresubmitEnabledForUser( | ||
| pullRequest.user!.login!, | ||
| ); |
There was a problem hiding this comment.
Using the null assertion operator ! on pullRequest.user and pullRequest.user!.login can lead to runtime crashes if the user or login is null. Use null-safe access with a fallback instead.
| final isUnifiedCheckRunFlow = _config.flags | |
| .isUnifiedCheckRunFlowEnabledForUser(pullRequest.user!.login!); | |
| final isOrderedPresubmit = _config.flags.isOrderedPresubmitEnabledForUser( | |
| pullRequest.user!.login!, | |
| ); | |
| final isUnifiedCheckRunFlow = _config.flags | |
| .isUnifiedCheckRunFlowEnabledForUser(pullRequest.user?.login ?? ''); | |
| final isOrderedPresubmit = _config.flags.isOrderedPresubmitEnabledForUser( | |
| pullRequest.user?.login ?? '', | |
| ); |
| final isUnifiedCheckRun = _config.flags.isUnifiedCheckRunFlowEnabledForUser( | ||
| pullRequest.user!.login!, | ||
| ); |
There was a problem hiding this comment.
Using the null assertion operator ! on pullRequest.user and pullRequest.user!.login can lead to runtime crashes if the user or login is null. Use null-safe access with a fallback instead.
| final isUnifiedCheckRun = _config.flags.isUnifiedCheckRunFlowEnabledForUser( | |
| pullRequest.user!.login!, | |
| ); | |
| final isUnifiedCheckRun = _config.flags.isUnifiedCheckRunFlowEnabledForUser( | |
| pullRequest.user?.login ?? '', | |
| ); |
Reverts #5144