Fix PR #50 review finding: Doppler drop memory churn - #51
Merged
Merged
Conversation
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
This comment was marked as resolved.
This comment was marked as resolved.
daedalus
marked this pull request as ready for review
October 1, 2026 14:56
A halving crc threshold subset emptied out when every key had an odd crc, so no revisit widened the horizon again. Keep the k smallest crc32s instead: a fixed, never-empty subset of any cycle. Use the repo's crc32_ieee; test with a cycle of masked-out keys. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Rvj2gdMAa4HA8MGHULfDJE
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.


Addresses the Copilot thread on #50, plus the Copilot review on this PR.
Bug (
core/power_doppler.py)Fixed 2¹⁵-key LRU of dropped keys: a corpus cycle larger than that evicted each key just before it returned → no revisit seen → horizon never widened → zero frames. Reachable with unlimited
--max-corpus.Fix
Remember the bottom-k dropped keys by
crc32_ieee(k =max_dropped): a fixed subset of any cycle, never churned out, never empty. Max-heap with lazy stale skipping; rebuilt (deduplicated) when it doubles past k. The first iteration of this PR used a halving crc threshold, which emptied out on all-odd-crc cycles (Copilot review); replaced.Tests
test_regression_cycle_beyond_drop_memory_still_scores: 200 seeds, 8-key memory → frames close, horizon ≤ 4×cycle, memory ≤ 8.test_regression_masked_out_cycle_keeps_a_witness: cycle of odd-crc keys only, 2-key memory → frames close (failed on the threshold version).test_adversarial_drop_memory_is_bottom_k_crc: remembered set equals the exact k smallest crcs.test_adversarial_redropped_key_keeps_heap_bounded: drop/revisit churn keeps heap ≤ 2k.test_power_doppler.py,test_schedules.py); ruff + lizard clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Rvj2gdMAa4HA8MGHULfDJE