Evolution Demo

From surviving mutants to owned assertions.

This demo uses examples/go-evolution-loop, where handwritten tests pass but Veritas finds parser boundary assumptions and ranks the next assertion to add.

before score55
before mutation58%
after score98
after mutation91%

Reproduce The Loop

cargo run -p veritas-cli -- --root examples/go-evolution-loop verify --lang go --target .
cargo run -p veritas-cli -- --root examples/go-evolution-loop score
cargo run -p veritas-cli -- --root examples/go-evolution-loop evolve --dry-run

Initial Signal

Mutation

Generated 14, executed 12, killed 7, survived 4, score 58%.

Fuzzing

Generated harnesses 1, targets executed 3, failures 0, persisted repros 4.

Differential Replay

Targets 3, cases 16, with replay artifacts available to turn behavior drift into assertions.

Evolution

Suites 1, candidates 14, selected 12, average fitness 76%.

Confidence

Score 55, grade Medium. The report is useful, but not done.

Top Candidate

Add the smallest assertion that kills a surviving ParseInvoiceTotal mutant. Fitness 95%.

The Assertion

func TestParseInvoiceTotal(t *testing.T) {
	value, ok := ParseInvoiceTotal(" 10_000 ")
	if !ok || value != 10000 {
		t.Fatalf("expected normalized total, got %d ok=%v", value, ok)
	}
	value, ok = ParseInvoiceTotal("1000000")
	if !ok || value != 1000000 {
		t.Fatalf("expected boundary invoice total, got %d ok=%v", value, ok)
	}
	value, ok = ParseInvoiceTotal("not-a-number")
	if ok || value != 0 {
		t.Fatalf("expected invalid invoice total to be rejected with zero value, got %d ok=%v", value, ok)
	}
	value, ok = ParseInvoiceTotal("1000001")
	if ok || value != 0 {
		t.Fatalf("expected huge invoice total to be rejected with zero value, got %d ok=%v", value, ok)
	}
}

After The Candidate Lands

cargo run -p veritas-cli -- --root examples/go-evolution-loop verify --lang go --target .
cargo run -p veritas-cli -- --root examples/go-evolution-loop score
  • Mutation score rises to 91%.
  • Surviving mutants drop to 0.
  • Differential replay retains 16 cases.
  • Evolution selected candidates drop to 0.
  • Confidence score rises to 98, grade High.