Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

up #1709

Conversation

emrgnt-cmplxty
Copy link
Contributor

@emrgnt-cmplxty emrgnt-cmplxty commented Dec 18, 2024

Important

This PR adds user-specific limits for documents, chunks, and collections, enforces these limits during document creation, and updates chunk listing logic, along with corresponding tests.

  • Behavior:
    • Add default limits for documents, chunks, and collections per user in AppConfig.
    • Implement checks in create_document in documents_router.py to enforce user limits.
    • Remove rate limit dependency from /health endpoint in system_router.py.
  • Database:
    • Update list_chunks in chunks.py to use proper parameter numbering for pagination.
  • Services:
    • Add methods get_user_max_documents, get_user_max_chunks, and get_user_max_collections in management_service.py to retrieve user limits.
  • Tests:
    • Add integration tests in test_chunks.py and test_documents.py for chunk listing, pagination, and document creation with limits.

This description was created by Ellipsis for 230a7d1. It will automatically update as commits are pushed.

@emrgnt-cmplxty emrgnt-cmplxty marked this pull request as ready for review December 18, 2024 01:49
@emrgnt-cmplxty emrgnt-cmplxty merged commit fbe8337 into main Dec 18, 2024
1 of 2 checks passed
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 230a7d1 in 1 minute and 48 seconds

More details
  • Looked at 545 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. py/core/database/chunks.py:1279
  • Draft comment:
    The change to use parameterized queries with proper parameter numbering improves security by preventing SQL injection vulnerabilities. This is a good practice.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR introduces a change in the way query parameters are handled in the list_chunks method. The previous implementation used string formatting to insert parameter indices, which could lead to SQL injection if not handled properly. The new implementation uses parameterized queries with proper parameter numbering, which is a safer approach.
2. py/core/main/api/v3/documents_router.py:316
  • Draft comment:
    The addition of user limit checks for documents, chunks, and collections is a good practice to prevent resource overuse.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR introduces a check for user limits on documents, chunks, and collections in the create_document method. This is a good practice to prevent users from exceeding their allowed resources.
3. py/core/main/api/v3/system_router.py:33
  • Draft comment:
    The rate limit dependency is commented out. Ensure this is intentional and appropriate for production environments.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR comments out the rate limit dependency in the health check endpoint. This might be intentional for testing purposes, but it's important to ensure that this change is intended for production as well.
4. py/r2r.toml:4
  • Draft comment:
    The introduction of default maximum limits for documents, chunks, and collections per user is a good practice for resource management.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR introduces default maximum limits for documents, chunks, and collections per user in the configuration file. This is a good practice to manage resource allocation and prevent abuse.

Workflow ID: wflow_X89LfbMLzDNe82ca


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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