08 · Exemptions
Sometimes a check is right and you merge anyway, on purpose. An exemption makes that a decision on the record: what is being accepted, why, until when, and for which check.
You will learn
- When an exemption is the honest answer
- How to write one, and check it on your machine before pushing
- What the gate refuses, and why a label alone is not enough
Why exemptions exist
Until now, every red check meant you did something wrong, and you fixed it. This step is about the other case: the check is right, and your change is also right.
Here is the example you are about to build. You rename loadUser to parseUser. Good change. But any code that imports loadUser will break. The pull request checklist asks "Rollback is safe, no breaking change?" and the honest answer is no. You still want to merge it.
You have three options:
| You… | What happens | The problem |
|---|---|---|
| tick the box anyway | everything goes green | the checklist now lies |
| ask an admin to force the merge | the change lands | nobody wrote down why |
| write an exemption | the check stays red, the gate lets it through | none: the reason is on the pull request |
An exemption is a short note in the pull request description: why you are merging anyway, until when that is acceptable, and which check it is about. Add the redline-exempt label, and the gate reads the note instead of failing. Think of it as a signed note: "I know this check is red. Here is why that is fine, until this date."
New term Process check
A check about how you work, not about whether the code is dangerous: the rule checker (policy), the pull request checklist and the adr check. An exemption can cover these. It can never cover the security floor from step 06: a vulnerable dependency or a leaked secret is never waived.
A change that is right, and breaks a check
Rename loadUser to parseUser in src/users.ts and its test, to match parseAddress, with no alias left behind:
$ git checkout -b refactor/parse-user $ perl -pi -e 's/\bloadUser\b/parseUser/g' src/users.ts src/users.test.ts $ pnpm test $ git commit -am "refactor: rename loadUser to parseUser" $ git push -u origin refactor/parse-user $ gh pr create --title "refactor: rename loadUser to parseUser" --body-file .github/pull_request_template.md
The tests pass. On GitHub, tick the ## Launch readiness boxes that hold. One does not: anyone importing loadUser breaks, so Rollback is safe (no destructive migration, no breaking contract change) is honestly false. Leave it unticked:
# from the PR checklist job Error: 1 unchecked launch-readiness item(s). Tick each one, or delete the line and say why in the PR description.
Write the exemption
The pull request template already has a ## Redline exemption section with three empty fields. Fill them in, with an end date 30 days from today, and add the redline-exempt label that step 01's init created:
$ UNTIL=$(node -p "new Date(Date.now() + 30 * 864e5).toISOString().slice(0, 10)") $ gh pr view --json body -q .body | UNTIL=$UNTIL perl -pe 's/^- reason:\s*$/- reason: parseUser replaces loadUser with no alias, so a consumer that upgrades cannot roll back without renaming its import again. Nothing outside this repository imports it yet.\n/; s/^- until:\s*$/- until: $ENV{UNTIL}\n/; s/^- scope:\s*$/- scope: checklist\n/' | gh pr edit --body-file - $ gh pr edit --add-label redline-exempt
Or edit the description on GitHub, so the section reads:
## Redline exemption
- reason: parseUser replaces loadUser with no alias, so a consumer that upgrades cannot roll back without renaming its import again. Nothing outside this repository imports it yet.
- until: YYYY-MM-DD
- scope: checklist
At least 20 characters. Say what is accepted and why, so a reader in three months can act on it. "needed for release" is refused: it tells a later reader nothing.
A real date, YYYY-MM-DD, at most 90 days away. An exemption is temporary by design; anything longer is a change to the standard, not an exemption.
The checks it covers: checklist, adr, policy. Name only the one that is failing. Leave it out and it covers all of them, which is rarely what you mean.
Check it before you push
The gate runs this exact command against each failing process check. Run it yourself first, against the check that is failing. It exits 0 when the exemption covers that check:
$ gh pr view --json body --jq .body > body.md $ pnpm redline exempt --body-file body.md --scope checklist exempt until YYYY-MM-DD (checklist): parseUser replaces loadUser with no alias, …
$ gh pr view --json body --jq .body > body.md $ npx redlinegate exempt --body-file body.md --scope checklist exempt until YYYY-MM-DD (checklist): parseUser replaces loadUser with no alias, …
$ gh pr view --json body --jq .body > body.md $ yarn redline exempt --body-file body.md --scope checklist exempt until YYYY-MM-DD (checklist): parseUser replaces loadUser with no alias, …
$ gh pr view --json body --jq .body > body.md $ bun run redline exempt --body-file body.md --scope checklist exempt until YYYY-MM-DD (checklist): parseUser replaces loadUser with no alias, …
Each refusal exits 1 and says what is wrong:
$ pnpm redline exempt --body-file body.md --scope adr warn the exemption covers checklist — it does not cover "adr". Widen its scope deliberately, or fix the check.
$ npx redlinegate exempt --body-file body.md --scope adr warn the exemption covers checklist — it does not cover "adr". Widen its scope deliberately, or fix the check.
$ yarn redline exempt --body-file body.md --scope adr warn the exemption covers checklist — it does not cover "adr". Widen its scope deliberately, or fix the check.
$ bun run redline exempt --body-file body.md --scope adr warn the exemption covers checklist — it does not cover "adr". Widen its scope deliberately, or fix the check.
# until: more than 90 days away warn `until: 2027-06-01` is <n> days away; the maximum is 90 — a longer exemption is a standards change, not an exemption
# reason: needed for release warn the reason is 18 characters; at least 20 are required — "needed for release" tells a later reader nothing
# the label, and no ## Redline exemption section Error: A soft-fail label was applied without a valid `## Redline exemption` block (reason and expiry required).
A label says something was waived, not why, by whom or until when, so the gate refuses a label on its own. At observe the error is recorded and the gate still passes. At a blocking rung, the gate fails.
None of this ever applies to the security floor. Step 06 showed the label being ignored there, and an exemption block is ignored the same way.
What the gate does with it
$ gh pr checks --watch ✓ test ✓ redline-gate / Deterministic policy X redline-gate / PR checklist ✓ redline-gate / ADR required for significant changes ✓ redline-gate / Dependency review ✓ redline-gate / Secret scan (diff) ✓ redline-gate / gate
The checklist job stays red: the item is still false, and the pull request says so. The gate's log shows the exemption it read:
# from the gate job Soft-fail label present: redline-exempt exempt until YYYY-MM-DD (checklist): parseUser replaces loadUser with no alias, … Warning: Process checks failed: checklist. This repository is at rung 'observe', which reports and does not block. The findings are recorded either way. Redline gate passed.
At observe the gate would have passed without the exemption too, so here it changes the record, not the merge: the pull request now says what was accepted, why, and until when. At a blocking rung, a failing process check stops the merge, and a valid exemption is the only way through it. That is the next step.
Merge it
Merge, and delete the copy of the description you checked locally:
$ gh pr merge --squash $ git checkout main $ git pull $ rm body.md
Check your understanding
PR checklist and ADR are both failing. The exemption block says scope: checklist. At a blocking rung, what happens?