Skip to content

Fix PR #44 review findings and pre-existing test failures - #46

Merged
daedalus merged 1 commit into
masterfrom
ccr-3750c226-wlianc
Oct 1, 2026
Merged

daedalus merged 1 commit into
masterfrom
ccr-3750c226-wlianc

Conversation

@daedalus

@daedalus daedalus commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #44. It fixes the two Copilot review findings and three bugs found earlier.

Review findings (#44)

  • EEVDF scanned ineligible flows. It used one heap ordered by deadline, so a pick popped every flow that had an earlier deadline but was not yet eligible. That was 5000 pops at 5000 flows, i.e. O(n log n). Now a heap ordered by ve feeds the deadline heap, and a pick costs amortized O(log n). Test: test_eevdf_pick_does_not_scan_ineligible_flows, which fails on the old code.
  • Seed-arm ledgers grew without bound. _record_seed_os_arms now records only corpus parents, skipping Markov-generated inputs. Every seed arm also trims its ArmCounts ledger to 2x the live corpus. Tests: test_regression_non_corpus_parent_not_recorded and test_regression_ledger_bounded_by_corpus.

Found earlier

  • Round robin was O(n²) per pick (seed_round_robin, op_round_robin): it checked x in list once per registered arm. It now uses set membership: 103 ms → 0.7 ms per pick at 5000 seeds. Test: tests/test_regression_round_robin_quadratic.py, which counts list-membership probes.
  • 12 corpus-minimization and lineage tests were failing because corpus_manager.py read cuckoo_seed_filter with no default. It now uses getattr, like other optional features.
  • The hail-mary gate test was failing. cuckoo_seed_filter and swap_walk are added to _HAIL_MARY_FLAGS.

Validation

  • Ran every test file that touches the changed modules: 3935 passed, 0 failed, including the 13 that previously failed on master.
  • Ruff and lizard are clean.
  • The new seed arms' pick cost is unchanged at 4–41 µs at 5000 seeds.

🤖 Generated with Claude Code

https://claude.ai/code/session_018hWd2HH1wGzqxL5wFju873


Generated by Claude Code

Summary by Sourcery

Improve scheduler efficiency and state management while fixing optional-feature compatibility and restoring previously failing behavior.

Bug Fixes:

  • Prevent EEVDF from scanning ineligible flows during selection.
  • Bound seed-arm ledgers and exclude non-corpus parents from outcome tracking.
  • Restore corpus minimization and lineage behavior when optional seed-filter features are absent.
  • Include the required optional features in hail-mary gating.

Enhancements:

  • Reduce round-robin seed and operator selection from quadratic list membership checks to efficient live-set filtering.

Documentation:

  • Update scheduler deep-dive and outstanding work documentation to reflect the EEVDF, lineage, ledger, and round-robin fixes.

Tests:

  • Add regression coverage for EEVDF eligibility scanning, bounded seed-arm ledgers, non-corpus parent handling, and round-robin complexity and ordering.

- EEVDF: ve heap feeds a deadline heap; a pick no longer pops every
  ineligible flow (5000 -> <=8 pops at 5000 flows).
- Seed arms: record corpus parents only; ledgers trim to 2x live corpus.
- Round robin (seed, op): set membership, O(n^2) -> O(n) per pick.
- cuckoo_seed_filter read unguarded in corpus_manager (12 failing tests);
  cuckoo_seed_filter and swap_walk added to _HAIL_MARY_FLAGS.

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

sourcery-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR fixes EEVDF’s ineligible-flow scan with a two-heap design, bounds seed-arm ledgers to live corpus entries, makes round-robin filtering linear via set membership, and repairs optional-feature compatibility and hail-mary flag wiring, with targeted regression coverage for each issue.

Flow diagram for bounded seed-arm ledgers

flowchart LR
    Parent[Mutation parent] --> CorpusCheck{Parent in corpus?}
    CorpusCheck -->|No| Skip[Skip arm recording]
    CorpusCheck -->|Yes| Record[ArmCounts.record]
    Record --> Trim[ArmCounts._trim on select_seed]
    Trim --> Live[Keep only live corpus IDs\nwhen ledger exceeds 2x corpus plus slack]
Loading

Flow diagram for linear round-robin filtering

flowchart LR
    Seeds[Live seed IDs] --> BuildSet[Build set from seed IDs]
    BuildSet --> Filter[Filter registered order by set membership]
    Filter --> Pick[select_seed]
    Ops[Live operators] --> BuildOpSet[Build set from operators]
    BuildOpSet --> FilterOps[Filter registered order by set membership]
    FilterOps --> PickOp[select_op]
Loading

File-Level Changes

Change Details Files
Reworked EEVDF eligibility handling to avoid scanning ineligible flows.
  • Split scheduling state into a ve-ordered pending heap and deadline-ordered ready heap.
  • Promote eligible flows before selecting and requeue flows if virtual time changes invalidate readiness.
  • Rebuild heap state consistently when flows join, leave, or weights change.
  • Added an adversarial heap-pop regression test.
src/fuzzer_tool/core/fair_queue.py
tests/test_fair_queue.py
CHANGELOG.md
docs/DEEP_DIVE.md
Bound seed-arm accounting state to corpus-backed candidates.
  • Record outcomes only when the parent is currently present in corpus metadata, using its content-derived key.
  • Add lazy ledger pruning to remove departed keys once the ledger exceeds twice the live corpus plus slack.
  • Apply pruning across all OS/network seed arms and add regressions for synthetic parents and churned keys.
src/fuzzer_tool/core/schedulers/_arm_counts.py
src/fuzzer_tool/core/schedulers/seed_aimd.py
src/fuzzer_tool/core/schedulers/seed_bfq.py
src/fuzzer_tool/core/schedulers/seed_codel.py
src/fuzzer_tool/core/schedulers/seed_eevdf.py
src/fuzzer_tool/core/schedulers/seed_mlfq.py
src/fuzzer_tool/core/schedulers/seed_p2c.py
src/fuzzer_tool/core/schedulers/seed_sfq.py
src/fuzzer_tool/core/schedulers/seed_stride.py
src/fuzzer_tool/services/fuzzer.py
tests/test_os_net_scheduler_wiring.py
tests/test_os_net_schedulers.py
CHANGELOG.md
docs/DEEP_DIVE.md
Reduced round-robin selection from quadratic list membership checks to linear filtering.
  • Build a set of live candidates before filtering registration order for seed and operator schedulers.
  • Preserve registration-order selection and fallback behavior.
  • Add probe-based regressions that reject list membership scans and verify cycling order.
src/fuzzer_tool/core/schedulers/seed_round_robin.py
src/fuzzer_tool/core/schedulers/op_round_robin.py
tests/test_regression_round_robin_quadratic.py
CHANGELOG.md
docs/TODO.md
Made optional feature integration tolerant of absent configuration attributes and completed hail-mary flag registration.
  • Guard cuckoo_seed_filter accesses with getattr during corpus recovery and minimization.
  • Add cuckoo_seed_filter and swap_walk to the hail-mary feature flag set.
  • Remove the corresponding pre-existing failure from the TODO list and document the fixes.
src/fuzzer_tool/services/corpus_manager.py
src/fuzzer_tool/cli/commands.py
docs/TODO.md
CHANGELOG.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@daedalus
daedalus marked this pull request as ready for review October 1, 2026 00:33
Copilot AI balanced review requested due to automatic review settings October 1, 2026 00:33
sourcery-ai[bot]

This comment was marked as outdated.

@daedalus
daedalus merged commit 69ef0a7 into master Oct 1, 2026
1 check passed

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.

Copilot review overview

🟡 Changes recommended

The corpus-only ledger guard uses seed_meta, which also contains non-corpus QEA inputs.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Fixes scheduler performance, bounds seed-arm state, and restores optional-feature compatibility.

Changes:

  • Adds two-heap EEVDF eligibility handling.
  • Bounds seed ledgers and optimizes round-robin filtering.
  • Fixes cuckoo-filter compatibility and hail-mary wiring.
File Description
tests/​test_regression_round_robin_quadratic.py Tests round-robin complexity and order.
tests/​test_os_net_schedulers.py Tests ledger bounds.
tests/​test_os_net_scheduler_wiring.py Tests outcome filtering.
tests/​test_fair_queue.py Tests EEVDF heap behavior.
src/​fuzzer_tool/​services/​fuzzer.py Filters seed-arm outcomes.
src/​fuzzer_tool/​services/​corpus_manager.py Guards optional cuckoo filtering.
src/​fuzzer_tool/​core/​schedulers/​seed_stride.py Trims stale counts.
src/​fuzzer_tool/​core/​schedulers/​seed_sfq.py Trims stale counts.
src/​fuzzer_tool/​core/​schedulers/​seed_round_robin.py Uses set membership.
src/​fuzzer_tool/​core/​schedulers/​seed_p2c.py Trims stale counts.
src/​fuzzer_tool/​core/​schedulers/​seed_mlfq.py Trims stale counts.
src/​fuzzer_tool/​core/​schedulers/​seed_eevdf.py Trims stale counts.
src/​fuzzer_tool/​core/​schedulers/​seed_codel.py Trims stale counts.
src/​fuzzer_tool/​core/​schedulers/​seed_bfq.py Trims stale counts.
src/​fuzzer_tool/​core/​schedulers/​seed_aimd.py Trims stale counts.
src/​fuzzer_tool/​core/​schedulers/​op_round_robin.py Uses set membership.
src/​fuzzer_tool/​core/​schedulers/​_arm_counts.py Adds bounded-ledger trimming.
src/​fuzzer_tool/​core/​fair_queue.py Implements dual EEVDF heaps.
src/​fuzzer_tool/​cli/​commands.py Extends hail-mary flags.
docs/​TODO.md Removes completed items.
docs/​DEEP_DIVE.md Documents scheduler fixes.
CHANGELOG.md Records resolved defects.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +4531 to +4532
if not self._seed_os_arms or parent not in self.seed_meta:
return
Comment on lines +16 to +19
EEVDF cost O(log n)* lag-bounded, new flows join at V

(*) amortized: each flow crosses from the ve heap to the deadline heap once
per service.
daedalus added a commit that referenced this pull request Oct 1, 2026
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