The fuzz test now has enhanced debugging capabilities to help you investigate validation errors.
FUZZ_DEBUG=1 cargo fuzz run commandsThis will print all the generated commands before execution, helping you understand what inputs are causing issues.
FUZZ_PANIC_ON_MODEL_ERROR=1 cargo fuzz run commandsThis will cause the fuzzer to panic (and generate a backtrace) when it detects model inconsistencies like the error you found.
FUZZ_DEBUG=1 FUZZ_PANIC_ON_MODEL_ERROR=1 cargo fuzz run commandsWhen a model inconsistency is detected, you'll see output like:
=== DEBUGGING MODEL INCONSISTENCY ===
Error: Model has version 0 for stream '\u{8d0d0}' in partition 416 but database returned none
Init args: InitArgs { segment_size: 8192, total_buckets: 32, ... }
Current command 2: GetStreamVersion { partition_id: Some(416), stream_id: Some(...) }
Model state:
- Partitions: [416, 123, 456]
- Streams: {(416, StreamId("test")): 0, ...}
- Total buckets: 32
Saved failing input to: fuzz_failure_12345.json
The error you found suggests:
- The model thinks there's a stream with version 0 in partition 416
- But the database returns
Nonefor that stream version query - This indicates a bug in either:
- The model's tracking of stream versions
- The database's stream version retrieval
- The interaction between append operations and version tracking
- Run with debugging enabled to get the failing input
- Examine the JSON file to see the exact sequence of commands
- Look for patterns - what commands led to this inconsistent state?
- Focus on the specific error: The mismatch between model and database for stream version queries
- Race conditions in stream version updates
- Incorrect handling of empty streams
- Partition-to-bucket mapping issues
- Transaction rollback scenarios not properly reflected in the model