Sub topic 2
Feedback speed versus confidence
This chapter assumes you know the basic Git and pull request workflow, have used a CI system such as GitHub Actions, and know what linting, unit tests, and integration tests are. It covers the trade-off that drives every placement decision later in this tutorial: how quickly a check reports, and how much a passing result tells you.
The two quantities
Every check produces a signal. Two properties of that signal matter most.
- Feedback speed is the time from a push (or other trigger) to a result the author can act on. It includes queue time, setup, the check itself, and reporting.
- Confidence is how much a green result lowers the chance that a defect reaches users. It depends on how much behavior the check exercises and how closely the environment resembles production.
The two pull against each other. Checks that exercise more of the system, such as real databases, real browsers, and real network calls, need more setup and more time. Checks that run in seconds usually isolate one piece of code and leave out interactions between pieces.
Why speed matters
Speed is not only a convenience. It changes how people work.
- Short feedback loops keep the author in context. A lint error reported in 30 seconds gets fixed while the code is still in mind. A failure reported 40 minutes later often arrives after the author has started other work.
- Slow checks encourage batching. If each push costs 40 minutes, people push less often and in larger chunks. Larger changes are harder to review and harder to debug when they fail.
- Slow checks encourage bypassing. Teams under deadline pressure start merging before checks finish, or ask administrators to override required checks. Once that habit forms, the checks no longer protect anything.
- Waiting costs money in ways that are easy to miss. Ten engineers each waiting 20 minutes on a check, several times a day, adds up to a large amount of idle or fragmented time.
Why confidence matters
Confidence has costs too, but they appear later and are less visible.
- A defect that escapes to main can block every other developer's work.
- A defect that escapes to production costs an incident, a rollback, and customer trust.
- The later a defect is found, the more it costs to locate. A failure on a 5-line pull request points at those 5 lines. A failure in a nightly run covering 60 commits does not.
A fast pipeline that misses real defects is not useful, and a thorough pipeline that nobody waits for is not either. The goal is to get the most confidence at each point for the time the author is willing to wait there.
Feedback is worth different amounts at different stages
The same check has a different value depending on when it runs. The table below shows the usual shape of the trade-off across the three stages this tutorial covers.
| Stage | Typical time budget | Who waits | Cost of a failure | Confidence expected |
|---|---|---|---|---|
| Pull request | Minutes (often under 10) | The author, and sometimes reviewers | Low. Only the author's branch is affected | Enough to review and discuss the change |
| Merge and main | Tens of minutes | The author, a merge queue, and the team if main breaks | Medium to high. Main or the queue is blocked | Enough to trust that main is releasable |
| Nightly | Hours | No one directly | Delayed. Someone must investigate the next morning | Broad coverage across the whole system |
These budgets are rules of thumb, not standards. Your team's tolerance may differ. What matters is that the budgets differ between stages, and that each stage is sized for the person waiting on it.
A model: the cost of a check
A useful way to compare checks is to estimate what each one costs per run and how much it tells you. Four factors decide this.
- Runtime. Wall-clock time from start to result, including setup such as dependency installation and service startup.
- Resource use. Runner minutes, memory, and any paid external services. Runner minutes are billed on most hosted CI plans.
- Determinism. How often the check gives the same answer on the same code. A check that fails randomly 3% of the time costs far more than its runtime suggests, because each random failure triggers reruns and investigation.
- Failure signal. When the check fails, how directly does the output point at the cause? A unit test that names one function is a precise signal. An end-to-end test that times out waiting for a page is a vague one.
Later chapters classify specific kinds of checks using these factors. For now, note that runtime is only one of the four. A fast but flaky check can be worse for a team than a slower, stable one.
Frequency changes the arithmetic
The cost of a check is the cost per run multiplied by how often it runs. A pull request check runs on every push to every open pull request. A nightly check runs once a day.
Consider a team with 20 developers who each push about 6 times a day. That is roughly 120 pull request runs per day.
- A check that takes 3 minutes costs 360 runner minutes a day.
- A check that takes 30 minutes costs 3,600 runner minutes a day, and every author waits half an hour on each push.
- The same 30-minute check as a nightly job costs 30 runner minutes a day.
Moving the long check to a nightly schedule reduces its daily cost by a factor of 120. It also means a defect it would have caught can sit in main for up to a day before anyone sees it. That delay is the price of the saving, and the rest of this tutorial is about deciding when that price is acceptable.
Where the trade-off shows up in configuration
The trade-off becomes concrete in the trigger configuration. The workflow below runs only fast checks on pull requests that target main.
name: pr
on:
pull_request:
branches: [main]
jobs:
fast-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run lint
- run: npm testThis workflow chooses speed. Lint and unit tests finish quickly and catch many common mistakes, but they do not start a database or a browser. Confidence about how components work together is deliberately left to a later stage.
The slower suite goes into a separate workflow, triggered when a merge queue builds a candidate commit or when a commit lands on main.
name: merge
on:
merge_group:
push:
branches: [main]
jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run test:integrationThis workflow accepts a longer wait in exchange for checking real interactions. Because it runs once per merge and not once per push, the longer runtime is paid far less often. The trigger syntax is covered in detail in a later chapter.
Common errors
These mistakes come from misjudging the trade-off.
- Putting everything on pull requests. This feels safe, but it makes every push slow and expensive. Authors respond by pushing less, rerunning on failure without reading it, or bypassing the checks.
- Putting almost nothing on pull requests. A pipeline that only runs a linter gives quick feedback and little protection. Defects move to main, where they are more disruptive.
- Judging a check by runtime alone. A 2-minute check that fails randomly can waste more time than a stable 8-minute one.
- Ignoring queue time. A 4-minute check on a saturated runner pool can take 15 minutes to report. Measure from push to result, not from job start to job end.
- Treating the nightly stage as a place to forget things. A nightly failure that nobody owns gives no feedback at all, so the check has a cost and no benefit.
- Never revisiting placement. Test suites grow. A check that fit on pull requests a year ago may no longer fit.
A working rule
A rough starting rule that later chapters turn into a repeatable process:
- Ask who is waiting for the result and how long they will tolerate waiting.
- Ask how much confidence the check adds that no cheaper check already provides.
- Ask how often the check would run at each stage and what that costs.
- Place the check at the earliest stage where the wait is acceptable. If the wait is too long there, move it to the next stage.
This rule pushes checks toward the cheapest stage that still gives a useful signal, and it makes the trade-off explicit instead of leaving it to habit.
Exercise
A team has about 100 pull request runs a day. An end-to-end suite takes 40 minutes and currently runs on every pull request push. Authors often rerun it without reading failures, and about 4% of runs fail for reasons unrelated to the change. Describe the costs on both sides of the speed and confidence trade-off, and propose a placement for the suite. State what you would need to put in place so the move does not simply hide failures.
Show answer
Costs of the current setup: 100 runs of 40 minutes is 4,000 runner minutes a day, and each author waits 40 minutes per push. The 4% unrelated failure rate means about 4 runs a day fail for no real reason, which trains people to rerun without reading and lowers trust in the signal. Costs of moving it: a defect the suite would catch can reach main and sit there up to a day, and a nightly failure covers many commits, so it is harder to trace. Proposed placement: keep fast checks (lint, unit tests) on pull requests, run a smaller integration subset at merge time, and run the full end-to-end suite nightly at roughly 40 runner minutes a day. To avoid hiding failures, assign a named owner for nightly failures, report results where the team will see them, and investigate or quarantine the flaky tests behind the 4% rate.
Exercise
Name the four factors used in this chapter to estimate the cost of a check, and explain why runtime alone can mislead.
Show answer
The factors are runtime, resource use, determinism, and failure signal. Runtime alone can mislead because a fast check that fails randomly causes reruns and investigation, and a fast check with a vague failure message makes the cause hard to find. A slower, stable check with a precise failure signal can cost the team less overall.