Skip to content

fix: reject over-large sliding window (raise instead of silent-empty)#350

Merged
breimanntools merged 1 commit into
masterfrom
fix/sliding-window-guard
Jul 4, 2026
Merged

fix: reject over-large sliding window (raise instead of silent-empty)#350
breimanntools merged 1 commit into
masterfrom
fix/sliding-window-guard

Conversation

@breimanntools

Copy link
Copy Markdown
Owner

Resolves the deferred sliding-window guard from the July 2026 correctness audit.

check_match_slide_start_slide_stop_window_size had a typo — min_window_size = slide_stop - slide_stop (always 0) — so the guard if window_size < min_window_size could never fire. Requesting a sliding window larger than the explicit slide span therefore silently returned an empty list. The guard now raises a clear ValueError when window_size > slide_stop - slide_start + 1 (the point past which no window fits, per the backend's n_windows formula).

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_stop is passed explicitly (the default slide_stop=None path is unchanged); no internal callers relied on the silent-empty behavior.

Part of #342.

🤖 Generated with Claude Code

…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

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.85%. Comparing base (dc4289c) to head (ae74ecd).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
aaanalysis/data_handling/_seq_preproc.py 100.00% <100.00%> (+1.62%) ⬆️
Components Coverage Δ
cpp_core 94.95% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@breimanntools breimanntools merged commit b38a759 into master Jul 4, 2026
16 checks passed
@breimanntools breimanntools deleted the fix/sliding-window-guard branch July 4, 2026 21:43
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.

1 participant