fix(opencode): reject Rust src/tests/ paths as a wrong task spec
A workflow run on a Bevy/Rust project produced the test-file path `src/tests/test_<feature>.rs`, which @test correctly flagged as contradictory: it isn't a valid Rust test location (would require declaring `mod tests;` in production source, which @test cannot do) yet the file-gate glob `**/tests/**/*.rs` accidentally matched it. Phase 5 now gives language-aware Test File guidance: Python uses colocated or top-level `tests/`, Rust uses crate-level `tests/<feature>.rs`, and Rust unit-only tasks are routed to NOT_TESTABLE for @make to handle inline. Phase 6's file gate gains an explicit anti-pattern clause discarding any new file under `src/` even when the glob matches. @test's own File Constraint mirrors the anti-pattern so the agent rejects the bad path with BLOCKED before the orchestrator's gate even runs — defense in depth on both sides of the dispatch boundary.
This commit is contained in:
parent
e2e35acdae
commit
d5d90d8b9f
2 changed files with 22 additions and 3 deletions
|
|
@ -119,6 +119,9 @@ Rust (integration tests only — see "Rust unit tests" below):
|
|||
- `**/test_data/**`
|
||||
- `**/test_fixtures/**`
|
||||
|
||||
**Anti-patterns — refuse the path even if the glob above matches:**
|
||||
- Anything under `src/` (e.g. `src/tests/foo.rs`, `src/**/tests/...`). `src/tests/` is a regular module under `src/`; it would require declaring `mod tests;` in production code (`lib.rs` / `main.rs`) and creating `mod.rs`, which you cannot do. If the caller asks for such a path, treat it as a wrong task spec: return `BLOCKED` with a note that the path is not a valid Rust test location, suggesting `tests/<feature>.rs` (or `NOT_TESTABLE: Rust unit-only` if the test really needs to be in-source).
|
||||
|
||||
**You may NOT modify production/source code under any circumstances.**
|
||||
|
||||
### Rust unit tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue