P4.VER.002 — Source directories have test coverage¶
| Field | Value |
|---|---|
| Principle | P4 (Verifiability) |
| Severity | info |
| Evidence | medium |
| Stability | experimental |
What it checks¶
For each directory containing source files, checks whether any test files exist using language-specific patterns:
- Go:
*_test.go - Python:
test_*.py,*_test.py - TypeScript/JavaScript:
*.test.ts,*.spec.ts,*.test.js,*.spec.js - Ruby:
*_spec.rb,*_test.rb - Java:
Test*.java,*Test.java
Fires when less than 70% of source directories have test files. Requires at least 3 source directories to avoid noise on small repos.
Why it matters¶
An agent can modify code in untested directories but cannot prove the change is correct. Test coverage at the directory level is a stronger signal than "does a Makefile exist" (P4.VER.001).
When to care¶
- Care when expanding into new areas — ensure tests follow source code.
- Care less for auto-generated code directories or vendored dependencies.
How to fix¶
Add test files alongside source files in untested directories. Even a single smoke test is better than none.
History¶
- 0.3.x — introduced at
stability: experimental.