-
-
Notifications
You must be signed in to change notification settings - Fork 273
Moved /repositories under organization
#1380
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
Conversation
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis change restructures repository-related routes and data queries to nest repositories under organizations, both in the backend and frontend. The backend GraphQL schema and resolvers now require and use an organization key for repository lookups, performing case-insensitive matching. Corresponding frontend code updates include changes to GraphQL queries, URL structures, navigation logic, and test data to reflect the new organization-based hierarchy. Mock data and tests have been updated to include organization information and to verify the new lookup and routing logic. The casing of repository names in URLs is now preserved rather than being forced to lowercase. Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (4)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts (1)
20-20: Add leading slash to URL pathThe URL path should start with a leading slash to ensure proper routing in the application.
- await page.goto('organizations/OWASP/repositories/test-repository') + await page.goto('/organizations/OWASP/repositories/test-repository')
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
backend/apps/github/graphql/nodes/repository.py(1 hunks)backend/apps/github/graphql/nodes/user.py(3 hunks)backend/tests/apps/github/graphql/nodes/repository_test.py(1 hunks)backend/tests/apps/github/graphql/nodes/user_test.py(1 hunks)frontend/__tests__/e2e/pages/ProjectDetails.spec.ts(1 hunks)frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts(1 hunks)frontend/__tests__/unit/data/mockProjectDetailsData.ts(2 hunks)frontend/__tests__/unit/pages/RepositoryDetails.test.tsx(1 hunks)frontend/src/components/RepositoriesCard.tsx(1 hunks)frontend/src/server/queries/organizationQueries.ts(1 hunks)frontend/src/server/queries/projectQueries.ts(1 hunks)frontend/src/server/queries/userQueries.ts(1 hunks)frontend/src/types/project.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
backend/apps/github/graphql/nodes/user.py (1)
backend/apps/github/graphql/nodes/organization.py (1)
OrganizationNode(22-75)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Run frontend unit tests
- GitHub Check: Run frontend e2e tests
- GitHub Check: Run backend tests
- GitHub Check: CodeQL (python)
- GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (15)
backend/tests/apps/github/graphql/nodes/user_test.py (1)
31-31: LGTM: Organization field added to expected fieldsThe addition of the "organization" field to the expected fields list in the
UserNodetests correctly reflects the schema changes for exposing organization context in the GraphQL API.frontend/__tests__/unit/pages/RepositoryDetails.test.tsx (2)
6-6: Updated import path correctly uses new organization-nested routingThe import path has been properly updated to reflect the new route structure where repositories are nested under organizations.
28-28:❓ Verification inconclusive
Update
useParamsmock to include organizationKeyThe component is now imported from a path that includes an organizationKey parameter, but the
useParamsmock doesn't include this parameter. This could potentially cause issues if the component requires this value.
🏁 Script executed:
#!/bin/bash # Check if the component uses organizationKey from useParams rg -A 2 -B 2 "useParams" "app/organizations/\[organizationKey\]/repositories/\[repositoryKey\]/page.tsx"Length of output: 222
Update the
useParamsmock to includeorganizationKeyThe component now appears to expect an
organizationKeyfield from the URL parameters. However, our initial verification (attempting to search for the file atapp/organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx) couldn’t locate the component file, which prevents a definitive automated confirmation thatorganizationKeyis used. Please verify manually that the component under test correctly consumes theorganizationKeyparameter. Once confirmed, update the test mock accordingly. For example, the updated mock should resemble:useParams: () => ({ repositoryKey: 'test-repository', organizationKey: 'test-organization' }),frontend/src/types/project.ts (1)
81-83: LGTM: Repository type properly extended with organization dataThe
RepositoryCardPropsinterface has been correctly updated to include the optional organization field with login information, which aligns with the backend GraphQL schema changes and supports the new URL structure.frontend/__tests__/e2e/pages/ProjectDetails.spec.ts (1)
105-105: Great update to reflect the new repository URL structure.The test assertion has been correctly updated to verify the new URL pattern that includes the organization path segment. This aligns with the PR objectives of moving repository routes under the organization context.
backend/tests/apps/github/graphql/nodes/repository_test.py (1)
30-30: Good addition of organization field to expected test fields.This test update properly validates that the
RepositoryNodeGraphQL type exposes the organization field, which is essential for the new nested URL structure and organization-aware routing.backend/apps/github/graphql/nodes/repository.py (1)
39-39: Correct implementation of organization field in repository schema.Adding the organization field to the RepositoryNode's Meta fields tuple is the key backend change needed to support the repository-under-organization structure. This field will allow GraphQL queries to access the organization data associated with repositories.
frontend/src/server/queries/organizationQueries.ts (1)
61-63: Well-structured GraphQL query update to fetch organization data.The query now properly requests the organization's login for each repository, which is essential for constructing the new organization-scoped repository URLs and implementing the updated routing structure.
frontend/src/server/queries/userQueries.ts (1)
31-33: Consistent addition of organization context to repository data.The addition of
organization { login }totopContributedRepositoriesis aligned with the PR's objective of moving repositories under organizations. This change correctly enables the frontend to reference the organization login when working with repositories.frontend/__tests__/unit/data/mockProjectDetailsData.ts (2)
58-60: Mock data properly updated to include organization information.The addition of the
organizationobject withlogin: 'OWASP'to the first repository mock correctly matches the data structure changes in the GraphQL queries.
71-73: Mock data properly updated to include organization information.The addition of the
organizationobject withlogin: 'OWASP'to the second repository mock correctly matches the data structure changes in the GraphQL queries.frontend/src/server/queries/projectQueries.ts (1)
45-47: Appropriate schema update to include organization context in repositories.The addition of
organization { login }to the repository data structure in theGET_PROJECT_DATAquery correctly aligns with the PR's objective of moving repositories under organizations.backend/apps/github/graphql/nodes/user.py (3)
6-6: Correct import of OrganizationNode for the schema update.The import of
OrganizationNodefrom the organization module is appropriate for adding the organization field to the UserNode.
22-22: GraphQL schema properly extended to include organization relationship.The addition of the
organizationfield to the UserNode schema with the correct type (OrganizationNode) aligns with the PR objective of connecting repositories to organizations.
51-54: Appropriate resolver implementation for the organization field.The resolver correctly returns the
organizationattribute from the user instance, which completes the schema update for exposing organization data through the UserNode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/src/app/organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx (1)
36-36: Consider adding organizationKey to the dependency arrayThe useEffect dependency array includes
repositoryKeybut notorganizationKey. While unlikely to cause issues in typical navigation patterns, addingorganizationKeywould ensure the effect re-runs if only the organization changes.- }, [data, graphQLRequestError, repositoryKey]) + }, [data, graphQLRequestError, repositoryKey, organizationKey])
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
backend/apps/github/graphql/queries/repository.py(3 hunks)backend/tests/apps/github/graphql/queries/repository_test.py(2 hunks)frontend/src/app/organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx(1 hunks)frontend/src/server/queries/repositoryQueries.ts(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
frontend/src/app/organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx (1)
frontend/src/server/queries/repositoryQueries.ts (1)
GET_REPOSITORY_DATA(3-54)
backend/tests/apps/github/graphql/queries/repository_test.py (3)
backend/apps/github/graphql/queries/repository.py (2)
RepositoryQuery(10-67)resolve_repository(25-44)backend/tests/apps/github/graphql/queries/user_test.py (2)
mock_info(18-20)mock_info(52-54)backend/apps/github/models/repository.py (1)
Repository(22-332)
backend/apps/github/graphql/queries/repository.py (1)
backend/apps/github/models/repository.py (1)
Repository(22-332)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Run frontend unit tests
- GitHub Check: Run backend tests
- GitHub Check: Run frontend e2e tests
- GitHub Check: CodeQL (python)
- GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (13)
frontend/src/app/organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx (2)
21-21: URL parameter extraction looks goodThe component now correctly extracts both
organizationKeyandrepositoryKeyfrom the URL parameters, aligning with the new nested route structure.
25-25: Good update to query variablesThe GraphQL query variables now include both
repositoryKeyandorganizationKey, matching the updated backend requirements.backend/tests/apps/github/graphql/queries/repository_test.py (5)
26-32: Good test refactoring for select_relatedThe test has been properly updated to mock the new query structure using
select_related. This correctly tests the implementation of the optimized query pattern.
34-35: Correctly updated test parametersThe test now includes the new
organization_keyparameter, reflecting the updated resolver signature.
38-42: Good assertion for case-insensitive lookupThe test now correctly verifies both the select_related call and the case-insensitive lookup on repository key and organization login.
46-52: Consistent test update for error caseThe "not found" test case is consistently updated with the same pattern as the successful case, ensuring both paths are properly tested.
56-65: Proper assertion for not found caseThe assertions correctly verify that select_related is called with "organization" and that get is called with the appropriate parameters, even in the failure case.
frontend/src/server/queries/repositoryQueries.ts (2)
4-5: Updated query parameters match backend changesThe GraphQL query has been properly updated to require both
repositoryKeyandorganizationKeyas parameters, aligning with the backend changes.
26-28: Good addition of organization fieldThe query now includes the
organization { login }field, which is necessary for the new nested URL structure and properly reflects the updated data relationships.backend/apps/github/graphql/queries/repository.py (4)
15-17: Good update to GraphQL field definitionThe repository field now correctly requires the organization_key parameter, implementing the API change to nest repositories under organizations.
25-37: Updated resolver signature and documentationThe resolver method signature and documentation have been properly updated to include the organization_key parameter.
39-42: Good implementation of case-insensitive lookupThe repository lookup now:
- Uses
select_related("organization")for optimized database access- Performs case-insensitive lookup on both repository key and organization login
This properly implements both the nested repository structure and case-insensitive URL handling mentioned in the PR description.
64-64: Consistent case-insensitive implementationThe repositories resolver also uses case-insensitive lookup (
__iexact) on organization login, maintaining consistency with the individual repository lookup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
backend/apps/github/graphql/queries/repository.py(3 hunks)backend/tests/apps/github/graphql/queries/repository_test.py(2 hunks)frontend/src/components/RecentIssues.tsx(1 hunks)frontend/src/components/RecentPullRequests.tsx(1 hunks)frontend/src/components/RecentReleases.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- backend/tests/apps/github/graphql/queries/repository_test.py
- backend/apps/github/graphql/queries/repository.py
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Run frontend e2e tests
- GitHub Check: Run frontend unit tests
- GitHub Check: Run backend tests
- GitHub Check: CodeQL (python)
- GitHub Check: CodeQL (javascript-typescript)
arkid15r
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dishant1804 please look into recent issues/PRs/releases cases.
|
arkid15r
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* moved /repositories under organization * case insensitive URL * Update code * recent issues/releases/PR handled * Update code --------- Co-authored-by: Arkadii Yakovets <[email protected]>


Resolves #1351