← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Shift-Left Testing

DevOps Intermediate
debt(d7/e5/b5/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The absence of shift-left practices — tests only running in CI not locally, no pre-commit hooks, security scanning only at deployment — is not caught by a compiler or default linter. Tools like phpstan, phpunit, captainhook, and semgrep can enforce it, but only if someone deliberately sets them up; the gap is typically discovered through code review audits or when bugs regularly surface in production, not automatically flagged.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix describes moving testing across multiple stages: type checking on save, unit tests on commit, integration tests in CI. This isn't a one-line fix — it requires configuring pre-commit hooks (captainhook), adding SAST (semgrep/phpstan), setting up ephemeral PR environments, and potentially restructuring CI pipelines. It touches dev tooling, CI config, and team workflow simultaneously, making it a multi-file, multi-system effort.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Shift-left testing applies broadly to both web and CLI contexts. Once adopted (or not adopted), it shapes every developer's daily workflow — slow hooks get bypassed with --no-verify, missing PR environments mean developers can't validate changes in isolation. It imposes an ongoing tax on many work streams (PR reviews, deployments, onboarding) but doesn't fully define the system's shape, placing it at b5 rather than b7.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap' (t5). The misconception field directly identifies the canonical wrong belief: developers assume shift-left means only unit tests run early, missing that SAST, accessibility (axe-core), performance (Lighthouse CI), and contract tests can all shift left too. This is a documented, well-known gotcha that most developers eventually learn, but it leads to incomplete adoption — e.g., security scanning only before release rather than on every PR — which is a real and costly mistake.

About DEBT scoring →

Also Known As

shift left test earlier dev testing SAST

TL;DR

Moving testing earlier in the development process — catching bugs at the developer's machine and PR stage rather than in staging or production.

Explanation

Traditional testing pyramid deferred integration and security testing to late stages. Shift-left brings it forward: pre-commit hooks run linting and unit tests locally, PRs trigger full CI (unit, integration, static analysis, SAST), feature branches deploy to ephemeral environments, and security scanning runs before merge. Cost of fixing a bug: $1 at commit time, $10 in PR review, $100 in staging, $1000 in production. Shift-left tools: pre-commit hooks, GitHub Actions, PHPStan, SAST scanners, contract tests.

Common Misconception

Shift-left means only unit tests run early — shift-left applies to all types of testing: security (SAST), accessibility (axe-core), performance (Lighthouse CI), and contract tests can all run at PR time.

Why It Matters

A security vulnerability caught by SAST in a PR takes 10 minutes to fix — the same vulnerability discovered in production after 6 months of exploitation costs millions and regulatory fines.

Common Mistakes

  • Slow pre-commit hooks — hooks over 10 seconds get bypassed with --no-verify.
  • Only linting in pre-commit — include fast unit tests for immediate feedback.
  • No ephemeral PR environments — developers cannot test their changes in isolation.
  • Security scanning only before release — SAST should run on every PR.

Code Examples

✗ Vulnerable
// All testing deferred to staging:
// Developer commits → pushed to main → deployed to staging
// QA tests manually → finds bug after 3 days
// Developer context-switched to other work
// Fixing: 1 hour of relearning + 30 min fix
// Cost: 1.5 hours + delayed release
✓ Fixed
// Shift-left: caught immediately:
// pre-commit: phpcs + phpstan (10 seconds)
// PR: full CI in 5 minutes:
//   unit tests, integration tests
//   static analysis at level 8
//   SAST scan (SonarQube)
//   Lighthouse CI for performance
//   Ephemeral environment deployed
// Developer still has full context
// Fixing: 10 minutes

Added 16 Mar 2026
Edited 22 Mar 2026
Views 59
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 1 ping S 1 ping M 0 pings T 2 pings W 1 ping T 1 ping F 2 pings S 2 pings S 2 pings M 0 pings T 1 ping W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 2 pings S 1 ping M 0 pings T 1 ping W
Bing 1
No pings yesterday
Amazonbot 10 Scrapy 8 Perplexity 6 Ahrefs 4 Google 3 ChatGPT 3 SEMrush 3 Unknown AI 2 Claude 2 Bing 2 Sogou 1 PetalBot 1
crawler 42 crawler_json 3
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Medium
⚡ Quick Fix
Move testing as close to development as possible: type checking and linting on save, unit tests on commit, integration tests in CI — finding a bug at commit time costs 100x less than finding it in production
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
Tests only run in CI not locally; no pre-commit hooks; security scanning only at deployment; bugs regularly found in production not development
Auto-detectable: ✓ Yes phpstan phpunit captainhook semgrep
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: High Context: File Tests: Update


✓ schema.org compliant