Skip to content

test(baseline): close 9 mutation-test gaps (#35)#63

Merged
Metbcy merged 2 commits into
mainfrom
test/baseline-mutation-survivors-35
Jun 1, 2026
Merged

test(baseline): close 9 mutation-test gaps (#35)#63
Metbcy merged 2 commits into
mainfrom
test/baseline-mutation-survivors-35

Conversation

@Metbcy
Copy link
Copy Markdown
Owner

@Metbcy Metbcy commented Jun 1, 2026

Summary

Closes 9 of the 9 surviving mutants on `src/baseline.rs` found in the issue #35 round-1 mutation audit. Pure test additions; no source changes.

Mutants closed

From `cargo mutants --in-place --no-shuffle --file src/baseline.rs --timeout 60` (round-1 baseline: 54 mutants tested in 24m, 9 missed, 42 caught, 3 unviable):

line:col mutant catching test
151:37 replace `&&` with `||` in `from_value_inner` (typosquats arm) `typosquat_key_requires_both_purl_and_closest_nonempty`
176:37 replace `&&` with `||` in `from_value_inner` (maintainer_age arm) `maintainer_age_key_requires_both_purl_and_contributor_nonempty`
176:20 delete `!` on `purl.is_empty()` (same)
176:40 delete `!` on `contrib.is_empty()` (same)
320:9 delete `!` in `apply` maintainer_age retain `apply_drops_matched_maintainer_age_and_keeps_unmatched`
414:26 replace `||` with `&&` in `add_suppression_full` `add_suppression_full_writes_object_form_with_expires_only` + `_with_reason_only`
429:12 delete `!` on `parent.as_os_str().is_empty()` `add_suppression_full_writes_object_form_with_expires_only` (nested path exercises this)
523:5 replace `doc_kind` with `""` `add_suppression_full_error_names_actual_root_type` + `doc_kind_maps_each_json_variant_to_its_label`
523:5 replace `doc_kind` with `"xyzzy"` (same)

Verification

  • `cargo test --lib baseline::` → 32 passed, 0 failed (was 25)
  • `cargo clippy --all-targets -- -D warnings` → clean
  • Re-running `cargo mutants --in-place --file src/baseline.rs` on this branch is in flight; will append outcome to the docs audit log in a follow-up PR alongside the other module recheck results.

Notes

  • Each test's docstring names the `line:col` of the original mutant, so future mutants runs that revive any of these can be traced back to the test that should have caught it.
  • The module audit log in `docs/src/internals/mutation-testing.md` will be updated in a follow-up PR once all round-2 modules are landed (typosquat, license, maintainer next).

Part of #35.

Adds 7 targeted tests covering the surviving mutants reported by
`cargo mutants --file src/baseline.rs` in the round-1 audit:

- typosquat_key_requires_both_purl_and_closest_nonempty
  catches the && -> || mutant in from_value_inner (line 151)

- maintainer_age_key_requires_both_purl_and_contributor_nonempty
  catches three mutants on line 176: && -> ||, delete ! on purl,
  delete ! on contrib

- apply_drops_matched_maintainer_age_and_keeps_unmatched
  catches delete ! on line 320 (retain predicate)

- add_suppression_full_writes_object_form_with_expires_only
  catches || -> && on line 414 (object-form gating) plus delete !
  on line 429 (parent-dir creation, exercised via nested path)

- add_suppression_full_writes_object_form_with_reason_only
  symmetric coverage of the other side of the || at line 414

- add_suppression_full_error_names_actual_root_type
  catches the doc_kind stub-string mutants on line 523 via the
  public error path that calls it

- doc_kind_maps_each_json_variant_to_its_label
  direct unit pinning every JSON variant -> label mapping

Each test docstring names the line:col of the mutant it catches,
so a future mutants run that revives any of these can be traced
back to the test that should have caught it.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Coverage report

Line coverage: 84.5% (9845 / 11644 lines)

Full lcov report available as workflow artifact coverage-lcov: download from this run.

v0.9.8 introduces this report; --fail-under-lines will be added once coverage is visible across 2–3 releases.

@Metbcy Metbcy merged commit 6dbff00 into main Jun 1, 2026
10 checks passed
@Metbcy
Copy link
Copy Markdown
Owner Author

Metbcy commented Jun 1, 2026

Mutants recheck on src/baseline.rs with this branch's tests applied:

Found 54 mutants to test
ok       Unmutated baseline in 4s build + 32s test
54 mutants tested in 31m: 51 caught, 3 unviable

0 surviving (down from 9 in round 1). All 9 logic survivors closed by the 7 new tests in this PR. Ready when you are.

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.

1 participant