Skip to content

Fix PR #47 review findings - #48

Merged
daedalus merged 1 commit into
masterfrom
ccr-503d6e26-3ijog5
Oct 1, 2026
Merged

daedalus merged 1 commit into
masterfrom
ccr-503d6e26-3ijog5

Conversation

@daedalus

@daedalus daedalus commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Addresses both Copilot threads on #47.

Doppler horizon thrash (core/power_doppler.py)
Fixed abandon horizon (max_seeds × ensemble × 4) dropped every frame when the corpus cycle was longer: 13 seeds, 1 slot, ensemble 3 → 12-tick horizon → 0 ensembles forever. Now a bounded LRU of dropped keys (size max_seeds); a returning key doubles the horizon, so it converges past the revisit time. Truly abandoned keys leave it unchanged.

Stale corpus memo (services/fuzzer.py::_in_corpus)
Memo keyed on len(corpus) missed same-length in-place trims (corpus_manager.py:1165). Hits now store (parent, corpus list, slot, seed) and re-validate by identity in O(1); misses aren't memoized.

Tests (falsification + adversarial each, failing before fix)

  • test_regression_slow_cycle_beyond_horizon_still_scores, test_adversarial_abandoned_keys_do_not_grow_horizon
  • test_regression_parent_replaced_in_place_not_recorded, test_adversarial_parent_kept_across_corpus_rebuild

Validation

  • 353 passed across affected files; ruff + lizard clean.
  • Memo hit 0.1 µs; miss (non-corpus parents only) ~5 µs at 5000 seeds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rvj2gdMAa4HA8MGHULfDJE


Generated by Claude Code

Summary by Sourcery

Fix Doppler scheduling across slow corpus cycles and keep corpus-membership decisions valid as the corpus changes.

Bug Fixes:

  • Prevent Doppler scoring from thrashing when corpus cycles exceed the abandonment horizon by adapting the horizon for seeds that return.
  • Ensure corpus-membership memoization detects same-length in-place replacements and corpus-list rebuilds without caching misses.

Documentation:

  • Document the Doppler horizon and corpus-membership fixes in the changelog and scheduling guidance.

Tests:

  • Add regression and adversarial coverage for slow Doppler corpus cycles, abandoned-key bounds, and stale corpus-membership entries.

- Doppler: abandon horizon doubles when a dropped seed returns; a
  fixed horizon thrashed once the corpus cycle outlasted it.
- Seed-arm corpus memo: hits re-validated by slot identity, misses not
  memoized; length-keyed memo went stale on in-place trims.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Rvj2gdMAa4HA8MGHULfDJE
@sourcery-ai

sourcery-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

Fixes two PR #47 review findings: Doppler now self-widens its stale-frame horizon only for returning, previously dropped seeds using bounded memory, while corpus-membership memo hits are validated against list and slot identity so in-place trims and rebuilds cannot produce stale results. Documentation and changelog entries are updated, with regression and adversarial tests for both behaviors.

Sequence diagram for Doppler horizon self-widening

sequenceDiagram
    participant Scheduler
    participant Doppler
    participant DroppedKeys

    Scheduler->>Doppler: observe(seed_key, hits)
    Doppler->>Doppler: _ticks += 1
    Doppler->>Doppler: pop open frame
    alt frame was dropped previously
        Doppler->>DroppedKeys: check seed_key
        DroppedKeys-->>Doppler: key found
        Doppler->>DroppedKeys: delete seed_key
        Doppler->>Doppler: _stale_after *= 2
    else frame is new
        Doppler->>DroppedKeys: check seed_key
        DroppedKeys-->>Doppler: key absent
    end
    Doppler->>Doppler: _admit()
    Doppler-->>Scheduler: record observation or refuse
Loading

Sequence diagram for identity-validated corpus memo

sequenceDiagram
    participant Fuzzer
    participant Corpus
    participant SeedPicker

    Fuzzer->>Fuzzer: _in_corpus(parent)
    alt memo parent and corpus list match
        Fuzzer->>Corpus: validate memoized slot identity
        alt slot still contains memoized seed
            Corpus-->>Fuzzer: identity valid
            Fuzzer-->>Fuzzer: return True
        else list was trimmed or replaced
            Corpus-->>Fuzzer: identity invalid
        end
    else no reusable memo hit
        Fuzzer->>SeedPicker: _corpus_keys()
        SeedPicker-->>Fuzzer: key_to_seed
        Fuzzer->>Corpus: index(seed)
        alt seed found
            Corpus-->>Fuzzer: slot
            Fuzzer-->>Fuzzer: memoize parent, list, slot, seed
            Fuzzer-->>Fuzzer: return True
        else seed absent
            Fuzzer-->>Fuzzer: clear memo
            Fuzzer-->>Fuzzer: return False
        end
    end
Loading

File-Level Changes

Change Details Files
Make Doppler stale-frame handling adapt to slow corpus revisit cycles without unbounded state growth.
  • Track recently dropped keys in a bounded LRU.
  • Double the abandonment horizon only when a previously dropped key returns.
  • Expose the current horizon in scheduler stats and document the self-widening behavior.
src/fuzzer_tool/core/power_doppler.py
CHANGELOG.md
docs/DEEP_DIVE.md
docs/TODO.md
Make corpus-membership memoization resilient to same-length in-place mutations and corpus-list rebuilds.
  • Memoize successful lookups with the corpus-list identity, slot, and seed identity.
  • Revalidate cached hits in O(1) and clear the memo for misses.
  • Add regression and adversarial coverage for replacement, rebuild, and later admission cases.
src/fuzzer_tool/services/fuzzer.py
tests/test_os_net_scheduler_wiring.py
Add regression tests covering both review findings and their adversarial boundaries.
  • Verify slow cycles eventually score ensembles beyond the initial horizon.
  • Verify abandoned keys do not widen the horizon or exceed bounded dropped-key storage.
tests/test_power_doppler.py

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 04:12
Copilot AI balanced review requested due to automatic review settings October 1, 2026 04:12

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @daedalus, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 9 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@daedalus
daedalus merged commit 62ece7a 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

Multiple returning dropped seeds can exponentially inflate the global horizon and effectively disable frame abandonment.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes Doppler slow-cycle handling and stale corpus-membership memoization.

Changes:

  • Adapts Doppler’s abandonment horizon for returning seeds.
  • Revalidates cached corpus membership by list and slot identity.
  • Adds regression tests and documentation.
File Description
src/​fuzzer_tool/​core/​power_doppler.py Adds adaptive horizon tracking.
src/​fuzzer_tool/​services/​fuzzer.py Fixes corpus-membership memo validation.
tests/​test_power_doppler.py Tests slow cycles and dropped-key bounds.
tests/​test_os_net_scheduler_wiring.py Tests corpus replacement and rebuilding.
docs/​DEEP_DIVE.md Documents horizon adaptation.
docs/​TODO.md Updates Doppler tuning notes.
CHANGELOG.md Records both fixes.

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

Comment on lines +296 to +297
del self._dropped_keys[seed_key]
self._stale_after *= 2
daedalus pushed a commit that referenced this pull request Oct 1, 2026
Each returning dropped seed doubled one shared horizon (N returns ->
2^N), disabling abandonment. The dropped-key memory (max_seeds keys)
also forgot keys before large corpora cycled back, so the horizon never
widened at all. Now horizon = max(horizon, 2 x measured revisit gap),
with 2^15 remembered keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Rvj2gdMAa4HA8MGHULfDJE
daedalus added a commit that referenced this pull request Oct 1, 2026
Fix PR #48 review finding: Doppler horizon compounding
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