Skip to content

[INFRA] Implement AST Mutation Testing Engine to Validate Rule Precision #607

Description

@mijinummi

Labels: high-difficulty, testing, mutation
Difficulty: High
Module: tests/mutation/


🧠 Concept

Build an AST mutation testing framework that automatically injects known gas anti-patterns into test contracts to verify that GasGuard rules catch them reliably (preventing false negatives).

⚠️ Problem

Static analysis rules can become stale or miss edge cases. Mutation testing continuously validates that rule suites reliably detect injected code defects.

📁 Implementation Scope

  • tests/mutation/ast-mutator.ts
  • tests/mutation/mutation-runner.ts

🛠️ Requirements

  1. Mutate valid contract ASTs by injecting anti-patterns (e.g., changing uint256 to uint8, un-caching loop lengths).
  2. Run mutated code through the GasGuard rules engine.
  3. Assert that active rules successfully detect 100% of injected mutations ("killing" the mutants).

🎯 Acceptance Criteria

  • Mutation framework generates valid mutated code variants automatically.
  • Reports rule detection rate ("mutant kill score") across the rule test suite.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions