← Back to Pull requests

fix(box): page folder items and users by marker instead of offset #4870

Open
unknown opened this pull request with 430 lines diff across 5 files
View on GitHub
unknown unknown commented on Oct 30, 2026 12:56 UTC
Author

Relates to: no issue

This is a bug I found while reading the Box client.

BoxClient.paginated_call lists 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 set usemarker to true instead.

So in a folder with more than 11,000 entries, the request for offset 11000 fails. _fetch re-raises the error, but the fetcher pool (ConcurrentTasks.join() without raise_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_call to marker-based pagination: it sends usemarker=true with limit=1000, follows next_marker and stops when Box returns none. Both endpoints the connector lists support it. It also copies params instead of updating the caller's dict.

Checklists

Pre-Review Checklist


  • this PR does NOT contain credentials of any kind, such as API keys or username/passwords (double check config.yml.example)

  • this PR has a meaningful title

  • this PR links to all relevant github issues that it fixes or partially addresses

  • this PR has a thorough description

  • Covered the changes with automated tests

  • Tested the changes locally

  • Added a label for each target release version (example: v7.13.2, v7.14.0, v8.0.0)

  • Considered corresponding documentation changes

  • Contributed any configuration settings changes to the configuration reference

  • if you added or changed Rich Configurable Fields for a Native Connector, you made a corresponding PR in Kibana
  • Tests

    In tests/sources/test_box.py, a fake list endpoint (box_list_endpoint) serves entries the way Box does: by marker when usemarker is 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 sets usemarker.

  • test_paginated_call_fetches_entries_past_box_offset_limit: all 12,500 entries of a folder are returned, and the caller's fields parameter is sent on every page. On main this fails with the 400 at offset 11000.

  • client_get_mock_func now picks pages by marker instead of offset.
  • The new tests fail on main and all Box tests pass with the fix, apart from test_get_content[attachment0-True-expected_content0], which also fails on main on Windows (it shells out to base64). ruff check and ruff format --check are clean, apart from the repo-wide CPY001 notice.

    🤖 Generated with Claude Code

    Diff: 430 lines (+322 / -108) across 5 files Reviewer: ShivamSharma43 Review duration: 33585m
    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
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.1% (MEDIUM) · Higher = larger blast radius
    45.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.1% · Safe to merge
    24.1%