Canonical source:
RUST_ENFORCEMENT.md Β§12 Gates Β· checker scripts/ci/check-crate-gates.sh (JSON output matches olympus CrateGates TypeScript schema).Live progress: / crates admitted Β· WIP ().The 12 gates
Gate 1 β SPEC
A crate spec exists at
docs/crate-specs/<crate>.md. It declares:
purpose, layer (L0/L0.5/L1/L2/L3/L4), LOC budget, public API surface,
security axes, tracked ADRs. No code before spec.Gate 2 β TDD
Tests written before implementation. The commit history shows
RED before GREEN: failing tests on one commit, minimal
implementation on the next. Reviewed in gate 11.
Gate 3 β IMPL
Minimal implementation. Compiles with
cargo build --workspace.
Every test green with cargo test --workspace --lib. No # TEMP
without a removal plan. No #[allow(dead_code)]. No files >1500 LOC.Gate 4 β CLIPPY 0
cargo clippy --workspace --all-targets -- -D warnings β zero warnings.
unwrap_used = "deny" enforced workspace-wide. Zero .unwrap() /
.expect( in src/ outside #[cfg(test)].Gate 5 β MUTATION β₯ 90%
cargo mutants -p <crate> β at least 90% of mutants killed. Catches
untested branches, βhappy path onlyβ tests, dead clauses. Data-heavy
crates (e.g., nika-catalog) may use 85% with justification in spec.Gate 6 β PROPERTY
Property tests via
proptest for any crate touching: security,
parsers, encoding, taint propagation, capability resolution. Regression
seeds checked into proptest-regressions/.Gate 7 β BENCHMARKS
benches/ directory with criterion if the crate is on a hot path
(parsers, catalog lookup, template resolution). Waivable for pure-types
crates with justification in spec.Gate 8 β DOCS
cargo doc --no-deps --document-private-items β zero warnings. All
public items documented. #[doc(hidden)] used sparingly and with reason.Gate 9 β CANARY E2E
A
.nika.yaml canary workflow under tests/canary-<crate>.nika.yaml
exercises the crate end-to-end against the rest of the workspace.
Waivable for L0 foundation crates with no runtime surface.Gate 10 β PARITY LEGACY
Golden test comparing output against the legacy v0.79 implementation
(read via
git show main:path/to/file.rs). Flags behavior drift from
v0.79 for conscious review. Landing from Phase 5+.Gate 11 β REVIEW SWARM
Three parallel agents review the PR:
spn-nika:code-reviewer +
spn-rust:rust-pro + feature-dev:code-reviewer. Every P0 and P1
finding must be fixed in the same session before merge.Why twelve
Each gate catches a failure mode seen in production Rust codebases at
scale. Dropping any one means accepting a known regression vector.
| Gate | Failure mode caught |
|---|---|
| SPEC | Scope creep, missing layer contract, undeclared axes |
| TDD | Tests that retrofit the implementation (always green from commit 1) |
| IMPL | Oversized files, dead code, TEMP debt |
| CLIPPY | Panic-prone patterns, hidden bugs flagged by lints |
| MUTATION | β100% test coverageβ with zero real assertions |
| PROPERTY | Edge cases in parsers / taint / crypto that example-based tests miss |
| BENCHMARKS | Silent perf regression on hot paths |
| DOCS | Undocumented public API, broken intra-doc links |
| CANARY | Integration breaks hidden by unit-test success |
| PARITY | Silent behavior drift from the v0.79 baseline |
| REVIEW | Single-reviewer blind spots |
| ATOMIC | Merge-commit noise, non-bisectable history |
Exemptions
A gate is genuinely not applicable for some crate types:benches/for a pure-types crate with no hot path.- Canary E2E for L0 foundation (nothing to execute end-to-end).
- PARITY for crates with no v0.79 counterpart (Diamond-original code).
docs/crate-specs/<crate>.md with a
1-paragraph justification. They are not defaults β they are deliberate.
Admission cadence
The rhythm: 1 crate admission = 1 commit = 1 tag increment a per-admission alpha tag (v0.8x.0-alpha.N). Every 4 weeks, a blog post or dev log entry. Public
accountability.
See also
Layer registry
Six layers. Mechanical sort test to pick the right layer for a new crate.
Forward-compat invariants
Eight patterns. The public-API contract every admitted crate honors.
L0 foundation decisions
Q1-Q13 locked β the per-crate decisions that shaped todayβs L0.
Constellation
Live progress: admitted, WIP, planned.