Sub topic 14
Reviewing and moving checks over time
Check placement is a decision you revisit, not a one-time setup. Test suites grow, code changes, and a check that fit on pull requests last year may now be too slow. This chapter assumes you know the three stages (pull request, merge, nightly) and have a basic grasp of required status checks and flaky tests.
Why placement drifts
Three things change after you place a check:
- The check gets slower as the code and the test count grow.
- The check's failure rate changes. It may become flaky, or it may stop catching anything.
- The cost of a late failure changes. A bug that reaches
mainis cheaper to fix on a small team than on a large one with many open branches.
Without a regular review, pull request feedback slows down and people start ignoring the pipeline.
The three signals to collect
Review placement using data, not opinions. For each check, gather these numbers over the last 30 to 90 days:
| Signal | Question it answers | Example source |
|---|---|---|
| Runtime (median and 95th percentile) | Is it still fast enough for its stage? | Workflow run durations |
| Failure rate and flake rate | Does a failure mean a real problem? | Reruns that pass without code changes |
| Escapes | Which bugs got through, and where were they caught? | Incident notes, nightly failures, bug reports |
An escape is a defect that a check in a later stage found, or that no check found. Escapes tell you whether a check is too late. Runtime tells you whether it is too early.
Rules for moving a check
Use simple, written thresholds so the decision is repeatable. These are examples. Pick numbers that match your team.
- Move later (pull request to merge, or merge to nightly) when the 95th percentile runtime exceeds the stage budget, and the check rarely fails on its own. A check that has not caught a real bug in a quarter is a strong candidate.
- Move earlier (nightly to merge, or merge to pull request) when the same nightly failure keeps costing people time, or when escapes show that bugs reach
mainthat this check would have caught. - Quarantine when the flake rate is high. Keep the check running, but make it non-blocking until it is fixed.
- Delete when a check duplicates another or tests behavior that no longer exists.
The diagram below shows the review loop.
Making a move safely
Moving a check is a trigger change. Moving the nightly end-to-end suite earlier, for example, means adding a merge_group trigger to its workflow:
name: e2e-on-merge
on:
merge_group:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run test:e2eKeeping the nightly schedule while adding the merge trigger lets you compare results before dropping either one.
Other practices that keep moves low-risk:
- Change one check at a time, so a new failure has one likely cause.
- Announce the move and the reason in the team channel or the pull request description.
- Keep a short log of each move: the date, the data that triggered it, and the expected effect.
- Check the effect after a few weeks. If runtime or escapes did not improve, reverse the move.
Setting a review rhythm
A monthly or quarterly review of 30 minutes is enough for most teams. Look at the slowest checks, the flakiest checks, and every escape since the last review. Trigger an extra review after any incident that a better-placed check would have caught.
Exercise
Your integration suite runs on every pull request. Its 95th percentile runtime has grown from 6 to 18 minutes, against a 10-minute pull request budget. In the last quarter it failed on pull requests only three times, and each failure was also caught by unit tests. What do you do, and what do you monitor afterward?
Show answer
Move the integration suite to the merge queue (merge_group) and main, since it is over budget and rarely catches anything unit tests miss. Update any required status check names in branch protection in the same change. Afterward, monitor escapes to main and merge queue failure rates. If bugs that only integration tests catch start failing at merge time often, or cost much rework, consider running a faster subset on pull requests.