Skip to content

Conversation

@ctoyan
Copy link
Member

@ctoyan ctoyan commented Oct 15, 2025

Implements configurable mutation operator modes (light, medium, heavy) based on operator effectiveness analysis (22,597 mutants across Aptos' Move framework). This allows users to trade off speed vs thoroughness when running mutation tests. It also allows to add different operators that we support, per operator basis.

Motivation

Running full mutation testing with all operators can be time-consuming.
This PR enables faster feedback loops by allowing users to run only the most effective operators or custom ones that they want to test for.

Changes

New Module: operator_filter.rs

  • OperatorMode enum with Light, Medium, Heavy, and Custom variants
  • Operator effectiveness constants with validation
  • Mode filtering logic applied at mutant generation time

CLI Additions

Both move-mutator and move-mutation-test now support:

--mode <light|medium|heavy> - Predefined operator sets

  • light: unary_operator_replacement, delete_statement, break_continue_replacement
  • medium: light + binary_operator_replacement, if_else_replacement
  • heavy (default): medium + literal_replacement, binary_operator_swap

--operators <op1,op2,...> - Custom operator selection

  • Comma-separated list of specific operators
  • Validates operator names and aborts on invalid input
  • Mutually exclusive with --mode

Implementation Details

  • Filtering happens at mutant creation in parse_expression_and_find_mutants() to avoid wasted computation
  • Configuration validates and parses modes at startup
  • Displays active mode and enabled operators for transparency
  • Default behavior unchanged (Heavy mode) for backward compatibility

Usage Examples

# Light mode - fastest execution (3 operators)
move-mutation-test run --mode light

# Medium mode - balanced (5 operators)
move-mutation-test run --mode medium

# Custom selection
move-mutation-test run --operators unary_operator_replacement,delete_statement

@ctoyan ctoyan self-assigned this Oct 15, 2025
@ctoyan ctoyan linked an issue Oct 15, 2025 that may be closed by this pull request
@ctoyan ctoyan requested a review from joske October 15, 2025 19:51
Copy link
Member

@joske joske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! 🔥

@ctoyan ctoyan merged commit 67d21ef into dev-m4 Oct 16, 2025
@ctoyan ctoyan deleted the feat/mode-flags branch October 16, 2025 07:39
ctoyan added a commit that referenced this pull request Oct 27, 2025
#116)

* feat: add `--mode` and `--operators` flags to mutation testing tools (#115)

* fix: realign operators in the different --mode and add new ones (#117)

* fix: clippy errors

* fix: assert macro treated as an operator

* fix: failing ci
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.

Add configurable modes in CLI

2 participants