Skip to content

Fix PR #48 review finding: Doppler horizon compounding - #50

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 the Copilot thread on #48.

Bug (core/power_doppler.py)

  • Each returning dropped seed doubled one shared horizon: N returns → ×2^N, abandonment effectively off, gone seeds pin every slot.
  • Also found: dropped-key memory was max_seeds keys, so with large corpora keys were forgotten before returning — horizon never widened, zero frames closed (200 seeds / 4 slots → 0 ensembles).

Fix

  • Remember each dropped key's last-touch tick (LRU, max_dropped = 2^15, ~5 MiB).
  • On return: horizon = max(horizon, 2 × gap). Tracks the slowest real revisit gap; never compounds.

Tests

  • test_regression_many_returns_do_not_compound_horizon (falsification, failing before fix): 200 seeds / 4 slots → horizon ≤ 4×cycle and frames close (now 400, 32 ensembles; before 0).
  • test_adversarial_abandoned_keys_do_not_grow_horizon: non-returning keys leave horizon unchanged; memory bounded by max_dropped.
  • 98 passed (test_power_doppler.py, test_schedules.py); ruff + lizard clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rvj2gdMAa4HA8MGHULfDJE


Generated by Claude Code

Summary by Sourcery

Fix Doppler horizon management so slow returning seeds are accommodated without disabling frame abandonment or allowing unbounded state growth.

Bug Fixes:

  • Prevent Doppler horizon growth from compounding across returning seeds by basing it on the largest measured revisit gap.
  • Preserve dropped-seed revisit history with a bounded LRU so slow corpus cycles can widen the horizon correctly instead of losing keys prematurely.

Documentation:

  • Update Doppler schedule documentation and changelog to describe bounded dropped-key tracking and non-compounding horizon behavior.

Tests:

  • Add regression coverage for large corpus cycles, abandoned keys, and invalid dropped-key capacity configuration.

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
@sourcery-ai

sourcery-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

Fixes Doppler horizon runaway by tracking dropped seeds’ last-touch ticks and setting the horizon from the slowest observed revisit gap, while expanding bounded key retention so large corpus cycles are measured; adds regression coverage and updates documentation.

Sequence diagram for Doppler dropped-seed revisit handling

sequenceDiagram
    participant Scheduler
    participant PowerDoppler
    participant DroppedKeys
    participant OpenFrames

    Scheduler->>PowerDoppler: process seed key
    PowerDoppler->>DroppedKeys: pop(seed_key)
    alt key was previously dropped
        PowerDoppler->>PowerDoppler: compute gap = ticks - touched
        PowerDoppler->>PowerDoppler: set _stale_after = max(_stale_after, 2 * gap)
    end
    PowerDoppler->>OpenFrames: _admit()
    alt frame is abandoned
        OpenFrames-->>PowerDoppler: old frame and old.touched
        PowerDoppler->>DroppedKeys: store seed key -> old.touched
    end
Loading

Flow diagram for non-compounding Doppler horizon

flowchart LR
    A[Seed frame is dropped] --> B[Remember key and last-touch tick]
    B --> C[Seed returns after measured gap]
    C --> D[Compute 2 × gap]
    D --> E[Horizon = max current horizon, 2 × gap]
    E --> F[Slowest observed revisit gap controls abandonment]
Loading

File-Level Changes

Change Details Files
Replace compounding horizon growth with revisit-gap-based widening and retain sufficient dropped-key history.
  • Store each dropped frame’s last-touch tick in a bounded LRU cache.
  • On return, widen the stale horizon to at least twice the measured gap instead of multiplying it per return.
  • Expose and validate the configurable dropped-key cache capacity, defaulting to 2¹⁵ entries.
src/fuzzer_tool/core/power_doppler.py
Add regression and boundary tests covering horizon stability, abandoned keys, and configuration validation.
  • Exercise a 200-seed/4-slot cycle to verify frames close and the horizon remains bounded.
  • Verify abandoned keys do not change the horizon and dropped-key memory respects its configured limit.
  • Verify invalid dropped-key capacity is rejected.
tests/test_power_doppler.py
Document the corrected Doppler horizon behavior and dropped-key memory bounds.
  • Update the changelog with the compounding and forgotten-key fixes.
  • Update the Doppler deep-dive documentation to describe measured-gap widening and the bounded dropped-key LRU.
CHANGELOG.md
docs/DEEP_DIVE.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 14:33
Copilot AI balanced review requested due to automatic review settings October 1, 2026 14:33

@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 1 day and 13 hours by commenting @sourcery-ai review. Upgrade to get a review now.

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 fixed LRU capacity preserves the zero-frame failure for unlimited corpora exceeding 32,768 seeds.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Fixes Doppler horizon compounding and adds bounded dropped-seed tracking.

Changes:

  • Derives horizon growth from measured revisit gaps.
  • Adds bounded tracking and regression tests.
  • Updates schedule documentation and changelog.
File Description
src/​fuzzer_tool/​core/​power_doppler.py Revises horizon adaptation and dropped-key retention.
tests/​test_power_doppler.py Tests compounding, bounds, and validation.
docs/​DEEP_DIVE.md Documents revised behavior.
CHANGELOG.md Records the fix.

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

Comment on lines +48 to +50
# Dropped keys remembered (key -> last-touch tick); must outlast a corpus
# cycle's worth of drops. ~150 B each bounds it near 5 MiB.
DEFAULT_MAX_DROPPED = 1 << 15
daedalus pushed a commit that referenced this pull request Oct 1, 2026
The fixed 2^15-key LRU forgot every dropped key once the corpus cycle
outgrew it, so revisits were never seen and frames never closed.
Remember a crc32-sampled subset instead, halving the sample on
overflow: sampled keys are never churned out, memory stays bounded.

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 #50 review finding: Doppler drop memory churn
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