Skip to content

test: catch the missed mutants from the weekly run - #198

Draft
astrovm wants to merge 7 commits into
mainfrom
test/mutants-192
Draft

astrovm wants to merge 7 commits into
mainfrom
test/mutants-192

Conversation

@astrovm

@astrovm astrovm commented Nov 29, 2026

Copy link
Copy Markdown
Member

The weekly mutation run listed 229 missed mutants in Issue #192. This PR adds tests for the real gaps and rewrites code where a mutant cannot change behavior.

Closes #192

Work in progress: the common crate is done. A fresh run on the current code checks which of the other rows still apply, because many rows name code that has changed since the weekly run.

How each finding is handled

Findings File Fix
v.is_finite() guard → true crates/common/src/env.rs New test: Infinity logs "Ignoring invalid numeric value", not "must be an integer". It runs in a child process to read the log.
|| → &&, > → >= crates/common/src/secrets.rs Removed the extra is_symlink() check: symlink_metadata already reports a symlink as not a file. New tests: a directory is rejected, and a 4096-byte file is accepted.
| → ^ crates/common/src/security.rs New test: ab against ba, where the byte differences cancel out under ^.
16 * 1024 → 16 + 1024 crates/common/src/security.rs New test: the body limit is 16 384 bytes. The other tests use the constant, so they cannot see a change in its value.
- → +, / → % in RouteRateLimiter::check crates/common/src/security.rs The window age is now computed once, and Retry-After uses u64::div_ceil instead of a float. New test: a window that starts at 600 ms denies at 1000 and 1599 ms with Retry-After: 1, and opens again at 1600 ms.
is_triggered → false, || → && crates/common/src/shutdown.rs sleep no longer checks is_triggered first: wait already returns at once after a trigger. The test now checks is_triggered() after the trigger.

All changes

  1. crates/common/src/env.rs: a test for the Infinity warning.
  2. crates/common/src/secrets.rs: one file-type check instead of two; directory and 4096-byte tests.
  3. crates/common/src/security.rs: RouteRateLimiter::check computes the window age once and rounds Retry-After with integers; tests for the bearer check, the body limit and a window that does not start at 0.
  4. crates/common/src/shutdown.rs: one early return in sleep; the test checks is_triggered.

Done when

  • cargo fmt --check, cargo clippy -p timba-common --all-targets -D warnings and cargo test -p timba-common (35 pass) on f85da76.
  • cargo-mutants on every row of Issue Missed mutants #192 that still matches the current code: no missed mutant, or each one excluded with a reason.
  • cargo test --workspace passes.
  • CI green.
  • Agent review.

Review

Pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missed mutants

1 participant