Skip to content

test: switch from roundtrip based tests to e2e based fuzzers#59

Merged
CommanderStorm merged 16 commits into
fast-pack:mainfrom
CommanderStorm:better-rust-fuzzing
Feb 14, 2026
Merged

test: switch from roundtrip based tests to e2e based fuzzers#59
CommanderStorm merged 16 commits into
fast-pack:mainfrom
CommanderStorm:better-rust-fuzzing

Conversation

@CommanderStorm

Copy link
Copy Markdown
Collaborator

This is stacked on top of #58

@codecov

codecov Bot commented Feb 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the fuzzing infrastructure to use oracle-based testing, where the C++ implementation serves as a reference to verify the Rust implementation's correctness. It builds upon PR #58 which introduced the unified CodecToSlice trait API. The testing strategy shifts from simple roundtrip tests to end-to-end oracle comparisons that compare both compressed output and decompression results between Rust and C++ implementations.

Changes:

  • Introduces unified CodecToSlice<In, Out = In> trait implementations for both Rust and C++ codecs
  • Replaces roundtrip-based fuzzers with oracle-based fuzzers that compare Rust implementation against C++
  • Moves Integer<u32> implementation from integer_codec.rs to codec.rs for better code organization

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/lib.rs Adds the CodecToSlice trait definition for unified compression API
src/rust/integer_compression/codec.rs Implements CodecToSlice for Rust Codec enum and moves Integer<u32> impl here
src/rust/integer_compression/integer_codec.rs Removes duplicate Integer<u32> impl (moved to codec.rs)
src/rust/error.rs Adds InvalidInputLength error variant for input size validation
src/cpp/mod.rs Implements CodecToSlice for C++ codecs (both 32-bit and 64-bit variants) and adds tests
fuzz/fuzz_targets/fastpfor_rust.rs Removed old roundtrip-based fuzzer
fuzz/fuzz_targets/cpp_roundtrip.rs New comprehensive roundtrip fuzzer for C++ codecs
fuzz/fuzz_targets/rust_compress_oracle.rs New oracle fuzzer comparing Rust compression against C++
fuzz/fuzz_targets/rust_decompress_oracle.rs New oracle fuzzer comparing Rust decompression against C++
fuzz/Cargo.toml Updates fuzzer binary definitions
fuzz/README.md Updates documentation for new fuzzing approach
.github/workflows/ci.yml Updates CI to run new fuzzer targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fuzz/README.md Outdated
Comment thread fuzz/fuzz_targets/rust_decompress_oracle.rs Outdated
Comment on lines +90 to +119
#[derive(arbitrary::Arbitrary, Debug)]
struct FuzzInput {
data: Vec<u32>,
codec: FuzzCodec,
}

#[derive(arbitrary::Arbitrary, Debug, Clone, Copy, PartialEq, Eq)]
enum FuzzCodec {
FastPFOR256,
FastPFOR128,
VariableByte,
JustCopy,
}

impl From<FuzzCodec> for rust::Codec {
fn from(codec: FuzzCodec) -> Self {
match codec {
FuzzCodec::FastPFOR256 => rust::Codec::from(rust::FastPFOR::new(
rust::DEFAULT_PAGE_SIZE,
rust::BLOCK_SIZE_256,
)),
FuzzCodec::FastPFOR128 => rust::Codec::from(rust::FastPFOR::new(
rust::DEFAULT_PAGE_SIZE,
rust::BLOCK_SIZE_128,
)),
FuzzCodec::VariableByte => rust::Codec::from(rust::VariableByte::new()),
FuzzCodec::JustCopy => rust::Codec::from(rust::JustCopy::new()),
}
}
}

Copilot AI Feb 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FuzzInput and FuzzCodec structures, along with the From implementation, are duplicated across both rust_compress_oracle.rs and rust_decompress_oracle.rs. Consider extracting these shared types into a common module (e.g., fuzz/common.rs or similar) to reduce duplication and ensure consistency.

Copilot uses AI. Check for mistakes.
Comment thread fuzz/fuzz_targets/cpp_roundtrip.rs Outdated
CommanderStorm and others added 3 commits February 14, 2026 16:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fuzz/README.md Outdated
Comment thread fuzz/fuzz_targets/rust_compress_oracle.rs
Comment thread fuzz/fuzz_targets/rust_decompress_oracle.rs
Comment thread fuzz/fuzz_targets/cpp_roundtrip.rs
CommanderStorm and others added 2 commits February 14, 2026 16:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@CommanderStorm
CommanderStorm enabled auto-merge (squash) February 14, 2026 16:02
@CommanderStorm
CommanderStorm merged commit e5a00ea into fast-pack:main Feb 14, 2026
9 checks passed
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.

3 participants