mozz_mlake ยท API

mozz.minimize

Delta-debugging input minimizer (Andreas Zeller's ddmin algorithm).

Reduces a crashing input to its minimal reproduction case by binary partitioning and removing subsets that still trigger the crash.

Example: ```mojo def is_crash(data: List[UInt8]) raises -> Bool: try: broken_parser(SpanUInt8, _) return False except e: return _is_crash_message(String(e))

var minimal = minimize_bytes(crashing_input, is_crash)
print(len(minimal), "bytes (was", len(crashing_input), ")")
```

Functions

minimize_bytes

def minimize_bytes(input: List[UInt8], is_crash: def(List[UInt8]) raises thin -> Bool) -> List[UInt8]

Minimize input to the smallest prefix/subset that still crashes.

Implements ddmin with granularity doubling: starts by trying to remove half of the input, recursively narrows until no single-element removal preserves the crash.

Args
input: The crashing input to minimize.
is_crash: A predicate that returns True if the given bytes trigger the crash. May raise; raises from is_crash itself are treated as True (crash).

Raises Error: If the initial input does not pass is_crash.