Critical source files have at least one corresponding test
Why it matters
Auth, payment, billing, and webhook handlers are the highest-risk code in any commercial application — bugs there cause account takeovers, double-charges, missed payments, and data exposure. CWE-1059 (Insufficient Documentation) and ISO-25010:2011 testability both flag untested critical paths as systemic risk. An AI agent generating a Stripe checkout route or a JWT auth handler without writing a corresponding test file leaves the most consequential code in the project completely unverified. A single refactor in lib/billing.ts with no test coverage can silently break revenue collection.
Severity rationale
Critical because untested auth and payment paths are the highest-consequence failure modes in production — bugs there affect money, access, and user data directly.
Remediation
Create a test file for every file under lib/auth*, lib/payment*, lib/billing*, app/api/auth/, app/api/checkout/, and app/api/webhooks/. The test doesn't need to be exhaustive — one covering the happy path is enough to break the pattern:
// tests/billing.test.ts
import { calculateInvoice } from '@/lib/billing'
describe('calculateInvoice', () => {
it('applies tax to line item total', () => {
const result = calculateInvoice([{ price: 100, qty: 2 }], 0.1)
expect(result.subtotal).toBe(200)
expect(result.tax).toBe(20)
expect(result.total).toBe(220)
})
it('returns zero total for empty items', () => {
const result = calculateInvoice([], 0.1)
expect(result.total).toBe(0)
})
})
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Test Reality Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-1059 — Insufficient Technical Documentation
- iso-25010:2011 · maintainability.testability — Testability (maintainability sub-characteristic)
- soc2:2017 · CC8.1 — Change management
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-test-theater·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC8.1) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2