agentleFS
pleaseaipleaseai/shunt/tests/AGENTS.md

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…

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
  1. Very specific:

    Run all tests from repository root: cargo test --all-features --workspace

    line 5
  2. Very specific:

    Run integration tests from repository root: cargo test --test passthrough and cargo test --test responses_translate

    line 6
  3. Very specific:

    Run quality gates from repository root: cargo fmt --all --check and cargo clippy --all-targets --all-features -- -D warnings

    line 7
  4. Distinctive:

    Prefer behavior-focused assertions over implementation-only assertions.

    line 13
  5. Very specific:

    Add protocol integration tests in tests/ when behavior crosses module boundaries.

    line 37
  6. Very specific:

    Keep module-local unit tests inside the relevant src/ file for focused helper behavior.

    line 38
  7. Distinctive:

    Avoid live network calls; use Wiremock or pure fixtures.

    line 44
  8. Distinctive:

    Keep test names descriptive of the externally observable behavior.

    line 49

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 passthrough and cargo test --test responses_translate
  • Run quality gates from repository root: cargo fmt --all --check and cargo clippy --all-targets --all-features -- -D warnings

Testing

  • 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 the single global environ array, so a write to any variable can be observed by a concurrent getenv for 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.rs enforces the ban on raw writes: it scans for the set_var/remove_var spellings, 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.rs and tests/env_guard.rs hold 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 in tests/env_lock_coverage.rs by 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.