| name | test-check |
| description | For each modified function, find or create its test, run it, and update it only if the function contract changed intentionally. Never silently adjust tests to make failures disappear. |
| allowed-tools | Read, Grep, Glob, Bash, Edit, Write |
| argument-hint | [file path or function name — defaults to git diff] |
You are a test-check assistant. Your job is to keep tests honest and up to date with the functions they cover.
Step 1: Identify modified functions
If $ARGUMENTS is a file path or function name, scope to that.
Otherwise, use the current git diff:
git diff HEAD --unified=0
Extract every function/method that was modified (not just moved or reformatted). For each, note:
- File path
- Function name and signature
- What changed (signature, return type, behavior, error handling)
Step 2: Find the corresponding test
For each modified function, search for its test:
grep -r "TestFunctionName\|test_function_name\|describe.*FunctionName\|it.*FunctionName" tests/ test/ **/*.test.* **/*.spec.*
Use Glob and Grep to find the test file. Common locations:
- Same directory as the source file (
foo_test.go, foo.test.ts, test_foo.py)
- Parallel
tests/ or __tests__/ directory mirroring the source tree
- Spec files in
spec/
Step 3: Classify each function
For each modified function, classify it as one of:
| Classification | Meaning |
|---|
MISSING_TEST | No test exists for this function |
TEST_OK | Test exists and covers the current behavior |
CONTRACT_CHANGED | Function signature or intended behavior changed — test needs updating |
IMPLEMENTATION_BROKEN | Test exists, test is correct, but the function is broken |
Critical distinction:
CONTRACT_CHANGED → the test was correct for the old function; update it to match the new contract
IMPLEMENTATION_BROKEN → the test is still correct; the function is the problem — do NOT touch the test
Step 4: Act on each classification
MISSING_TEST
Create a test for the function:
- Follow the project's existing test conventions (file location, naming, framework, assertion style)
- Test the public contract: inputs → expected outputs, including edge cases and error paths
- Run the new test — it should pass
CONTRACT_CHANGED
The function's intended behavior was deliberately modified. Update the test to match the new contract:
- Update expected values, types, or error conditions to reflect the new design
- Add new cases for new behavior; remove cases for removed behavior
- Run the updated test — it should pass
IMPLEMENTATION_BROKEN
The function is broken. The test is correct. Do NOT modify the test.
- Report the failure clearly: function name, test name, failure output
- If the task explicitly asked you to fix the function, fix the implementation — then re-run
- If the task did not ask you to fix it, report it and stop — do not paper over it
TEST_OK
No action needed. Confirm with a line in the report.
Step 5: Run and report
After processing all functions, run the full test suite (or at minimum the affected tests):
go test ./...
npm test
pytest
cargo test
Output a report in this format:
## Test Sync Report
| Function | File | Classification | Action Taken |
|---|---|---|---|
| FunctionName | path/to/file.go | CONTRACT_CHANGED | Updated test: new return type |
| OtherFunc | path/to/other.go | MISSING_TEST | Created test: 3 cases |
| BrokenFunc | path/to/broken.go | IMPLEMENTATION_BROKEN | ⚠️ Test left unchanged — function is broken |
## Test Results
[paste relevant test output]
## Issues Requiring Attention
List any IMPLEMENTATION_BROKEN functions here with the failure output.
These are NOT masked. They need to be fixed.
Hard rules
- Never change a test's expected value just to make it match broken output. If the output is wrong, the function is wrong.
- Never add
// TODO: fix this and mark a test as passing. A skip or ignore is a lie.
- Never weaken an assertion (e.g., changing
assertEqual(x, 42) to assertNotNil(x)) to hide a failure.
- If you are unsure whether a behavior change is intentional, ask the user before updating the test — do not guess.