Skip to content

Add cargo-fuzz harness for insert/get/remove sequences #7

Description

@ddsha441981

Summary

PulseMap's core engine uses unsafe code (AtomicU64 CAS operations in MetaWord, raw pointer casts in SlabPool). We need fuzz testing to catch edge cases that unit tests miss.

What To Do

  • Add cargo-fuzz as a dev dependency
  • Create a fuzz/fuzz_targets/ directory with at least one fuzz target that:
    • Generates random insert / get / remove sequences on a PulseMapRaw
    • Verifies that get() never returns corrupted data after any sequence of operations
    • Tests TTL expiration with random epoch values and per-entry TTL overrides
    • Tests eviction correctness: after filling a bucket beyond 4 entries, all returned values must match what was inserted
  • Add a fuzz/README.md explaining how to run it (cargo +nightly fuzz run ...)

Context

  • Core engine files: src/engine/meta.rs, src/engine/slot.rs, src/engine/slab.rs, src/raw.rs
  • The MetaWord uses AtomicU64 with Relaxed ordering — fuzz testing can help verify CAS loop correctness under rapid state transitions
  • The SlabPool does manual heap allocation via Layout — a prime candidate for fuzzing

Acceptance Criteria

  • cargo +nightly fuzz run runs without panics for at least 60 seconds
  • Fuzz target covers: insert, get, remove, TTL expiry, eviction
  • fuzz/README.md exists with setup instructions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions