fix(box): page folder items and users by marker instead of offset #4870
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 430 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #4870"
general
weight: 0.35
ShivamSharma43
Relates to: no issue
This is a bug I found while reading the Box client.
BoxClient.paginated_calllists folder items (/2.0/folders/{id}/items) and enterprise users (/2.0/users) with offset-based pagination, in pages of 1,000. Box caps the offset for these endpoints: the List enterprise users reference says "Queries with offset parameter value exceeding 10000 will be rejected with a 400 response", and the offset-based pagination guide gives 9999 as the maximum offset and recommends marker-based pagination beyond that. The List items in folder reference also says offset paging "may fail for large datasets" and to setusemarkertotrueinstead.So in a folder with more than 11,000 entries, the request for offset 11000 fails.
_fetchre-raises the error, but the fetcher pool (ConcurrentTasks.join()withoutraise_on_error) only logs it, so the sync finishes normally and the rest of that folder (files and subfolders) is missing from the index. The same applies to an enterprise with more than 11,000 users.The fix switches
paginated_callto marker-based pagination: it sendsusemarker=truewithlimit=1000, followsnext_markerand stops when Box returns none. Both endpoints the connector lists support it. It also copiesparamsinstead of updating the caller's dict.Checklists
Pre-Review Checklist
config.yml.example)v7.13.2,v7.14.0,v8.0.0)Tests
In
tests/sources/test_box.py, a fake list endpoint (box_list_endpoint) serves entries the way Box does: by marker whenusemarkeris set, and by offset otherwise, answering 400 for an offset above 10000.test_paginated_call_stops_after_last_page(rewritten from the offset version): for 0, 2, 1,000, 1,001 and 2,500 entries, every entry is returned, the requests carry the expected markers, and each one setsusemarker.test_paginated_call_fetches_entries_past_box_offset_limit: all 12,500 entries of a folder are returned, and the caller'sfieldsparameter is sent on every page. Onmainthis fails with the 400 at offset 11000.client_get_mock_funcnow picks pages by marker instead of offset.The new tests fail on
mainand all Box tests pass with the fix, apart fromtest_get_content[attachment0-True-expected_content0], which also fails onmainon Windows (it shells out tobase64).ruff checkandruff format --checkare clean, apart from the repo-wide CPY001 notice.🤖 Generated with Claude Code