CI/CD
GxP
Best practices
Foundations series · part 11

Test your guardrails: probe PRs

A check you have never seen fail is a check you have not verified

Challenge CI checks and pre-commit hooks deliberately with failing test PRs to prove guardrails work.
Published

2026-09-26

Modified

2026-09-27

The idea

After setting up hooks and CI, it’s tempting to open one clean PR, see green ticks and move on. But green only proves the checks can pass. It doesn’t prove they fail when they should. A misspelled trigger, a path filter, a continue-on-error, a missing licence key: any of these gives you a check that is always green.

So we challenge each guardrail on purpose, with throwaway PRs designed to fail.

The probes we ran

Each probe was a branch from main with one deliberate defect, opened as a PR and closed unmerged afterwards:

Probe Defect Expected Observed
Local Commit message initial stuff commit-msg hook rejects Rejected: subject may not be empty, type may not be empty
PR A Title updated the readme PR-title check fails; others pass No release type found in pull request title
PR B const x: number = "not a number" CI fails at the typecheck step Typecheck: failure; tests and build skipped; lint passed
PR C Random ghp_… token in a text file Secret scan fails gitleaks rule github-pat, pointing at the file
PR D A harmless doc change Everything passes All green

PR D matters as much as the others. It proves the checks aren’t simply broken and red for everything.

Read the log, not the colour

A red cross only proves something failed. For each probe we opened the log and confirmed it failed for the planted reason. PR B, for example, had to fail at Typecheck, not at lint or install. A probe that fails for the wrong reason tells you nothing about the guardrail. Track any gaps exposed by failing probes as engineering issues to resolve.

What the probes taught us

  • A gap resolved: the planted token initially passed the local pre-commit hook (which only formatted code) and was caught only in CI after being pushed. We followed up by integrating secretlint into pre-commit (lint-staged) and re-probed successfully: a fake ghp_ token was blocked on the laptop before the commit could even be created (see secret scanning).
  • A surprise: after deleting the probe branch, its commit was still served by the GitHub API through the closed PR. Deleting a branch doesn’t delete what was pushed. Only use fake secrets for probes.

The R version

The same probes work for an R package or Shiny repo:

Guardrail Probe
R CMD check workflow A PR that adds stop("probe") inside a tested function, or an undeclared pkg::fn()
lintr / Air check A PR with x = 1 and a 200-character line
shinytest2 snapshots A PR that changes a UI label without updating the snapshot
PR-title check updated stuff
gitleaks A fake ghp_ + 36 random characters (never a real token)
Coverage threshold A PR that adds an untested function

Generate a fake token that matches the pattern but has never existed:

echo "token=ghp_$(LC_ALL=C tr -dc 'A-Za-z0-9' </dev/urandom | head -c 36)" > leak-probe.txt

Sources

Tools used in the probes

Further reading

  • GAMP 5 (2nd Edition), the source of the operational-qualification (OQ) idea this post borrows: ispe.org
NoteUpdates
  • 2026-09-26: Closed the pre-commit scanning gap identified during initial probe testing. Added secretlint to the staged-files pre-commit pipeline (see secret scanning) and re-probed successfully: staged test tokens are blocked locally before commit creation.
  • 2026-09-26: Removed the end-of-post checklist.
  • 2026-09-27: Added a Sources section.