Compare commits

...
3 Commits
Author SHA1 Message Date
swaits 871c688b17 style: rustfmt the new builder setter test
CI / check (macos-latest, 1.93.0) (push) Canceled after 0s
CI / check (macos-latest, stable) (push) Canceled after 0s
CI / check (ubuntu-latest, 1.93.0) (push) Canceled after 0s
CI / check (ubuntu-latest, stable) (push) Canceled after 0s
CI / check (windows-latest, 1.93.0) (push) Canceled after 0s
CI / check (windows-latest, stable) (push) Canceled after 0s
CI / cargo deny (push) Canceled after 0s
CI / cargo audit (push) Canceled after 0s
CI / cargo semver-checks (push) Canceled after 0s
CI / coverage (push) Canceled after 0s
CI / examples build (push) Canceled after 0s
CI / stateright BFS N=3 K=2 (push) Canceled after 0s
2026-05-13 10:32:57 -06:00
swaits 312d958a91 ci: close the two missed cargo-mutants in src/builder.rs
Shard 0 of the nightly mutation run reported two MISSED mutants:

  src/builder.rs:178  Builder::failure_retry_period -> Self
  src/builder.rs:210  Builder::dht_backend          -> Self

Both replaced the setter body with `Default::default()`, wiping the
receiver's accumulated state. The existing #[cfg(test)] mod tests has
one of these `<setter>_setter_stores_exact_value` pinning tests for
nearly every other Builder method, but these two were missing:

  - failure_retry_period: no test exercised the setter at all.
  - dht_backend: the method and its callers (build_wait_none_does_not_block
    et al.) are gated `#[cfg(feature = "test-support")]`, but
    cargo-mutants ran with default features only, so neither the method
    nor its tests were ever compiled — the mutation survived trivially.

Fixes:
  - Add `failure_retry_period_setter_stores_exact_value` matching the
    pattern of the other setter tests.
  - Add `dht_backend_setter_stores_value` (gated on `test-support`).
  - Set `additional_cargo_args = ["--features", "test-support"]` in
    .cargo/mutants.toml so cfg-gated setters are part of the mutation
    surface.

Verified locally: `cargo mutants --file src/builder.rs` → 17 mutants,
16 caught, 1 unviable, 0 missed.
2026-05-13 10:27:34 -06:00
swaits 2c28dd77b4 ci: fix nightly workflow (4 longstanding failures)
The nightly workflow has failed every run since it was added. Fix the
four distinct issues so it can actually exercise the slow checks:

- cargo-mutants: drop bogus `--in-diff-base ""` flag (never existed in
  cargo-mutants; v27 rejects it).
- fuzz smoke: pin `--target x86_64-unknown-linux-gnu`. Binstall ships a
  musl-static cargo-fuzz binary whose default target inherits its own
  triple, and libfuzzer's sanitizer is incompatible with `crt-static`.
- miri: move multi-module filters after `--`. `cargo test` only accepts
  one TESTNAME positional; libtest accepts multiple substring filters.
- stateright random_large: add `target_state_count(1_000_000)` so the
  simulation actually terminates instead of looping past the 30 min CI
  timeout. The comment already claimed "up to 10⁶ states".

Also refreshes fuzz/Cargo.lock, regenerated by the local verification
build (was stale vs. parent deps).
2026-05-13 09:52:52 -06:00
5 changed files with 646 additions and 449 deletions

No files matched your search

+6
View File
@@ -7,6 +7,12 @@ test_tool = "nextest"
# Async tests + crypto work takes longer under mutation load.
timeout_multiplier = 3.0
# Enable `test-support` so cfg-gated setters (e.g. Builder::dht_backend) and
# the integration tests that exercise them are part of the mutation surface.
# Without this, dht_backend mutations always "survive" trivially because the
# method isn't compiled in.
additional_cargo_args = ["--features", "test-support"]
# Skip paths that either can't be meaningfully mutated or are covered by
# other tools:
# - sim_impl.rs: simulator is exercised via the simulator example, not
+11 -5
View File
@@ -25,9 +25,11 @@ jobs:
- name: miri on keys/wire/crypto/merge
env:
MIRIFLAGS: -Zmiri-disable-isolation
# Quoted because YAML plain scalars can't contain `: ` sequences
# without being misparsed as mapping entries.
run: "cargo +nightly miri test --lib keys:: wire:: crypto:: merge::"
# `cargo test` takes a single TESTNAME positional, so multi-module
# filters must be passed to the test binary after `--`. Quoted because
# YAML plain scalars can't contain `: ` sequences without being
# misparsed as mapping entries.
run: "cargo +nightly miri test --lib -- keys:: wire:: crypto:: merge::"
mutants:
name: cargo-mutants
@@ -43,7 +45,7 @@ jobs:
- uses: taiki-e/install-action@v2
with:
tool: cargo-mutants,cargo-nextest
- run: cargo mutants --shard ${{ matrix.shard }}/4 --in-diff-base ""
- run: cargo mutants --shard ${{ matrix.shard }}/4
fuzz-smoke:
name: fuzz smoke (60s / target)
@@ -63,7 +65,11 @@ jobs:
- uses: taiki-e/install-action@v2
with:
tool: cargo-fuzz
- run: cd fuzz && cargo +nightly fuzz run ${{ matrix.target }} -- -max_total_time=60
# `--target` is explicit because the binstall'd `cargo-fuzz` binary is a
# statically-linked musl build, and `cargo fuzz`'s default target is the
# triple it was compiled for. The libfuzzer sanitizer is incompatible
# with the static-crt musl target, so force the glibc triple.
- run: cd fuzz && cargo +nightly fuzz run --target x86_64-unknown-linux-gnu ${{ matrix.target }} -- -max_total_time=60
kani:
name: kani
+604 -444
View File
File diff suppressed because it is too large. Load diff
+24
View File
@@ -470,6 +470,30 @@ mod tests {
assert_eq!(Builder::default().heal_period(d).heal_period, d);
}
#[test]
fn failure_retry_period_setter_stores_exact_value() {
let d = Duration::from_millis(42);
assert_eq!(
Builder::default()
.failure_retry_period(d)
.failure_retry_period,
d
);
}
#[test]
#[cfg(feature = "test-support")]
fn dht_backend_setter_stores_value() {
use std::sync::Arc;
use crate::sim::InMemoryDht;
let dht = Arc::new(InMemoryDht::new());
let before = Builder::default();
let after = Builder::default().dht_backend(dht);
assert!(before.dht_backend.is_none());
assert!(after.dht_backend.is_some());
}
#[test]
fn jitter_setter_stores_exact_value() {
let b = Builder::default().jitter(0.25);
+1
View File
@@ -278,6 +278,7 @@ fn random_large() {
.checker()
.threads(num_cpus())
.target_max_depth(50)
.target_state_count(1_000_000)
.spawn_simulation(0, stateright::UniformChooser)
.join()
.assert_properties();