Skip to content

Kill lib.rs CLI escapes via function and mutator slices (#69) - #151

Merged
jonbaldie merged 1 commit into
mainfrom
mutation/issue-69-cli-escapes
Sep 11, 2026
Merged

Kill lib.rs CLI escapes via function and mutator slices (#69)#151
jonbaldie merged 1 commit into
mainfrom
mutation/issue-69-cli-escapes

Conversation

@jonbaldie

Copy link
Copy Markdown
Contributor

Summary

Closes #69 (child of #40).

Measures every CLI entry function in src/lib.rs using memory-safe, function-scoped and mutator-group batches (--workers 1, CARGO_BUILD_JOBS=1, narrow tests --test-flags "--test cli --lib" without --coverage). Kills escaped mutants via integration tests through messrust::run in tests/cli.rs.

Batch Measurement Results

Environment: Docker container capped at 2 CPUs / 4 GB RAM, CARGO_BUILD_JOBS=1, --workers 1, --test-flags "--test cli --lib", temporary directories under $TMPDIR/mutarust-* removed after each batch.

Function Mutants Killed Escaped Errored Skipped MSI
handle_info_flags 4 1 0 0 3 100.00%
print_usage 0 0 0 0 0 N/A
parse_priority 6 6 0 0 0 100.00%
source_suffixes 2 0 0 0 2 100.00%
suffix_list 2 0 0 0 2 100.00%
split_list 0 0 0 0 0 N/A
required_value 0 0 0 0 0 N/A
apply_flag_option 13 13 0 0 0 100.00%
apply_value_option 11 11 0 0 0 100.00%
prepare_analysis 1 1 0 0 0 100.00%
run_analysis 10 6 0 0 4 100.00%
parse_args (all mutator groups) 32 29 0 2 1 100.00%
run 32 26 2 0 4 93.75%
default (Options) 4 2 1 0 1 75.00%

Escaped Mutants and Equivalence Notes

Across all CLI entry functions, 3 escaped mutants remain, and all 3 are proven behaviorally equivalent:

  1. src/lib.rs:90 in run:
    return EXIT_SUCCESS; -> return 0; (statement/return)
    Equivalence note: EXIT_SUCCESS is pub const EXIT_SUCCESS: i32 = 0;. Returning literal 0 produces identical behavior.

  2. src/lib.rs:95 in run:
    return code; -> return 0; (statement/return)
    Equivalence note: handle_info_flags returns Some(EXIT_SUCCESS) (which is 0) on info flags (--version, --help, -h), and None otherwise. When code is returned, its value is always 0. Returning literal 0 produces identical behavior.

  3. src/lib.rs:72 in default:
    max_priority: 1 -> max_priority: 0; (composite/field-clear)
    Equivalence note: Rule priorities are integers in range 1..=5. Rules are filtered by max priority when opts.max_priority > 0 && priority < opts.max_priority. If max_priority == 1, priority < 1 is false for all rules (since priority >= 1). If max_priority == 0, opts.max_priority > 0 is false. Both conditions filter zero rules. Behavior is identical.

The fourth mutant, max_priority: 1 -> max_priority: 2 (numbers/incrementer), escaped previously. It is killed by the new test default_maximumpriority_includes_priority_one_rules in tests/cli.rs (testing cleancode ruleset containing BooleanArgumentFlag with priority 1).

Changes

  • tests/cli.rs: Add integration test default_maximumpriority_includes_priority_one_rules through messrust::run.

@jonbaldie
jonbaldie merged commit 04ff941 into main Sep 11, 2026
5 checks passed
@jonbaldie
jonbaldie deleted the mutation/issue-69-cli-escapes branch September 11, 2026 18:07
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.

Kill lib.rs CLI escapes via function and mutator slices (no coverage)

1 participant