fix: reject over-large sliding window (raise instead of silent-empty)#350
Merged
Conversation
…rning [] check_match_slide_start_slide_stop_window_size had a typo (slide_stop - slide_stop, always 0) that made the guard dead, so requesting a window larger than the explicit slide span silently returned an empty list. It now raises a clear ValueError when window_size > slide_stop - slide_start + 1 (the point past which no window fits). The two hypothesis tests that encoded the old silent-empty behavior are updated to the new contract, plus a dedicated over-large-window test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #350 +/- ##
==========================================
+ Coverage 94.84% 94.85% +0.01%
==========================================
Files 196 196
Lines 18783 18783
Branches 3181 3181
==========================================
+ Hits 17815 17817 +2
+ Misses 632 631 -1
+ Partials 336 335 -1
🚀 New features to boost your workflow:
|
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.
Resolves the deferred sliding-window guard from the July 2026 correctness audit.
check_match_slide_start_slide_stop_window_sizehad a typo —min_window_size = slide_stop - slide_stop(always 0) — so the guardif window_size < min_window_sizecould never fire. Requesting a sliding window larger than the explicit slide span therefore silently returned an empty list. The guard now raises a clearValueErrorwhenwindow_size > slide_stop - slide_start + 1(the point past which no window fits, per the backend'sn_windowsformula).This is a behavior/contract change (silent-empty → raise), decided in favor of raising. The two hypothesis tests that encoded the old silent-empty behavior are updated to the new contract, and a dedicated over-large-window test is added.
Only fires when
slide_stopis passed explicitly (the defaultslide_stop=Nonepath is unchanged); no internal callers relied on the silent-empty behavior.Part of #342.
🤖 Generated with Claude Code