Skip to content

Drive Config.supportedRepos from dynamic ciEnabledRepos and remove useForAllRepos - #5238

Draft
jtmcdole wants to merge 1 commit into
flutter:mainfrom
jtmcdole:ci-enabled-repos
Draft

jtmcdole wants to merge 1 commit into
flutter:mainfrom
jtmcdole:ci-enabled-repos

Conversation

@jtmcdole

@jtmcdole jtmcdole commented Dec 4, 2026

Copy link
Copy Markdown
Member

Summary

Moves the Flutter CI repository list (flutter/cocoon, flutter/flutter, flutter/packages) from hardcoded Dart constants into ciEnabledRepos in app_dart/config.yaml, and removes the unused wantLgtm.useForAllRepos flag. This prepares for onboarding non-CI WANT_LGTM repositories (such as flutter/rfc) in #5237 without changing live CI behavior.

Changes

  • Add ciEnabledRepos to app_dart/config.yaml, app_dart/lib/src/generated_config.dart, and DynamicConfig, validated and canonicalized once via parseCanonicalRepoSlugs.
  • Back Config.supportedRepos with a precomputed case-insensitive LinkedHashSet<RepositorySlug> (DynamicConfig.ciEnabledRepoSlugs) and canonicalize mixed-case slugs via supportedRepos.lookup(...) in VacuumGithubCommits, GerritService.findMirroredCommit, and Scheduler._addCommit.
  • Make Config.defaultBranch and Config.generateGithubToken (cache key, lock key, and installation lookup) case-insensitive, throwing an explicit StateError when a repository is missing from APP_DART_GITHUBAPP_INSTALLATIONS.
  • Remove wantLgtm.useForAllRepos from app_dart/config.yaml, WantLgtmFlags, and WantLgtmCheckWriter.sweepInProgressRuns so per-repo rollbacks always sweep cleanly.
  • Update FakeConfig.supportedRepos and add unit tests for dynamic ciEnabledRepos, slug validation, legacy JSON tolerance, mixed-case lookup canonicalization, and missing installation errors.

Rollout Notes

  • Both adding ciEnabledRepos and removing wantLgtm.useForAllRepos are N-1 compatible (json_serializable ignores unrecognized keys and defaults missing keys to the existing three CI repositories).

Testing

  • dart format --output=none --set-exit-if-changed app_dart/lib/ app_dart/test/ packages/cocoon_integration_test/lib/: 0 diffs.
  • dart analyze --fatal-infos (app_dart, packages/cocoon_integration_test): 0 issues.
  • dart test in app_dart: 1,261/1,261 passed.
  • dart test in packages/cocoon_integration_test: 49/49 passed.

@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 transitions the hardcoded list of Flutter CI-supported repositories to a dynamic configuration (ciEnabledRepos) and implements case-insensitive repository slug matching and canonicalization across several services, including the scheduler, token generator, and Gerrit service. Additionally, it removes the legacy useForAllRepos flag from the LGTM configuration. The review feedback suggests two improvements: using a more idiomatic constructor tear-off with Iterable.map when initializing ciEnabledRepoSlugs, and performing a broader is Map type check instead of is Map<String, dynamic> to avoid potential runtime type mismatches when retrieving GitHub App installations.

Comment on lines +124 to +132
}) : ciEnabledRepoSlugs = UnmodifiableSetView<RepositorySlug>(
LinkedHashSet<RepositorySlug>(
equals: (a, b) =>
a.fullName.toLowerCase() == b.fullName.toLowerCase(),
hashCode: (s) => s.fullName.toLowerCase().hashCode,
)..addAll(<RepositorySlug>[
for (final repo in ciEnabledRepos) RepositorySlug.full(repo),
]),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using a constructor tear-off with Iterable.map is more concise and idiomatic in modern Dart than using a collection for loop inside a list literal.

  }) : ciEnabledRepoSlugs = UnmodifiableSetView<RepositorySlug>(
         LinkedHashSet<RepositorySlug>(
           equals: (a, b) =>
               a.fullName.toLowerCase() == b.fullName.toLowerCase(),
           hashCode: (s) => s.fullName.toLowerCase().hashCode,
         )..addAll(ciEnabledRepos.map(RepositorySlug.full)),
       );

Comment thread app_dart/lib/src/service/config.dart Outdated
Comment on lines +491 to +493
final appInstallation = installation is Map<String, dynamic>
? installation['installation_id'] as String?
: null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Checking installation is Map is more robust and idiomatic than checking installation is Map<String, dynamic>, as it avoids potential runtime type mismatches if the map is instantiated with a slightly different generic type (e.g., Map<String, Object>).

Suggested change
final appInstallation = installation is Map<String, dynamic>
? installation['installation_id'] as String?
: null;
final appInstallation = installation is Map
? installation['installation_id'] as String?
: null;

…emove useForAllRepos

Move Flutter CI repository membership into app_dart/config.yaml under
ciEnabledRepos, validate and canonicalize slugs once at config load time,
and expose Config.supportedRepos as a precomputed case-insensitive set.

Also remove wantLgtm.useForAllRepos (so VacuumWantLgtm always sweeps
disabled repos) and harden Config._generateGithubToken with a
case-insensitive installation lookup and explicit StateError when an
installation ID is missing.
@jtmcdole jtmcdole added the CICD Run CI/CD label Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant