diff --git a/config/opencode/commands/workflow.md b/config/opencode/commands/workflow.md index af99cbe..1e2a8eb 100644 --- a/config/opencode/commands/workflow.md +++ b/config/opencode/commands/workflow.md @@ -229,14 +229,15 @@ For each task from Phase 5, dispatch `@test` with: `@test` writes failing tests and verifies RED with structured failure codes. **Post-step file gate (MANDATORY):** -Before dispatching `@test`, snapshot the current changed files: +Before dispatching `@test`, snapshot every modified, staged, *and untracked* file. `git diff --name-only` alone misses untracked files, which is precisely the state of any new test file `@test` creates (it cannot `git add`). Use `git status --porcelain` so the gate sees them: ```bash -git diff --name-only > /tmp/pre_test_baseline.txt +git status --porcelain | sed 's/^...//' | sort -u > /tmp/pre_test_baseline.txt ``` -After `@test` completes, validate only NEW changes: +After `@test` completes, list NEW changes (in the post-snapshot but not the pre-snapshot): ```bash -git diff --name-only | comm -23 - /tmp/pre_test_baseline.txt > /tmp/test_new_files.txt +git status --porcelain | sed 's/^...//' | sort -u | comm -23 - /tmp/pre_test_baseline.txt > /tmp/test_new_files.txt ``` +Each line in `/tmp/test_new_files.txt` is a file path that did not exist (or was unmodified) before `@test` ran. The gate validates each one against the patterns below. All new files must match the project's test patterns: - Python: `**/test_*.py`, `**/*_test.py`, `**/conftest.py` (new only), `**/test_data/**`, `**/test_fixtures/**` - Rust: `tests/**/*.rs`, `**/tests/**/*.rs` (workspace-style `/tests/...`), `**/test_data/**`, `**/test_fixtures/**`