shunt / tests
AGENTS.md267 starsChanged 25 days agoApache-2.0View on GitHub
- Run all tests from repository root: cargo test --all-features --workspace - Run integration tests from repository root: cargo test --test passthrough and cargo test --test responses_translate - Run one grouped binary: cargo test --test spend. Run one file inside it by its module path: cargo test --test spend spend_headers::. - Run quality gates from repository root: cargo fmt --all --check and cargo clippy --all-targets --all-features -- -D warnings - passthrough.rs uses Wiremock and a real Axum server to verify…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 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
11 rules. About 0 are common, 3 are distinctive, and 8 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.
8
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 one grouped binary: cargo test --test spend.
- Very specific: line 9
Run quality gates from repository root: cargo fmt --all --check and cargo clippy --all-targets --all-features -- -D warnings
- Distinctive: line 15
Prefer behavior-focused assertions over implementation-only assertions.
- Very specific: line 39
Every test binary statically links the whole dependency graph, so related files are grouped into one binary each, using cargo's …
- Very specific: line 48
Every other tests/*.rs file is a standalone binary.
- Very specific: line 63
Add protocol integration tests in tests/ when behavior crosses module boundaries.
- Very specific: line 64
Keep module-local unit tests inside the relevant src/ file for focused helper behavior.
- Distinctive: line 70
Avoid live network calls; use Wiremock or pure fixtures.
- Distinctive: line 75
Keep test names descriptive of the externally observable behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 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 one grouped binary:
cargo test --test spend. Run one file inside it by its module path:cargo test --test spend spend_headers::. - 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
- Every test binary statically links the whole dependency graph, so related
files are grouped into one binary each, using cargo's
tests/<dir>/main.rslayout. Each file is a module of its group'smain.rs, under its own name:tests/spend/—spend_enforcement,spend_headers,spend_metering,spend_metering_routing,spend_persistence.tests/codex/—codex_spend_enforcement,codex_spend_metering,codex_spend_websocket,codex_websocket_fallback,codex_websocket_gated.tests/inbound/—inbound_authand theinbound_codex_*files.tests/multi_account/—multi_accountand every<provider>_multi_account.
- Every other
tests/*.rsfile is a standalone binary. The other directories undertests/(common/,judge_harness/,store_boot/,buffer_replay/,driven_lane/,response_coding_support/) have nomain.rs: they are support modules, not binaries. - A new test file joins the matching group: put it in the group's directory and
add
mod <name>;to itsmain.rs. Make it a standalonetests/*.rsfile only when it needs process-global state of its own (antigravity_process.rssets env values that outlive every test;count_tokens_warmup.rsasserts a process-wideOnceLockis still cold), or when CI names it with--test(router_surface,prefill_router). - A grouped binary declares a shared support module exactly once, in its
main.rs(#[path = "../common/mod.rs"] mod common;, likewisejudge_harness); its modules writeuse crate::common;. A secondmod common;would compile a second env lock into the same process, andtests/env_lock_coverage.rsfails on it. - 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.

