Skip to content

fix: Error: Limit must be between 1 and 100 (#8010)#8012

Open
erxes-dev-agent[bot] wants to merge 1 commit into
mainfrom
ln-fix/issue-8010
Open

fix: Error: Limit must be between 1 and 100 (#8010)#8012
erxes-dev-agent[bot] wants to merge 1 commit into
mainfrom
ln-fix/issue-8010

Conversation

@erxes-dev-agent

@erxes-dev-agent erxes-dev-agent Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Automated fix for #8010 generated by OpenCode (kimi) via the erxes-sentry-fixer agent.

Closes #8010

🤖 Commands: @erxes-dev-agent ci (re-check & fix CI) · @erxes-dev-agent <instruction> (revise) · @erxes-dev-agent help.
Please review before merging.

Summary by Sourcery

Bug Fixes:

  • Clamp the GraphQL user list query limit argument between 1 and 100 with a default of 20 before passing it to the cursor pagination helper.

@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds server-side normalization of the limit argument for the team-member user query to always stay within the allowed 1–100 range before calling cursorPaginate, preventing runtime errors from invalid pagination limits.

Sequence diagram for normalized limit in team member user query

sequenceDiagram
  participant Client
  participant userQueries
  participant cursorPaginate
  participant UsersModel

  Client->>userQueries: userQueries.users(args)
  userQueries->>userQueries: Math.max(1, args.limit || 20)
  userQueries->>userQueries: Math.min(100, computedLimit)
  userQueries->>cursorPaginate: cursorPaginate({ model: UsersModel, params: { ...args, limit }, query: selector })
  cursorPaginate->>UsersModel: findWithCursor(params, query)
  cursorPaginate-->>userQueries: { list, totalCount, pageInfo }
  userQueries-->>Client: { list, totalCount, pageInfo }
Loading

File-Level Changes

Change Details Files
Clamp the limit argument for the user list GraphQL query to the [1, 100] range with a default of 20 before passing it to cursorPaginate.
  • Introduce a limit variable that defaults to 20 when not provided and then clamps the value between 1 and 100 using Math.min and Math.max.
  • Pass the normalized limit value into cursorPaginate by spreading existing args and overriding the limit field in the params object instead of forwarding args directly.
backend/core-api/src/modules/organization/team-member/graphql/queries.ts

Assessment against linked issues

Issue Objective Addressed Explanation
#8010 Ensure the users GraphQL query in team-member module always passes a limit between 1 and 100 (with a valid default) to cursorPaginate to prevent the "Limit must be between 1 and 100" runtime error.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepsource-io

deepsource-io Bot commented Jun 12, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 2f1d289...fb3f26e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Jun 12, 2026 5:55p.m. Review ↗
Docker Jun 12, 2026 5:55p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@erxes-dev-agent

Copy link
Copy Markdown
Contributor Author

🤖 autofix: CI is green ✅ (converged in 1 round(s)).

@sonarqubecloud

Copy link
Copy Markdown

@Amartuvshins0404

Copy link
Copy Markdown
Collaborator

@erxes-dev-agent what are you doing?

@erxes-dev-agent

Copy link
Copy Markdown
Contributor Author

I'm reviewing PR #8012 (ln-fix/issue-8010) in the erxes monorepo.

This is a read-only bug fix for issue #8010: Error: Limit must be between 1 and 100. The PR clamps the limit argument in the userQueries GraphQL resolver to the valid range [1, 100] with a default of 20 before passing it to the cursorPaginate helper.

I'm ready to answer questions about this specific PR — the diff, the fix approach, potential edge cases, or how it relates to the reported issue.

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.

Error: Limit must be between 1 and 100

1 participant