From 9d917f9fc5fbe054ae47c288c2928c3d91a04df8 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sun, 4 Oct 2026 22:33:05 +0200 Subject: [PATCH] ci: enforce measured coverage floor and documentation gates --- .cargo/config.toml | 4 ++-- Jenkinsfile | 14 ++++++++++++-- README.md | 6 ++++-- docs/security-and-ci.md | 21 ++++++++++++--------- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index f78e77b..e78b88f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,5 +5,5 @@ rustflags = ["-Clink-arg=-fuse-ld=lld"] incompatible-rust-versions = "fallback" [alias] -# No Rust tests exist yet: report the real baseline without excluding source. -coverage = "llvm-cov --locked --all-targets --all-features --json --summary-only --fail-under-lines 0 --output-path coverage/summary.json" +# Measured across library and application code; do not exclude production sources. +coverage = "llvm-cov --locked --all-targets --all-features --json --summary-only --fail-under-lines 85 --output-path coverage/summary.json" diff --git a/Jenkinsfile b/Jenkinsfile index 35ce7b5..a6a271f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -255,6 +255,16 @@ pipeline { } } + stage('Documentation') { + steps { + sh ''' + set -eu + cargo test --locked --doc --all-features + RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps --all-features + ''' + } + } + stage('Coverage') { steps { sh ''' @@ -372,7 +382,7 @@ pipeline { conclusion: 'SUCCESS', name: 'Rust CI', summary: 'tiny-wb passed CI.', - text: 'RustSec audit, dependency policy, MSRV, formatting, compilation checks, tests, coverage, Clippy and the release build completed successfully. Badge generation and archival run in cleanup. The release runtime smoke test is currently diagnostic only.', + text: 'RustSec audit, dependency policy, MSRV, formatting, compilation checks, tests, documentation, coverage, Clippy and the release build completed successfully. Badge generation and archival run in cleanup. The release runtime smoke test is currently diagnostic only.', title: 'Build Successful' ) @@ -384,7 +394,7 @@ pipeline { conclusion: 'FAILURE', name: 'Rust CI', summary: 'tiny-wb failed CI.', - text: 'RustSec audit, dependency policy, MSRV, formatting, compilation, tests, coverage, Clippy, or the release build failed. Cleanup generates and archives current badges, including failure fallbacks. Check the Jenkins log.', + text: 'RustSec audit, dependency policy, MSRV, formatting, compilation, tests, documentation, coverage, Clippy, or the release build failed. Cleanup generates and archives current badges, including failure fallbacks. Check the Jenkins log.', title: 'Build Failed' ) diff --git a/README.md b/README.md index 1c62550..ba078bb 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,8 @@ not recommended measurement levels. See the [safe-operation section](docs/tinysa ## Development -The Jenkins pipeline checks formatting, compilation, tests, Clippy, and a -release build. Run the equivalent local checks with: +The Jenkins pipeline checks formatting, compilation, tests, documentation, +coverage, Clippy, and a release build. Run the equivalent local checks with: ```console cargo fmt --all -- --check @@ -91,6 +91,8 @@ cargo deny check cargo +1.88.0 check --locked --all-targets --all-features cargo check --locked --all-targets --all-features cargo test --locked --all-targets --all-features +cargo test --locked --doc --all-features +RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps --all-features cargo clippy --locked --all-targets --all-features -- -D warnings ``` diff --git a/docs/security-and-ci.md b/docs/security-and-ci.md index a27b8a3..a5eb85f 100644 --- a/docs/security-and-ci.md +++ b/docs/security-and-ci.md @@ -41,7 +41,9 @@ in this document and review the lockfile diff. Unused direct dependencies were removed while establishing the lock: `clap`, `once_cell`, `ratatui-splash-screen`, and `tui-textarea`. Removing them reduces download/build surface and makes policy results describe code that the -application actually uses. +application actually uses. The acquisition refactor also removed direct +`packed_struct` and `memchr` dependencies: standard-library little-endian +decoding and buffered framing now provide those functions. ## Pinned policy tools @@ -119,6 +121,8 @@ cargo fmt --all -- --check cargo +1.88.0 check --locked --all-targets --all-features cargo check --locked --all-targets --all-features cargo test --locked --all-targets --all-features +cargo test --locked --doc --all-features +RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps --all-features cargo clippy --locked --all-targets --all-features -- -D warnings cargo build --locked --release --all-features ``` @@ -159,20 +163,19 @@ cargo coverage The exact alias is tracked in `.cargo/config.toml` and expands to: ```console -cargo llvm-cov --locked --all-targets --all-features --json --summary-only --fail-under-lines 0 --output-path coverage/summary.json +cargo llvm-cov --locked --all-targets --all-features --json --summary-only --fail-under-lines 85 --output-path coverage/summary.json ``` -The enforced line-coverage floor is **0%**: no Rust tests currently exist. -Local measurement on 2026-10-04 was **0 of 1,024 lines (0%)**. -This is an honest initial baseline, not evidence of application correctness. -No ordinary production sources are excluded. Raise the floor as meaningful -protocol and application tests are introduced. A passing test badge means the -required test commands succeeded, even when the Rust harness contains zero tests. +The enforced line-coverage floor is **85%**, measured across the library and +application without excluding production sources. Local measurement on 2026-10-04 was **1,460 of 1,634 lines (89.35%)**, +with 30 unit/integration tests and one separately run Rustdoc example. Tests +cover configuration, protocol, transport, acquisition, export, UI and startup. The floor leaves some headroom for +platform differences; it is not evidence of device/firmware correctness. `scripts/collect-coverage.sh` runs that command, validates the overall line percentage from temporary `coverage/summary.json`, renders the coverage badge, and deletes the summary, including on failure. Jenkins then creates the current -build's test and coverage markers only after both required test runs succeed. +build's test and coverage markers only after unit/integration tests, Rustdoc tests, and the coverage test run succeed. The release smoke test remains a nonfatal diagnostic. At checkout, CI recreates ignored `coverage/` to remove stale workspace state.