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

Allow superuser to delete any document #1719

Merged
merged 6 commits into from
Dec 21, 2024
Merged

Conversation

NolanTrem
Copy link
Collaborator

@NolanTrem NolanTrem commented Dec 21, 2024

Important

Enable superusers to delete any document, update related tests, and refine API and database handling for document management.

  • Behavior:
    • Superusers can delete any document, verified by tests in DocumentsAndCollectionsIntegrationUser.test.ts.
    • Regular users cannot delete documents they do not own, enforced by status checks (403/404).
  • API Changes:
    • Updated delete_document_by_id in documents_router.py to allow superuser deletions without owner checks.
    • Added tests for conversation creation, update, and deletion in ConversationsIntegrationSuperUser.test.ts.
  • Database:
    • delete_documents_and_chunks_by_filter in management_service.py now supports superuser deletions.
    • create_conversation and update_conversation in conversations.py handle exceptions more robustly.
  • Misc:
    • Increased timeout for GraphsIntegrationSuperUser.test.ts to 60000ms.
    • Removed debug prints from async_client.py and base_client.py.

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

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.

❌ Changes requested. Reviewed everything up to 4d5c922 in 1 minute and 45 seconds

More details
  • Looked at 799 lines of code in 12 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. js/sdk/__tests__/DocumentsAndCollectionsIntegrationUser.test.ts:216
  • Draft comment:
    The test for listing user 2's document chunks expects a 404 error, which is inconsistent with the test for user 1's document chunks that expects a 403 error. Ensure the expected status codes are consistent and correct.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. js/sdk/__tests__/DocumentsAndCollectionsIntegrationUser.test.ts:222
  • Draft comment:
    The test for user 1 deleting user 2's document expects a 404 error, which is inconsistent with the test for user 2 deleting user 1's document that expects a 403 error. Ensure the expected status codes are consistent and correct.
  • Reason this comment was not posted:
    Marked as duplicate.
3. py/sdk/v3/conversations.py:106
  • Draft comment:
    Consider using PATCH instead of POST for updating resources to adhere to RESTful practices.
            "PATCH",
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_H3VdoE6dR5L5zxG5


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

});
expect(response.results).toBeDefined();
expect(response.results.name).toBe("Updated Name");
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a check to ensure the conversation ID is correct after updating the name.

Suggested change
});
expect(response.results.id).toBe(conversationId);

name: options.name,
};

return this.client.makeRequest("POST", `conversations/${options.id}`, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using PATCH instead of POST for updating resources to adhere to RESTful practices.

Suggested change
return this.client.makeRequest("POST", `conversations/${options.id}`, {
return this.client.makeRequest("PATCH", `conversations/${options.id}`, {

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! Incremental review on 9e4702a in 29 seconds

More details
  • Looked at 22 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/sdk/__tests__/DocumentsAndCollectionsIntegrationUser.test.ts:213
  • Draft comment:
    The status code for unauthorized document chunk listing should be consistent. Consider using 404 for both cases or 403, depending on the intended behavior. This inconsistency is also present in the document deletion tests on lines 219 and 225.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_ZLlACMfrouq7xkb7


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

@NolanTrem NolanTrem merged commit 7f3ec47 into main Dec 21, 2024
14 of 15 checks passed
@NolanTrem NolanTrem deleted the Nolan/SetConversationName branch December 21, 2024 19:44
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