Skip to content

refactor(github): extract CI dispatch decisions#1283

Merged
aaight merged 1 commit into
devfrom
feature/extract-github-ci-decisions
May 9, 2026
Merged

refactor(github): extract CI dispatch decisions#1283
aaight merged 1 commit into
devfrom
feature/extract-github-ci-decisions

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented May 9, 2026

Summary

Refactors the highest-risk GitHub CI dispatch paths into smaller decision and result-building units.

Card: https://trello.com/c/69fe2a760699baaf91682dc3

Changes

  • Added shared check-suite PR resolution for direct payload PRs, refs/pull/N/head, and branch lookup fallback.
  • Added a pure check-suite decision helper that classifies aggregate check-run state into defer, respond-to-ci, review, or skip while preserving existing skip messages.
  • Centralized GitHub PR dispatch result creation for review, respond-to-ci, and resolve-conflicts paths.
  • Wired check-suite-success, check-suite-failure, respond-to-ci-dispatch, and pr-conflict-detected through the extracted helpers while keeping GitHub API calls, dedup claims, counters, and comments at handler boundaries.
  • Updated the static trigger-event guard to understand the new GitHub result builders.
  • Added focused unit tests for aggregate mixed/failing state, incomplete checks, gate skips, and shared PR resolution paths.

Verification

  • npx vitest run --project unit-triggers tests/unit/triggers/github/check-suite-decision.test.ts tests/unit/triggers/check-suite-success.test.ts tests/unit/triggers/check-suite-failure.test.ts tests/unit/triggers/pr-conflict-detected.test.ts
  • npm test
  • npm run typecheck
  • npm run lint (passes with existing complexity warnings in src/integrations/alerting/_shared/materialize.ts and src/triggers/sentry/webhook-handler.ts)

🕵️ codex · gpt-5.5 · run details

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

❌ Patch coverage is 93.63958% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/triggers/github/check-suite-decision.ts 86.31% 13 Missing ⚠️
src/triggers/github/check-suite-success.ts 92.00% 4 Missing ⚠️
src/triggers/github/check-suite-failure.ts 97.05% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

LGTM - I traced the extracted PR-resolution, check-suite decision, and GitHub result-builder paths against the existing trigger contracts and the linked card requirements. The dispatch payloads preserve triggerEvent/prNumber/workItemId, review onBlocked dedup release remains at the handler boundary, and the targeted unit-trigger suite passed locally.

🕵️ codex · gpt-5.5 · run details

@aaight aaight merged commit 0befb54 into dev May 9, 2026
9 checks passed
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.

2 participants