Why Every Team Needs a Pre‑Merge Smoke Test (and How to Keep It Cheap and Reliable)

A practical guide to adding a lightweight pre-merge smoke test that catches obvious regressions, saves review time, and fits small Indian teams' budgets.

Written by: Arjun Malhotra

Developer at a laptop running tests — code editor and terminal visible on screen
Image credit: Mikael Kristenson / Unsplash

If your team treats pull requests like black boxes—open, wait, review, rerun CI, fix, repeat—you’re paying in time, context switches, and reviewer frustration. For small engineering teams in India (or anywhere), the simplest guardrail that pays for itself in days is a pre-merge smoke test: a short, opinionated script that runs before a PR is merged to catch the obvious, prevent noisy rollbacks, and keep reviewers focused on intent instead of basic breakage.

I added a pre-merge smoke test to my last startup nine months ago. It doesn’t catch every bug, but it cut flaky production rollbacks by half and saved reviewers hours a week. Here’s the practical way to do it without blowing your CI minutes or adding a maintenance burden.

What a pre-merge smoke test should do (in practice)

Typical contents (my real checklist)

I call this script pre-merge-smoke.sh and keep it in /scripts. It returns non-zero on failure and prints an actionable message.

An example (conceptual)

Why this beats “run the whole CI”

Where teams get it wrong (and how I learned)

Cost and infrastructure tradeoffs — India context Small teams are sensitive to CI minutes costs and latency. Two practical ways to keep costs low:

Both approaches have tradeoffs. Self-hosted runners require maintenance and expose your infra to security risks if misconfigured. Local runs depend on developer machines being reasonably powerful. Pick one and accept the occasional overhead of updating the runner image or adding a note to the onboarding doc.

Enforcing a culture, not just a script The script itself won’t stick unless the team agrees to treat it as a norm:

A small, real-world caveat After nine months we still had two production incidents that the smoke test missed—one was a rare race condition, the other an infra change that bypassed the smoke runner. Those taught me that a pre-merge smoke test reduces noise and catches the commons, but it doesn’t replace good monitoring, canary deployments, or thoughtful post‑merge checks.

The practical rollout plan (a weekend playbook)

  1. Inventory the critical flows (login, core read/write, build).
  2. Draft a 10–step smoke script that runs in <=3 minutes.
  3. Add it as a required check in your Git provider for protected branches.
  4. Provide a self-hosted runner or a clear local path with a tiny docker-smoke compose.
  5. Schedule maintenance: review and prune every 3 months.

If your team treats a green PR as a promise of stability, you’ve already lost. Treat a green pre-merge smoke test as a promise of “no obvious regressions”—and use it to make reviews smarter, not lazier. It’s low effort, low cost, and for most small teams in India it buys back time and reduces embarrassing rollbacks. Try it for one month; if nothing else, you’ll stop merging PRs that immediately fail the build.

Thanks for reading — if you want the basic script I use, ping me and I’ll share a trimmed-down version you can drop into any repo.