john-slop/docs/development.md

3.6 KiB

Development

The project uses Rust edition 2024 and requires Rust 1.98.1 or newer. The committed lockfile makes application builds reproducible. Linux is the supported and exercised platform; other platforms are not declared supported until CI covers them. Jenkins checks Linux on both Rust 1.98.1 (the MSRV) and current stable, with all features and without default features.

Quality gates

Run the same core checks required by the contributor guide:

cargo fmt --all -- --check
cargo clippy --locked --all-targets --all-features -- -D warnings
cargo test --locked --all-targets --all-features
cargo test --locked --all-targets --no-default-features
cargo doc --locked --no-deps --all-features
cargo audit --deny warnings
cargo deny --locked check

The default fancy-diagnostics feature enables miette's rich terminal renderer. The no-default-features test run ensures the shared library and all binaries remain valid without that optional renderer. Focused unit and integration tests cover domain invariants, input failures, archives, CLI exit behavior, and feature configurations.

CI runs the executable fixture manifest and Insta CLI snapshots explicitly in addition to the full suite. cargo-audit rejects RustSec advisories and yanked packages. deny.toml rejects unknown dependency sources, wildcard versions, and licenses outside the reviewed allow-list; duplicate versions are reported for review while upstream compatibility is assessed.

Insta snapshots are reserved for stable user-facing text such as CLI help and usage errors. Structured domain values use direct assertions so failures remain precise and easy to review. Accept snapshot changes only after inspecting the generated diff.

Coverage and badges

Run line coverage with Cargo Tarpaulin:

cargo tarpaulin --config tarpaulin.toml

The configuration enforces a 30% floor. The current suite measured 80.17% (1156/1442 lines) on 2026-09-29. The low floor is intentional because CLI subprocess attribution varies between coverage backends; the tracked badge still reports the measured result.

After a clean test and coverage run, refresh the repository-local badges with:

rust_autobadges --high-coverage-percent 0.7 --mid-coverage-percent 0.3

Commit badges/*.svg and .run_status.toml; do not commit the generated tarpaulin-report.html. Jenkins runs both feature configurations and enforces the Tarpaulin floor before building release binaries.

Test scope

Add behavior tests at the lowest useful layer and an integration test when a change crosses a binary boundary. Important edge cases include malformed input, invalid UTF-8, empty text, Unicode byte spans, deterministic ordering, archive limits, and near misses for detection rules. The detailed expectations and task-level commit discipline are in AGENTS.md.

Each completed milestone receives an immutable annotated milestone-N Git tag after its acceptance criteria and quality gates pass.

Fuzzing

The standalone fuzz package contains five cargo-fuzz targets and reviewed seeds for configuration merging, rule validation/compilation, UTF-8 span conversion, replacement invariants, and hostile archive bytes. See its README for invocation. Fuzz artifacts remain ignored until a failure has been minimized and promoted to a normal regression test.

Benchmarks

Run cargo bench --locked --bench core for the large-document, many-file, rule-scaling, and archive-limit workloads described in Performance benchmarks. Benchmark reports are local artifacts; only methodology and contextualized measurements belong in version control.