| name | test-integrity |
| description | Review branch diff for test weakening patterns in Parallax. Last line of defense before commit/merge. |
/test-integrity -- Test Integrity Review
Review the full branch diff for test weakening patterns. Comprehensive, defense-in-depth check covering both syntactic and semantic weakening.
When to Use
- Before committing or merging a branch that modifies test files
- At the end of plan execution when tests were added or modified
- Anytime you suspect test quality may have degraded during a session
Step 1: Determine Diff Source
If the user provided a base branch argument (e.g., /test-integrity se/feature-a), use that as the base instead of main/master.
Run these commands to select the appropriate diff:
git diff --cached --name-only (staged changes)
git diff --name-only (unstaged changes)
git merge-base HEAD <base> where <base> is the user-provided branch, or main (fall back to master if main does not exist)
Decision logic:
- Staged changes exist: review
git diff --cached
- No staged but unstaged changes exist: review
git diff
- No uncommitted changes: review
git diff $(git merge-base HEAD <base>)...HEAD
Filter to test files only: paths containing tests/, or files named test_*.py / *_test.py.
If no test files are in the diff, report "No test files modified" and PASS.
Step 2: Analyze Weakening Patterns
Read the filtered diff carefully. For each test file, check every category below. Use semantic understanding -- do not rely solely on regex.
A: Skip/Disable Markers
B: Suppression Markers
C: Trivial/Tautological Assertions
D: Assertion Removal/Reduction
E: Tolerance/Precision Loosening
F: Comparison Weakening
G: Mocking/Isolation Bypass
H: Exception Handling Bypass
I: Commented-Out/Dead Code
J: Fixture/Setup Weakening
Step 3: Context Check
For each finding, determine if it is justified:
- Justified removal: The tested feature was itself removed in the same diff.
- Justified tolerance change: A new algorithm is intentionally less precise and this is documented.
- Justified mocking: Test was refactored to separate unit/integration concerns and integration tests exist elsewhere.
Mark findings as unjustified (default) or justified with a brief explanation. When in doubt, flag it -- false positives are better than missed weakening.
Step 4: Report
Present findings inline:
## Test Integrity Review
**Diff source:** [branch diff vs main | staged changes | unstaged changes]
**Test files reviewed:** [count]
### Findings
#### [CATEGORY] [severity] -- [file:line-range]
**Pattern:** [which checklist item]
**Detail:** [what changed and why it weakens the test]
**Justified:** [yes/no -- explanation if yes]
### Summary
- High severity: [count]
- Medium severity: [count]
- Low severity: [count]
- Justified (excluded): [count]
### Verdict: [PASS | FAIL]
[PASS if zero unjustified high/medium findings. FAIL otherwise.]
Severity
- High: assertion/test removal, exception swallowing, skip/xfail markers, tautological assertions
- Medium: tolerance loosening, comparison weakening, new mocks replacing real behavior, fixture scope widening
- Low: parametrize reduction, suppression markers (noqa/type:ignore), commented-out code
Rules
- Be comprehensive. Re-check everything, trust nothing. This is the last line of defense.
- Be specific: include file paths, line numbers from the diff, and exact before/after.
- False positives are better than missed weakening. When in doubt, flag it.
- If a finding has a corresponding code change (feature removed), note it as potentially justified but still flag for human review.
- This is a focused checklist review, not an open-ended code audit. Do not expand scope beyond test integrity.