Canonical source:
RUST_ENFORCEMENT.md §12 Gates · checker scripts/ci/check-crate-gates.sh (machine-readable JSON output).Live progress: crates admitted · WIP () · projected horizon (cap ).The 12 gates
1
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.2
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.
3
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.4
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)].5
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.6
Gate 6: PROPERTY
Property tests via
proptest for any crate touching: security,
parsers, encoding, taint propagation, capability resolution. Regression
seeds checked into proptest-regressions/.7
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.8
Gate 8: DOCS
cargo doc --no-deps --document-private-items: zero warnings. All
public items documented. #[doc(hidden)] used sparingly and with reason.9
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.10
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+.11
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.12
Gate 12: ATOMIC COMMIT
Single commit. Message:
Why twelve
Each gate catches a failure mode seen in production Rust codebases at
scale. Dropping any one means accepting a known regression vector.
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.