Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save copyleftdev/9b9afe1b1173217d92a4cb0ede2278d0 to your computer and use it in GitHub Desktop.

Select an option

Save copyleftdev/9b9afe1b1173217d92a4cb0ede2278d0 to your computer and use it in GitHub Desktop.
Oddly Exact optimizer guard mutation gate: 11 of 11 mutations caught

Oddly Exact: repaired optimizer mutation gate

The contract audit found that optimizer iteration counts and grid resolution had no published upper ceilings. The repair added and enforced these limits:

  • maximum iterations: 100000
  • maximum grid resolution: 1000000

The focused mutation pass selected every mutation generated for validate_max_iters and validate_grid_resolution, including replacements with unconditional success and changes to boundary comparisons.

Command

cargo mutants \
  --file src/optimize.rs \
  --re 'validate_(max_iters|grid_resolution)' \
  --timeout-multiplier 3.0 \
  --jobs 1 \
  -- --locked

Recorded outcome

baseline: 793 tests passed
selected mutants: 11
caught: 11
missed: 0
timeout: 0
unviable: 0

This is the repair loop in executable form: the requests that exposed the missing limits became regression tests, then mutation testing tried to weaken or remove those guards. All eleven attempts were caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment