Skip to content

Reject a non-positive size or count in Spool.split - #801

Merged
d-chambers merged 1 commit into
devfrom
fix-split-non-positive
Aug 4, 2026
Merged

Reject a non-positive size or count in Spool.split#801
d-chambers merged 1 commit into
devfrom
fix-split-non-positive

Conversation

@d-chambers

@d-chambers d-chambers commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Spool.split accepted sizes and counts it could not honor:

  • size=0 and any negative size produced step <= 0, and the loop advances start by step, so the generator yielded forever. list(spool.split(size=0)) never returns.
  • count=0 raised ZeroDivisionError.

Both now raise ParameterError, next to the existing "one of size or count" check.

_spool_map derives its own default size from the spool length, which is zero for an empty spool, so it asks for at least one patch per split. Mapping an empty spool over a client still returns an empty list — that path had no test and now does.

Found while reviewing #800, which is why the guard didn't ride along there: it changes the public API's error behavior and deserved its own tests.

Changelog

  • fixed: Spool.split raises ParameterError for a non-positive size or count; size=0 previously yielded forever and count=0 failed with a confusing TypeError.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings and/or appropriate doc page.
  • included tests. See testing guidelines.
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

A size of zero or less produced a step of zero or less, and the loop
advances start by step, so the generator yielded forever. count=0 raised
ZeroDivisionError. Both now raise ParameterError alongside the existing
"one of size or count" check.

_spool_map computes its own default size from the spool length, which is
zero for an empty spool, so it asks for at least one patch per split.
Mapping an empty spool over a client still returns an empty list.
@d-chambers d-chambers added the ready_for_review PR is ready for review label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@d-chambers, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c6683071-0e96-4ae0-81fb-e91e9dd2dbbd

📥 Commits

Reviewing files that changed from the base of the PR and between 071b3dd and 4920439.

📒 Files selected for processing (4)
  • dascore/core/spool.py
  • dascore/utils/misc.py
  • tests/test_core/test_spool.py
  • tests/test_utils/test_misc.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (071b3dd) to head (4920439).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #801   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          164       164           
  Lines        17829     17833    +4     
=========================================
+ Hits         17829     17833    +4     
Flag Coverage Δ
network 48.37% <0.00%> (-0.02%) ⬇️
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@d-chambers
d-chambers merged commit d88645c into dev Aug 4, 2026
28 checks passed
@d-chambers d-chambers removed the ready_for_review PR is ready for review label Aug 11, 2026
@d-chambers
d-chambers deleted the fix-split-non-positive branch August 13, 2026 10:17
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