shunt / tests
AGENTS.md226 starsChanged 2 months agoApache-2.0View on GitHub
- passthrough.rs uses Wiremock and a real Axum server to verify gateway HTTP behavior. - responses_translate.rs verifies Anthropic Messages → OpenAI Responses request conversion and Responses SSE → Anthropic SSE conversion. - Prefer behavior-focused assertions over implementation-only assertions. - A test that touches the process environment takes the shared guard from tests/common/mod.rs — common::set_env(..).await in an async test, common::set_env_blocking(..) in a sync one — and holds it for the whole body. Never call std::env::set_var or std::env::remove_var directly. setenv may reallocate…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- src/AGENTS.mdAGENTS.md
- wiki/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- src/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- wiki/CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- wiki/llms-full.txtllms.txt
- wiki/llms.txtllms.txt
- run-claude-gateway-refSkill
- run-shuntSkill
- verifySkill
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 5
Run all tests from repository root: cargo test --all-features --workspace
- Very specific: line 6
Run integration tests from repository root: cargo test --test passthrough and cargo test --test responses_translate
- Very specific: line 7
Run quality gates from repository root: cargo fmt --all --check and cargo clippy --all-targets --all-features -- -D warnings
- Distinctive: line 13
Prefer behavior-focused assertions over implementation-only assertions.
- Very specific: line 37
Add protocol integration tests in tests/ when behavior crosses module boundaries.
- Very specific: line 38
Keep module-local unit tests inside the relevant src/ file for focused helper behavior.
- Distinctive: line 44
Avoid live network calls; use Wiremock or pure fixtures.
- Distinctive: line 49
Keep test names descriptive of the externally observable behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
tests Agent Instructions
Build & Run Commands
- Run all tests from repository root:
cargo test --all-features --workspace - Run integration tests from repository root:
cargo test --test passthroughandcargo test --test responses_translate - Run quality gates from repository root:
cargo fmt --all --checkandcargo clippy --all-targets --all-features -- -D warnings
Testing
passthrough.rsuses Wiremock and a real Axum server to verify gateway HTTP behavior.responses_translate.rsverifies Anthropic Messages → OpenAI Responses request conversion and Responses SSE → Anthropic SSE conversion.- Prefer behavior-focused assertions over implementation-only assertions.
- A test that touches the process environment takes the shared guard from
tests/common/mod.rs—common::set_env(..).awaitin an async test,common::set_env_blocking(..)in a sync one — and holds it for the whole body. Never callstd::env::set_varorstd::env::remove_vardirectly.setenvmay reallocate the single globalenvironarray, so a write to any variable can be observed by a concurrentgetenvfor an unrelated one as a missing value; unique variable names do not help, and neither does locking only the writers. That last point is why a test that only reads the environment — including indirectly, by building a config or resolving a workspace — takes the guard too.tests/env_lock_coverage.rsenforces the ban on raw writes: it scans for theset_var/remove_varspellings, so a reader that skips the guard is invisible to it. That half of the rule is held up by review, not by the gate. tests/antigravity_process.rsandtests/env_guard.rshold the only reviewed exceptions to that rule: the first because its values must outlive every test in the binary, which a guard that restores on drop cannot express; the second because seeding a pre-existing value is the one thing the guard cannot do for itself. Both are bounded intests/env_lock_coverage.rsby a write count and the region the writes must stay in, so neither is a general licence — do not move ordinary per-test setup into either.
Project Structure
- Add protocol integration tests in
tests/when behavior crosses module boundaries. - Keep module-local unit tests inside the relevant
src/**file for focused helper behavior.
Code Style
- Make fixtures small but representative.
- Assert exact protocol fields for headers, status codes, event names, and tool-call IDs.
- Avoid live network calls; use Wiremock or pure fixtures.
Git Workflow
- Include tests in the same commit as protocol behavior changes.
- Keep test names descriptive of the externally observable behavior.
Boundaries
- ✅ Test regressions for every discovered protocol bug.
- ✅ Keep streaming and header-preservation tests strict.
- ✅ Bind the environment guard to a named local (
let mut vars = ...), never to_—let _ = ...drops it before the test body runs. - ⚠️ Ask before replacing integration coverage with mocks that cover less behavior.
- 🚫 Never delete or weaken tests to make a change pass.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

