Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 11, 2025

This PR implements mutation testing using cargo-mutants to improve test quality by validating that our test suite can detect intentional code mutations.

Changes Made

  • Added mutants.toml: Configuration file with sensible exclusions for documentation, examples, benchmarks, and test files themselves. Includes conservative timeouts and skips trivial functions like getters.

  • Added .github/workflows/mutation-testing.yml: GitHub Actions workflow that runs mutation testing on pushes to master and pull requests. Uses efficient tool installation and uploads results as artifacts.

  • Updated README.md: Added documentation about mutation testing in the "How to Contribute" section with instructions for running locally.

Configuration Highlights

The mutation testing is configured to:

  • Exclude non-source files (docs, examples, benchmarks, tests)
  • Skip trivial functions like capacity(), len(), is_empty() that are unlikely to have meaningful mutations
  • Use conservative 120-second timeouts for CI environments
  • Run only on code changes (ignoring documentation-only changes)

Usage

Developers can now run mutation testing locally:

cargo install cargo-mutants
cargo mutants

The CI will automatically run mutation testing on relevant changes and upload detailed reports as artifacts.

Fixes #298.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.github.com
    • Triggering command: curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI changed the title [WIP] we don't use mutation testing Add mutation testing with cargo-mutants Jun 11, 2025
@Copilot Copilot AI requested a review from yegor256 June 11, 2025 04:23
Copilot finished work on behalf of yegor256 June 11, 2025 04:23
@yegor256
Copy link
Owner

@owtotwo what do you think about this?

@yegor256
Copy link
Owner

@copilot the CI job that you added is broken, see the logs. Fix it.

Copy link
Contributor Author

Copilot AI commented Jun 11, 2025

@copilot the CI job that you added is broken, see the logs. Fix it.

Fixed the CI workflow. The issue was using deprecated GitHub Actions. Updated to use modern dtolnay/rust-toolchain instead of actions-rs/toolchain@v1 and optimized to run only 1/4 of mutations for faster CI execution while still providing comprehensive testing locally. Commit: 9f11687

Copilot finished work on behalf of yegor256 June 11, 2025 09:00
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.

we don't use mutation testing
2 participants