Skip to content

Conversation

@kaysiz
Copy link
Member

@kaysiz kaysiz commented May 15, 2025

No description provided.

@kaysiz kaysiz self-assigned this May 15, 2025
@kaysiz kaysiz requested review from Copilot and removed request for Copilot May 15, 2025 11:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces client ID registration, adding a new Client model field, endpoint, serializer, email notification, and supporting infrastructure.

  • Add Client.client_id auto-generation and migrations to support unique IDs
  • Create ClientSerializer with full validation and views for registration and validation, including email notifications
  • Update settings, Docker, and CI configs to support database-driven registration endpoints

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rorapi/v2/tests.py Add model tests for client ID creation and rate limiting
rorapi/v2/serializers.py Introduce ClientSerializer with validation for all fields
rorapi/v2/models.py Add Client model with client_id generation on save
rorapi/common/views.py Add ClientRegistrationView and ValidateClientView
rorapi/common/urls.py Wire up registration and validation routes
rorapi/settings.py Conditional DB config for collectstatic, toggle rate limiting
rorapi/management/commands/generaterorid.py Add helper to generate random ROR client IDs
README.md Document credentials and setup for client ID registration
Comments suppressed due to low confidence (8)

rorapi/common/views.py:48

  • No tests cover the ClientRegistrationView endpoint or its email-sending side effects. Add integration tests to verify 201 responses, valid client_id in the payload, and that an email is queued or sent.
class ClientRegistrationView(APIView):

rorapi/v2/models.py:164

  • The current implementation may generate duplicate IDs, causing a unique constraint error on save. Consider looping (with a max retry count) to regenerate until a truly unique client_id is produced.
def generate_client_id():

rorapi/management/commands/generaterorid.py:30

  • The function references base32_crockford but there is no import for it; this will cause a NameError at runtime. Add import base32_crockford at the top of the module.
def generate_ror_client_id():

rorapi/settings.py:295

  • [nitpick] Duplicate import os—remove the redundant import to keep imports clean.
import os

rorapi/settings.py:117

  • [nitpick] Indentation of the 'default' key is inconsistent inside the DATABASES dict, making the block harder to read—align the braces and contents.
    'default': {

rorapi/common/urls.py:17

  • The register endpoint omits a trailing slash, while other paths include or omit slashes inconsistently. Standardize URL patterns (e.g., always include a trailing slash) for consistency.
re_path(r"^(?P<version>(v1|v2))\/register$", ClientRegistrationView.as_view()),

README.md:27

  • [nitpick] Consistently capitalize 'GitHub' instead of 'Github' to match project branding and external references.
but should comment out this line https://github.com/ror-community/ror-api/blob/8a5a5ae8b483564c966a7184349c581dcae756ef/rorapi/management/commands/setup.py#L13 so that there is no attempt to send a Github token when retrieving a data dump for indexing.

rorapi/common/views.py:70

  • [nitpick] The multi-line f-string includes leading indentation in the email body. Consider using textwrap.dedent or building the string without extra spaces to avoid unwanted whitespace in sent emails.
return f"""

@kaysiz kaysiz merged commit 1efb824 into master May 15, 2025
3 checks passed
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.

3 participants