Skip to content

refactor(app_dart): flatten merge-group handler and extract check-run helpers - #5174

Open
jtmcdole wants to merge 1 commit into
mainfrom
want-lgtm-01-refactor
Open

jtmcdole wants to merge 1 commit into
mainfrom
want-lgtm-01-refactor

Conversation

@jtmcdole

@jtmcdole jtmcdole commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Splits _handleMergeGroup into smaller action handlers to lower cognitive complexity before adding WANT_LGTM merge-group waivers. Also extracts shared check-run lookup helpers in GithubService.

WANT_LGTM Stack (RFC 610.0001)

Breaks the WANT_LGTM implementation into small, reviewable steps:

# PR Focus
1 #5174 Merge-group & check-run prep ← you are here
2 #5175 Rollout flags & dynamic config
3 #5176 Directive, verdict & snapshot models
4 #5177 WANT_LGTM= body parser
5 #5178 Review cohort evaluator
6 #5179 Firestore state & review webhook models
7 #5180 Paginated GraphQL snapshot client
8 #5181 GitHub check-run writer & cache
9 #5182 PR & merge-group reconciler
10 #5183 Webhook routing & Gold bypass
11 #5188 Firestore not-in query filter
12 #5184 Rollback check-run sweeper

Stack created with GitHub Stacks CLI • Give Feedback 💬

… helpers

- Flattens _handleMergeGroup cognitive complexity from 16 to <= 8 using
  pattern matching and extracted helper methods.
- Extracts _handleCheckRun from post to drop post complexity below 10.
- Extracts runWithPrLock from PullRequestManager._runWithLock to allow
  locking by slug and PR number directly.
- Extracts _evaluateCheckRuns in PushGoldStatusToGithub using a Dart record
  return type to prepare for check run filtering.
@jtmcdole
jtmcdole added this pull request to stack #5185 November 9, 2026 19:28

@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 refactors several request handlers and services by extracting helper methods to improve code modularity and readability. Specifically, it extracts check run and merge group handlers in webhook_subscription.dart, check run evaluation in push_gold_status_to_github.dart, and a PR locking mechanism in pull_request_manager.dart. The review feedback points out potential runtime errors in the extracted _evaluateCheckRuns method, specifically warning against unsafe nested JSON parsing of checkSuites and a potential null pointer exception when accessing checkRun['name'].

@zanderso zanderso left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm - pure refactor with no semantic change.

@Piinks Piinks 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants