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.

About 7 minutesNeeds GitHubFiles after this step ↗Pull request #14 ↗

✓

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 happensThe problem
tick the box anywayeverything goes greenthe checklist now lies
ask an admin to force the mergethe change landsnobody wrote down why
write an exemptionthe check stays red, the gate lets it throughnone: 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:

terminal
$ 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:

terminal
# 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:

terminal
$ 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:

pull request description
## 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.

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:

terminal
$ 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, …

Each refusal exits 1 and says what is wrong:

terminal
$ 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.

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

terminal
$ 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:

terminal
# 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:

terminal
$ 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?