Skip to content

Request only as many rows as needed for :limit in all_results - #79

Merged
Sija merged 1 commit into
masterfrom
fix/all-results-overfetch
Nov 21, 2026
Merged

Sija merged 1 commit into
masterfrom
fix/all-results-overfetch

Conversation

@Sija

@Sija Sija commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Summary

+MAX_RESULTS = 10_000 # maximum allowed per request
+
 all_results
-  max-results = 10_000                          # every request
+  max-results = min(limit - fetched, MAX_RESULTS)
   loop pages
     ...
+    recompute max-results for the next page

all_results always requested max-results=10_000, even for a small :limit, then discarded the surplus rows.

Evidence

  • Before:
    results(profile, all: true, offset: 11, limit: 12)
    requested max-results  # => Expected: [12, 2]
                           #      Actual: [10000, 10000]
    126 tests, 224 assertions, 1 failures, 0 errors
    
    After: 126 tests, 224 assertions, 0 failures, 0 errors

Merge Danger

Door: two-way

Blast Radius: small

Fewer rows per request when :limit is set; results are unchanged. Assumes :limit is an Integer (a string limit already crashed before this change, see #78). Touches all_results alongside the :limit coercion and missing-total PRs, so whichever merges later needs a small rebase.

🤖 Generated with Claude Code

`all_results` always requested `max-results=10_000`, even for a small `:limit`, and then discarded the surplus rows. Request `min(limit - fetched, MAX_RESULTS)` rows per page instead, and extract the 10,000 maximum into `Garb::Model::MAX_RESULTS`.

Assisted-by: Claude:claude-opus-5-5
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b66a18b1-5e9d-4064-9ab3-0cea99930862
Commits

Reviewing files that changed from the base of the PR and between 9966e90 and 35c43eb.

Files selected for processing: 2

  • lib/garb/model.rb
  • test/unit/garb/model_test.rb
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@Sija Sija added the bug label Nov 21, 2026
@Sija
Sija merged commit 5eb9f75 into master Nov 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant