Skip to content

fuzz: ops_sequence and corrupt_file targets that check results (#387) - #507

Merged
adityamukho merged 1 commit into
v3from
fuzz/387-ops-and-corrupt
Oct 10, 2026
Merged

adityamukho merged 1 commit into
v3from
fuzz/387-ops-and-corrupt

Conversation

@adityamukho

Copy link
Copy Markdown
Collaborator

PR B of #387 (spec: docs/superpowers/specs/2026-10-09-fuzz-corpus-and-ops-target-design.md §5–§6). Refs #387.

ops_sequence

  • Decodes the input (arbitrary::Unstructured) into up to 32 steps: transact, retract, a write transaction (commit or rollback), checkpoint, reopen (default, small cache, auto-checkpoint) and crash (open a copy of the file and WAL). The weights and pools are the same as in the proptest strategies.
  • After each step it checks the tx count, the full rows now and at an input-chosen :as-of, and one input-chosen query shape and temporal clause against the reference model. Rejected statements must fail with the model's code.
  • The model-based test's driver (Op, Step, Probe, run) and its checks moved into tests/reference_model/mod.rs. The test and the target now use one oracle: the test runs Checks::All, the fuzzer Checks::One. A failed shape check names the probe by pool index, not by the query text, because a Ref value's EDN contains a Uuid.

corrupt_file

Seeds

  • ops_sequence: 4 inputs that between them cover every op kind.
  • corrupt_file: no edits (read-write and read-only), a flip in each meta slot, a flip in a live internal, leaf, value and free-list page, and a truncation at the last page. The template layout is the same in every process (checked).

Local runs

  • ops_sequence: 120 s, about 740 exec/s, clean.
  • corrupt_file: 300 s, about 42 exec/s, clean once sub-page lengths are skipped.
  • cargo test --test model_based_test --test property_test passes, and the pre-push hook (fmt, clippy, tests) passes.

The nightly fuzz.yml reads its targets from fuzz/Cargo.toml, so both targets join the v3 run without a workflow change.

🤖 Generated with Claude Code

https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h

ops_sequence decodes up to 32 storage operations (transact, retract,
write transaction, checkpoint, reopen, crash) and compares the database
with the reference model after each one. The model-based test's driver
and checks move into tests/reference_model so the test and the target
share one oracle; Checks::One reads one input-chosen shape per step.

corrupt_file flips bytes and truncates a three-checkpoint file without
fixing checksums: every query must fail or return the answers of the
last generation or the one before it, all from the same one. A file
cut to under one page opens as a new empty database (#506); skipped
until that is fixed.

Refs #387

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 0c9faa4 into v3 Oct 10, 2026
24 checks passed
@adityamukho
adityamukho deleted the fuzz/387-ops-and-corrupt branch October 10, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant