feat: add cuckoo seed filter for pruned seed dedup - #36
Merged
Merged
Conversation
- Add --cuckoo-seed-filter CLI flag to gate the feature - Initialize CuckooFilter for pruned seed tracking when flag is set - Load pruned seeds into filter at startup (corpus/seeds/pruned/) - Check filter in _dedup_mutate(): skip mutation if parent seed was pruned - Add pruned seed hashes to filter during corpus minimization (_commit_minimize) - Remove pruned seed hashes from filter when seeds are re-admitted (_recover_uncovered) - Update _StubFuzzer with cuckoo_seed_filter attribute - Add regression tests for the new feature Fixes: tracker issue - ensure pruned seeds are not re-mutated after corpus minimization, preventing wasted fuzzing effort on seeds already deemed not valuable.
Reviewer's GuideAdds an opt-in CuckooFilter that is sized from the active corpus, populated from persisted and newly pruned seeds, cleared on re-admission, and consulted before mutation to avoid regenerating known-pruned seeds; regression tests cover the lifecycle and unchanged default behavior. Sequence diagram for pruned seed filtering during mutationsequenceDiagram
participant Fuzzer
participant CuckooFilter
participant Mutator
Fuzzer->>CuckooFilter: contains(_seed_key(data))
alt parent seed was pruned
CuckooFilter-->>Fuzzer: true
Fuzzer-->>Fuzzer: return data
else parent seed is not pruned
CuckooFilter-->>Fuzzer: false
Fuzzer->>Mutator: mutate(data)
Mutator-->>Fuzzer: mutated data
end
Sequence diagram for pruned seed filter lifecyclesequenceDiagram
participant Fuzzer
participant Corpus
participant CuckooFilter
participant CorpusManager
Fuzzer->>CuckooFilter: create capacity=max(10 * corpus size, 100000)
Fuzzer->>Corpus: load pruned seeds from seeds/pruned/
Corpus-->>Fuzzer: persisted pruned seed data
Fuzzer->>CuckooFilter: add(_seed_key(data))
CorpusManager->>CuckooFilter: add(_hash(seed))
CorpusManager->>CuckooFilter: remove(seed_key(recovered seed))
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical filter-recovery and symlink-safety issues, plus capacity and compatibility problems, remain unresolved.
Review effort: Lite
Findings: 2
Open (5)
What changed in this PR
Adds optional Cuckoo-filter tracking for pruned seeds to avoid redundant mutations.
Changes:
- Adds CLI and Fuzzer configuration.
- Loads, tracks, and removes pruned seed hashes.
- Adds regression coverage and updates test stubs.
| File | Summary |
|---|---|
tests/test_regression_cuckoo_seed_filter.py |
Adds feature regression tests. |
tests/test_bloom_exec_dedup.py |
Updates deduplication test support. |
src/fuzzer_tool/services/fuzzer.py |
Configures the filter and gates mutations. |
src/fuzzer_tool/services/corpus_manager.py |
Updates filter state during pruning and recovery. |
src/fuzzer_tool/cli/commands.py |
Adds the CLI option and help text. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1759
to
+1761
| if f.cuckoo_seed_filter is not None: | ||
| h = self.seed_key(seed) | ||
| f.cuckoo_seed_filter.remove(h) |
Comment on lines
+4154
to
+4157
| if not fh.is_file(): | ||
| continue | ||
| try: | ||
| data = fh.read_bytes() |
| # to the filter. When a seed is pruned during minimization, its hash | ||
| # is added. In _dedup_mutate(), if a mutation's hash is in the | ||
| # filter, the mutation is skipped (original data returned). | ||
| cuckoo_seed_filter=False, |
Comment on lines
+2040
to
+2042
| # Sized at 10x the corpus; minimum 100_000 to match | ||
| # the exec bloom default. | ||
| self.cuckoo_seed_filter = CuckooFilter(capacity=max(10 * len(self.corpus), 100_000)) |
Comment on lines
+4045
to
+4050
| fuzz_parser.add_argument( | ||
| "--cuckoo-seed-filter", | ||
| action="store_true", | ||
| default=False, | ||
| help=( | ||
| "Track pruned seeds in a CuckooFilter so their mutations are " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Add a CuckooFilter to track pruned seeds so their mutations are skipped at dedup time.
Changes
Tests
Verification
Summary by Sourcery
Add optional pruned-seed tracking to avoid reprocessing mutations from seeds removed during corpus minimization.
New Features:
Bug Fixes:
Enhancements:
Tests: