| name | rust-quality-gate |
| description | PM-invocable protocol for running and interpreting Rust quality gates in the trusty-tools monorepo: fmt, clippy, and test in strict sequence before any merge |
| user-invocable | false |
| disable-model-invocation | true |
| version | 1.0.0 |
| category | toolchain |
| author | Claude MPM Team |
| license | MIT |
| progressive_disclosure | {"entry_point":{"summary":"Three-gate quality sequence (fmt → clippy → test) that must pass before any PR merge in a Rust workspace","when_to_use":"Before any PR merge, after implementation work, or when user says 'check quality', 'run tests', 'verify', or 'is this ready to merge'","quick_start":"1. cargo fmt --check 2. cargo clippy --workspace --all-targets -- -D warnings 3. cargo test -p <crate> — stop on first failure"},"token_estimate":{"entry":130,"full":1600}} |
| context_limit | 750 |
| tags | ["rust","quality","testing","clippy","fmt","cargo","ci","monorepo","qa"] |
| requires_tools | [] |
Rust Quality Gate Protocol
When to Invoke
Invoke this protocol when:
- Any implementation task completes and code changes are ready to commit
- User asks "check quality", "run tests", "run clippy", "is this ready", or "verify"
- Before creating a pull request or merging to main
- After modifying a shared library crate (
trusty-common, trusty-mcp-core, trusty-embedder, trusty-symgraph)
- After the rust-qa agent delivers a work product
The Three-Gate Sequence
Run gates in this exact order. Stop on first failure — do not proceed to the next gate.
Gate 1: Format Check (fastest — always run first)
cargo fmt --check
Pass: No output, exit code 0.
Fail: Lists files with formatting differences. Fix with:
cargo fmt
Then re-run cargo fmt --check to confirm clean.
Why first: Format failures are trivially fixable. Running it first avoids wasting clippy and test time on unformatted code.
Gate 2: Clippy Lint Gate
cargo clippy --workspace --all-targets -- -D warnings
Pass: No warnings emitted, exit code 0.
Fail: One or more error[clippy::] lines. Fix each warning the compiler reports. Common patterns:
cargo clippy -p trusty-search -- -D warnings
cargo clippy -p trusty-common --features axum-server -- -D warnings
open-mpm exception: open-mpm has 142 pre-existing clippy errors at HEAD (tracked separately). These errors do not block other work. When running workspace-wide clippy and open-mpm fails, confirm whether the failures are confined to open-mpm only:
cargo clippy --workspace --all-targets -- -D warnings 2>&1 | grep -v