From e9e707b41e1edf86cdac792c0a7e7db09659da95 Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Tue, 24 Mar 2026 15:13:02 -0700 Subject: [PATCH 01/10] will codefu let me do this --- .../github/webhook_subscription.dart | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart index d7ddb8df5..424c6a333 100644 --- a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart +++ b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart @@ -201,10 +201,18 @@ final class GithubWebhookSubscription extends SubscriptionHandler { case 'edited': await _addCICDForRollers(pullRequestEvent); await _checkForTests(pullRequestEvent); + if (pullRequestEvent.changes != null && + pullRequestEvent.changes!.base != null && + _isOrgMember(pr)) { + await _scheduleIfMergeable(pullRequestEvent); + } break; case 'opened': await _addCICDForRollers(pullRequestEvent); await _checkForTests(pullRequestEvent); + if (_isOrgMember(pr)) { + await _scheduleIfMergeable(pullRequestEvent); + } await _tryReleaseApproval(pullRequestEvent); break; case 'reopened': @@ -232,8 +240,12 @@ final class GithubWebhookSubscription extends SubscriptionHandler { case 'dequeued': await _respondToPullRequestDequeued(pullRequestEvent); break; - // Ignore the rest of the events. case 'synchronize': + if (_isOrgMember(pr)) { + await _scheduleIfMergeable(pullRequestEvent); + } + break; + // Ignore the rest of the events. case 'ready_for_review': case 'unlabeled': case 'assigned': @@ -247,6 +259,17 @@ final class GithubWebhookSubscription extends SubscriptionHandler { return Response.emptyOk; } + /// Returns `true` if the PR author is a member or owner of the org that + /// owns the repository. + /// + /// This uses the `author_association` field from the GitHub webhook payload, + /// which avoids the need for an additional API call. The values `MEMBER` and + /// `OWNER` indicate the PR author belongs to the organization. + static bool _isOrgMember(PullRequest pr) { + final association = pr.authorAssociation; + return association == 'MEMBER' || association == 'OWNER'; + } + Future _processLabels(PullRequest pullRequest) async { final slug = pullRequest.base!.repo!.slug(); final githubService = await config.createGithubService(slug); From 77f48e3eb58db02e9d9c3403d739c5fb4a7f9b2a Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Tue, 24 Mar 2026 15:38:22 -0700 Subject: [PATCH 02/10] tests, incomplete --- .../github/webhook_subscription_test.dart | 42 +++++++++++++++---- .../lib/src/utilities/webhook_generators.dart | 5 ++- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index 57aac77ec..313542ee2 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -87,6 +87,7 @@ void main() { githubOAuthTokenValue: 'githubOAuthKey', missingTestsPullRequestMessageValue: 'missingTestPullRequestMessage', releaseBranchPullRequestMessageValue: 'releaseBranchPullRequestMessage', + maxFilesChangedForSkippingEnginePhaseValue: 100, rollerAccountsValue: const { 'skia-flutter-autoroll', 'engine-flutter-autoroll', @@ -153,6 +154,7 @@ void main() { return CheckRun.fromJson(const { 'id': 1, 'started_at': '2020-05-10T02:49:31Z', + 'name': 'test_name', 'check_suite': {'id': 2}, }); }); @@ -408,6 +410,7 @@ void main() { number: issueNumber, baseRef: 'master', slug: Config.packagesSlug, + isOrgMember: false, ); tester.message = pushMessage; @@ -459,6 +462,7 @@ void main() { baseRef: 'master', slug: Config.packagesSlug, includeChanges: true, + isOrgMember: false, ); tester.message = pushMessage; @@ -531,6 +535,7 @@ void main() { action: 'opened', number: issueNumber, isDraft: true, + isOrgMember: false, ); var batchRequestCalled = false; @@ -2667,6 +2672,7 @@ void foo() { tester.message = generateGithubWebhookMessage( action: 'synchronize', number: issueNumber, + isOrgMember: false, ); final mockRepositoriesService = MockRepositoriesService(); @@ -3691,20 +3697,39 @@ void foo() { }); group('CICD label', () { - test('opened PR without CICD label does not schedule tests', () async { - tester.message = generateGithubWebhookMessage( - action: 'opened', - withCicdLabel: false, - ); + test( + 'opened PR without CICD label does schedule tests if author is MEMBER', + () async { + tester.message = generateGithubWebhookMessage( + action: 'opened', + withCicdLabel: false, + isOrgMember: true, + ); - await tester.post(webhook); - expect(scheduler.triggerPresubmitTargetsCnt, 0); - }); + await tester.post(webhook); + expect(scheduler.triggerPresubmitTargetsCnt, 1); + }, + ); + + test( + 'opened PR without CICD label does not schedule tests if author is not MEMBER', + () async { + tester.message = generateGithubWebhookMessage( + action: 'opened', + withCicdLabel: false, + isOrgMember: false, + ); + + await tester.post(webhook); + expect(scheduler.triggerPresubmitTargetsCnt, 0); + }, + ); test('opened PR with CICD label does not schedules tests', () async { tester.message = generateGithubWebhookMessage( action: 'opened', withCicdLabel: true, + isOrgMember: false, ); await tester.post(webhook); @@ -3796,6 +3821,7 @@ void foo() { tester.message = generateGithubWebhookMessage( action: 'synchronize', withCicdLabel: true, + isOrgMember: false, ); await tester.post(webhook); diff --git a/packages/cocoon_integration_test/lib/src/utilities/webhook_generators.dart b/packages/cocoon_integration_test/lib/src/utilities/webhook_generators.dart index 700343332..46759daf5 100644 --- a/packages/cocoon_integration_test/lib/src/utilities/webhook_generators.dart +++ b/packages/cocoon_integration_test/lib/src/utilities/webhook_generators.dart @@ -30,6 +30,7 @@ PushMessage generateGithubWebhookMessage({ bool withAutosubmit = false, bool withRevertOf = false, bool withCicdLabel = false, + bool isOrgMember = true, DateTime? closedAt, Iterable additionalLabels = const [], Map? labeledLabel, @@ -54,6 +55,7 @@ PushMessage generateGithubWebhookMessage({ withAutosubmit: withAutosubmit, withRevertOf: withRevertOf, withCicdLabel: withCicdLabel, + isOrgMember: isOrgMember, closedAt: closedAt, additionalLabels: additionalLabels, labeledLabel: labeledLabel, @@ -81,6 +83,7 @@ String _generatePullRequestEvent( required bool withAutosubmit, required bool withRevertOf, bool withCicdLabel = false, + bool isOrgMember = true, Iterable additionalLabels = const [], Map? labeledLabel, }) { @@ -463,7 +466,7 @@ String _generatePullRequestEvent( "href": "https://api.github.com/repos/${slug.fullName}/statuses/deadbeef" } }, - "author_association": "MEMBER", + "author_association": "${isOrgMember ? 'MEMBER' : 'CONTRIBUTOR'}", "draft" : $isDraft, "merged": $merged, "mergeable": $isMergeable, From f8f4a52aabf3b3e119462c0425d8f3db36185bd6 Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Tue, 24 Mar 2026 15:39:36 -0700 Subject: [PATCH 03/10] remove bad gem suggestions --- .../test/request_handlers/github/webhook_subscription_test.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index 313542ee2..600c46349 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -87,7 +87,6 @@ void main() { githubOAuthTokenValue: 'githubOAuthKey', missingTestsPullRequestMessageValue: 'missingTestPullRequestMessage', releaseBranchPullRequestMessageValue: 'releaseBranchPullRequestMessage', - maxFilesChangedForSkippingEnginePhaseValue: 100, rollerAccountsValue: const { 'skia-flutter-autoroll', 'engine-flutter-autoroll', @@ -154,7 +153,6 @@ void main() { return CheckRun.fromJson(const { 'id': 1, 'started_at': '2020-05-10T02:49:31Z', - 'name': 'test_name', 'check_suite': {'id': 2}, }); }); From 7a2806945412732f18e2b9c7a54e8a31f54fb9f8 Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Tue, 24 Mar 2026 15:42:35 -0700 Subject: [PATCH 04/10] some more test --- .../github/webhook_subscription_test.dart | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index 600c46349..6adbf5530 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -3723,17 +3723,33 @@ void foo() { }, ); - test('opened PR with CICD label does not schedules tests', () async { - tester.message = generateGithubWebhookMessage( - action: 'opened', - withCicdLabel: true, - isOrgMember: false, - ); + test( + 'opened PR with CICD label does schedules tests if author is MEMBER', + () async { + tester.message = generateGithubWebhookMessage( + action: 'opened', + withCicdLabel: true, + ); - await tester.post(webhook); + await tester.post(webhook); - expect(scheduler.triggerPresubmitTargetsCnt, 0); - }); + expect(scheduler.triggerPresubmitTargetsCnt, 1); + }, + ); + test( + 'opened PR with CICD label does not schedules tests if author is not MEMBER', + () async { + tester.message = generateGithubWebhookMessage( + action: 'opened', + withCicdLabel: true, + isOrgMember: false, + ); + + await tester.post(webhook); + + expect(scheduler.triggerPresubmitTargetsCnt, 0); + }, + ); test( 'labeled event with CICD label schedules tests on flutter/flutter', From d5456101a297128f6c374eb922a08e240bd72033 Mon Sep 17 00:00:00 2001 From: Gray Mackall Date: Wed, 25 Mar 2026 16:39:22 -0700 Subject: [PATCH 05/10] add label instead of scheduling directly, and update tests --- .../github/webhook_subscription.dart | 23 +++++-------- .../github/webhook_subscription_test.dart | 32 ++++++++++++++----- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart index 424c6a333..f71361e74 100644 --- a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart +++ b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart @@ -199,20 +199,15 @@ final class GithubWebhookSubscription extends SubscriptionHandler { final result = await _processPullRequestClosed(pullRequestEvent); return result.toResponse(); case 'edited': - await _addCICDForRollers(pullRequestEvent); - await _checkForTests(pullRequestEvent); if (pullRequestEvent.changes != null && - pullRequestEvent.changes!.base != null && - _isOrgMember(pr)) { - await _scheduleIfMergeable(pullRequestEvent); + pullRequestEvent.changes!.base != null) { + await _addCICDForRollersAndMembers(pullRequestEvent); } + await _checkForTests(pullRequestEvent); break; case 'opened': - await _addCICDForRollers(pullRequestEvent); + await _addCICDForRollersAndMembers(pullRequestEvent); await _checkForTests(pullRequestEvent); - if (_isOrgMember(pr)) { - await _scheduleIfMergeable(pullRequestEvent); - } await _tryReleaseApproval(pullRequestEvent); break; case 'reopened': @@ -241,9 +236,7 @@ final class GithubWebhookSubscription extends SubscriptionHandler { await _respondToPullRequestDequeued(pullRequestEvent); break; case 'synchronize': - if (_isOrgMember(pr)) { - await _scheduleIfMergeable(pullRequestEvent); - } + await _addCICDForRollersAndMembers(pullRequestEvent); break; // Ignore the rest of the events. case 'ready_for_review': @@ -592,12 +585,12 @@ final class GithubWebhookSubscription extends SubscriptionHandler { ); } - Future _addCICDForRollers(PullRequestEvent pullRequestEvent) async { + Future _addCICDForRollersAndMembers(PullRequestEvent pullRequestEvent) async { final pr = pullRequestEvent.pullRequest!; final slug = pr.base!.repo!.slug(); - if (config.rollerAccounts.contains(pr.user!.login) && - config.supportedRepos.contains(slug)) { + if (config.supportedRepos.contains(slug) && + (config.rollerAccounts.contains(pr.user!.login) || _isOrgMember(pr))) { final gitHubClient = await config.createGitHubClient(pullRequest: pr); await gitHubClient.issues.addLabelsToIssue(slug, pr.number!, ['CICD']); } diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index 6adbf5530..c1178feea 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -938,6 +938,7 @@ void main() { const issueNumber = 123; tester.message = generateGithubWebhookMessage( + isOrgMember: false, action: 'opened', number: issueNumber, ); @@ -1067,6 +1068,7 @@ void main() { const issueNumber = 123; tester.message = generateGithubWebhookMessage( + isOrgMember: false, action: 'opened', number: issueNumber, ); @@ -1694,6 +1696,7 @@ void foo() { const issueNumber = 123; tester.message = generateGithubWebhookMessage( + isOrgMember: false, action: 'opened', number: issueNumber, baseRef: kReleaseBaseRef, @@ -1832,6 +1835,7 @@ void foo() { const issueNumber = 123; tester.message = generateGithubWebhookMessage( + isOrgMember: false, action: 'opened', number: issueNumber, baseRef: 'master', @@ -1868,6 +1872,7 @@ void foo() { const issueNumber = 123; tester.message = generateGithubWebhookMessage( + isOrgMember: false, action: 'opened', number: issueNumber, baseRef: 'master', @@ -1904,6 +1909,7 @@ void foo() { const issueNumber = 123; tester.message = generateGithubWebhookMessage( + isOrgMember: false, action: 'opened', number: issueNumber, baseRef: 'master', @@ -2334,6 +2340,7 @@ void foo() { const issueNumber = 123; tester.message = generateGithubWebhookMessage( + isOrgMember: false, action: 'opened', number: issueNumber, baseRef: kReleaseBaseRef, @@ -2556,6 +2563,7 @@ void foo() { const issueNumber = 123; tester.message = generateGithubWebhookMessage( + isOrgMember: false, action: 'opened', number: issueNumber, ); @@ -3696,7 +3704,7 @@ void foo() { group('CICD label', () { test( - 'opened PR without CICD label does schedule tests if author is MEMBER', + 'opened PR without CICD label adds CICD label if author is MEMBER', () async { tester.message = generateGithubWebhookMessage( action: 'opened', @@ -3705,12 +3713,14 @@ void foo() { ); await tester.post(webhook); - expect(scheduler.triggerPresubmitTargetsCnt, 1); + verify( + issuesService.addLabelsToIssue(Config.flutterSlug, 123, ['CICD']), + ); }, ); test( - 'opened PR without CICD label does not schedule tests if author is not MEMBER', + 'opened PR without CICD label does not add CICD label if author is not MEMBER', () async { tester.message = generateGithubWebhookMessage( action: 'opened', @@ -3719,12 +3729,14 @@ void foo() { ); await tester.post(webhook); - expect(scheduler.triggerPresubmitTargetsCnt, 0); + verifyNever( + issuesService.addLabelsToIssue(Config.flutterSlug, 123, any), + ); }, ); test( - 'opened PR with CICD label does schedules tests if author is MEMBER', + 'opened PR with CICD label adds CICD label if author is MEMBER', () async { tester.message = generateGithubWebhookMessage( action: 'opened', @@ -3733,11 +3745,13 @@ void foo() { await tester.post(webhook); - expect(scheduler.triggerPresubmitTargetsCnt, 1); + verify( + issuesService.addLabelsToIssue(Config.flutterSlug, 123, ['CICD']), + ); }, ); test( - 'opened PR with CICD label does not schedules tests if author is not MEMBER', + 'opened PR with CICD label does not add CICD label if author is not MEMBER', () async { tester.message = generateGithubWebhookMessage( action: 'opened', @@ -3747,7 +3761,9 @@ void foo() { await tester.post(webhook); - expect(scheduler.triggerPresubmitTargetsCnt, 0); + verifyNever( + issuesService.addLabelsToIssue(Config.flutterSlug, 123, any), + ); }, ); From bd1e492ea5ce073bd21f69bfc2429043075d9750 Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:43:29 -0700 Subject: [PATCH 06/10] formaT --- .../lib/src/request_handlers/github/webhook_subscription.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart index f71361e74..493fdb82b 100644 --- a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart +++ b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart @@ -585,7 +585,9 @@ final class GithubWebhookSubscription extends SubscriptionHandler { ); } - Future _addCICDForRollersAndMembers(PullRequestEvent pullRequestEvent) async { + Future _addCICDForRollersAndMembers( + PullRequestEvent pullRequestEvent, + ) async { final pr = pullRequestEvent.pullRequest!; final slug = pr.base!.repo!.slug(); From e5a9ecd6511b2fa965c8d001b579d3154217a9ce Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:47:40 -0700 Subject: [PATCH 07/10] restore some changes that antigrav killed --- .../github/webhook_subscription.dart | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart index 493fdb82b..a7c2e0642 100644 --- a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart +++ b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart @@ -252,17 +252,6 @@ final class GithubWebhookSubscription extends SubscriptionHandler { return Response.emptyOk; } - /// Returns `true` if the PR author is a member or owner of the org that - /// owns the repository. - /// - /// This uses the `author_association` field from the GitHub webhook payload, - /// which avoids the need for an additional API call. The values `MEMBER` and - /// `OWNER` indicate the PR author belongs to the organization. - static bool _isOrgMember(PullRequest pr) { - final association = pr.authorAssociation; - return association == 'MEMBER' || association == 'OWNER'; - } - Future _processLabels(PullRequest pullRequest) async { final slug = pullRequest.base!.repo!.slug(); final githubService = await config.createGithubService(slug); @@ -591,8 +580,11 @@ final class GithubWebhookSubscription extends SubscriptionHandler { final pr = pullRequestEvent.pullRequest!; final slug = pr.base!.repo!.slug(); - if (config.supportedRepos.contains(slug) && - (config.rollerAccounts.contains(pr.user!.login) || _isOrgMember(pr))) { + final isRoller = config.rollerAccounts.contains(pr.user!.login); + final association = pr.authorAssociation; + final isOrgMember = association == 'MEMBER' || association == 'OWNER'; + + if (config.supportedRepos.contains(slug) && (isRoller || isOrgMember)) { final gitHubClient = await config.createGitHubClient(pullRequest: pr); await gitHubClient.issues.addLabelsToIssue(slug, pr.number!, ['CICD']); } From ecf36c5112da28158be86a88af02de9b80a8a6f1 Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:54:31 -0700 Subject: [PATCH 08/10] restore some old tests quickly, then consider checking they add label --- .../github/webhook_subscription_test.dart | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index c1178feea..e0381dd51 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -3703,37 +3703,26 @@ void foo() { }); group('CICD label', () { - test( - 'opened PR without CICD label adds CICD label if author is MEMBER', - () async { - tester.message = generateGithubWebhookMessage( - action: 'opened', - withCicdLabel: false, - isOrgMember: true, - ); + test('opened PR without CICD label does not schedule tests', () async { + tester.message = generateGithubWebhookMessage( + action: 'opened', + withCicdLabel: false, + ); - await tester.post(webhook); - verify( - issuesService.addLabelsToIssue(Config.flutterSlug, 123, ['CICD']), - ); - }, - ); + await tester.post(webhook); + expect(scheduler.triggerPresubmitTargetsCnt, 0); + }); - test( - 'opened PR without CICD label does not add CICD label if author is not MEMBER', - () async { - tester.message = generateGithubWebhookMessage( - action: 'opened', - withCicdLabel: false, - isOrgMember: false, - ); + test('opened PR with CICD label does not schedules tests', () async { + tester.message = generateGithubWebhookMessage( + action: 'opened', + withCicdLabel: true, + ); - await tester.post(webhook); - verifyNever( - issuesService.addLabelsToIssue(Config.flutterSlug, 123, any), - ); - }, - ); + await tester.post(webhook); + + expect(scheduler.triggerPresubmitTargetsCnt, 0); + }); test( 'opened PR with CICD label adds CICD label if author is MEMBER', From 8b5e96fe9a6139cd49bba5691011cf59018fde5c Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:02:21 -0700 Subject: [PATCH 09/10] some more tests --- .../github/webhook_subscription_test.dart | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index e0381dd51..f4578c755 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -3725,11 +3725,10 @@ void foo() { }); test( - 'opened PR with CICD label adds CICD label if author is MEMBER', + 'opened PR with adds CICD label if author is MEMBER', () async { tester.message = generateGithubWebhookMessage( action: 'opened', - withCicdLabel: true, ); await tester.post(webhook); @@ -3740,11 +3739,10 @@ void foo() { }, ); test( - 'opened PR with CICD label does not add CICD label if author is not MEMBER', + 'opened PR does not add CICD label if author is not MEMBER', () async { tester.message = generateGithubWebhookMessage( - action: 'opened', - withCicdLabel: true, + action: 'opened', isOrgMember: false, ); @@ -3847,5 +3845,29 @@ void foo() { expect(scheduler.triggerPresubmitTargetsCnt, 0); }, ); + + test('synchronize event adds CICD label if author is member', () async { + tester.message = generateGithubWebhookMessage( + action: 'synchronize', + isOrgMember: true, + ); + + await tester.post(webhook); + verify(issuesService.addLabelsToIssue(Config.flutterSlug, 123, ['CICD'])); + }); + test( + 'synchronize event does not add CICD label if author is not member', + () async { + tester.message = generateGithubWebhookMessage( + action: 'synchronize', + isOrgMember: false, + ); + + await tester.post(webhook); + verifyNever( + issuesService.addLabelsToIssue(Config.flutterSlug, 123, any), + ); + }, + ); }); } From 0bb3d09e19d90ff3bf0cd34f197f4baba9577c84 Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:46:53 -0700 Subject: [PATCH 10/10] format --- .../github/webhook_subscription_test.dart | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index f4578c755..817a77b1f 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -3724,35 +3724,23 @@ void foo() { expect(scheduler.triggerPresubmitTargetsCnt, 0); }); - test( - 'opened PR with adds CICD label if author is MEMBER', - () async { - tester.message = generateGithubWebhookMessage( - action: 'opened', - ); + test('opened PR with adds CICD label if author is MEMBER', () async { + tester.message = generateGithubWebhookMessage(action: 'opened'); - await tester.post(webhook); + await tester.post(webhook); - verify( - issuesService.addLabelsToIssue(Config.flutterSlug, 123, ['CICD']), - ); - }, - ); - test( - 'opened PR does not add CICD label if author is not MEMBER', - () async { - tester.message = generateGithubWebhookMessage( + verify(issuesService.addLabelsToIssue(Config.flutterSlug, 123, ['CICD'])); + }); + test('opened PR does not add CICD label if author is not MEMBER', () async { + tester.message = generateGithubWebhookMessage( action: 'opened', - isOrgMember: false, - ); + isOrgMember: false, + ); - await tester.post(webhook); + await tester.post(webhook); - verifyNever( - issuesService.addLabelsToIssue(Config.flutterSlug, 123, any), - ); - }, - ); + verifyNever(issuesService.addLabelsToIssue(Config.flutterSlug, 123, any)); + }); test( 'labeled event with CICD label schedules tests on flutter/flutter',