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

chore: move some integrations to SDL pattern #10000

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

mattkrick
Copy link
Member

@mattkrick mattkrick commented Jul 18, 2024

Description

Moves TeamMemberIntegrations to the SDL pattern

I started getting weird errors when refactoring the TeamMember GQL object and figured moving things to the SDL pattern would be easier than troubleshooting it

Summary by CodeRabbit

  • New Features

    • Introduced integrations with Atlassian, Jira, Azure DevOps, GitHub, GitLab, Mattermost, Slack, and Microsoft Teams.
    • Added comprehensive support for Azure DevOps work items and search queries.
  • Refactor

    • Simplified and refactored existing GraphQL schema definitions to enhance clarity and performance.
  • Bug Fixes

    • Improved handling of team and user identification fields in Jira and Azure DevOps projects.
  • Documentation

    • Updated type definitions and field descriptions for better understanding and consistency.

Copy link
Contributor

coderabbitai bot commented Jul 18, 2024

Walkthrough

The changes introduce extensive updates to the project, focusing on integrating various external services such as Jira, GitHub, GitLab, Azure DevOps, Mattermost, Slack, and Microsoft Teams. New GraphQL types and schema definitions are added, and existing ones are modified to enhance integration capabilities. Additionally, some deprecated or unused functionalities are removed. These changes collectively aim to provide more robust and versatile integration options for users.

Changes

Files/Paths Change Summaries
codegen.json, jiraServerLoaders.ts, azureDevOpsLoaders.ts Added new fields like userId and teamId to existing types.
packages/server/.../resolverTypes.ts, .../typeDefs/*.graphql Introduced new GraphQL types for integrations with external services like Atlassian, AzureDevOps, GitHub, GitLab, JiraServer, Mattermost, Slack, and Microsoft Teams.
packages/server/.../_legacy.graphql Removed several types related to Jira, GitHub, and Azure DevOps, indicating refactoring or removal of unused functionalities.
packages/server/.../rootSchema.ts Refactored schema definitions and endpoint nesting logic, added new schemas and resolvers for integrations.
packages/server/graphql/.../TeamMemberIntegrations.ts Removed fields for various integrations, effectively stripping out integration-related logic from this file.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant GraphQLServer
    participant AtlassianAPI
    participant AzureDevOpsAPI
    participant GitHubAPI
    participant GitLabAPI

    Client->>GraphQLServer: Query integrations
    GraphQLServer->>AtlassianAPI: Fetch Atlassian data
    GraphQLServer->>AzureDevOpsAPI: Fetch AzureDevOps data
    GraphQLServer->>GitHubAPI: Fetch GitHub data
    GraphQLServer->>GitLabAPI: Fetch GitLab data

    AtlassianAPI->>GraphQLServer: Return Atlassian data
    AzureDevOpsAPI->>GraphQLServer: Return AzureDevOps data
    GitHubAPI->>GraphQLServer: Return GitHub data
    GitLabAPI->>GraphQLServer: Return GitLab data

    GraphQLServer->>Client: Return aggregated integration data
Loading

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5c45379 and 31e7668.

Files selected for processing (48)
  • codegen.json (4 hunks)
  • packages/server/dataloader/azureDevOpsLoaders.ts (2 hunks)
  • packages/server/dataloader/jiraServerLoaders.ts (2 hunks)
  • packages/server/graphql/private/typeDefs/_legacy.graphql (3 hunks)
  • packages/server/graphql/public/rootSchema.ts (4 hunks)
  • packages/server/graphql/public/typeDefs/AtlassianIntegration.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/AzureDevOpsIntegration.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/AzureDevOpsRemoteProject.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/AzureDevOpsSearchQuery.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/AzureDevOpsWorkItem.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/GitHubIntegration.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/GitHubSearchQuery.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/GitLabIntegration.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/GitLabSearchQuery.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/JiraSearchQuery.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/JiraServerIntegration.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/JiraServerIssue.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/MSTeamsIntegration.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/MattermostIntegration.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/Organization.graphql (3 hunks)
  • packages/server/graphql/public/typeDefs/PageInfo.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/PageInfoDateCursor.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/SlackIntegration.graphql (1 hunks)
  • packages/server/graphql/public/typeDefs/TeamMemberIntegrations.graphql (2 hunks)
  • packages/server/graphql/public/typeDefs/_legacy.graphql (5 hunks)
  • packages/server/graphql/public/types/AtlassianIntegration.ts (2 hunks)
  • packages/server/graphql/public/types/AzureDevOpsIntegration.ts (1 hunks)
  • packages/server/graphql/public/types/AzureDevOpsRemoteProject.ts (1 hunks)
  • packages/server/graphql/public/types/AzureDevOpsSearchQuery.ts (1 hunks)
  • packages/server/graphql/public/types/AzureDevOpsWorkItem.ts (1 hunks)
  • packages/server/graphql/public/types/GitHubIntegration.ts (1 hunks)
  • packages/server/graphql/public/types/GitLabIntegration.ts (1 hunks)
  • packages/server/graphql/public/types/JiraSearchQuery.ts (1 hunks)
  • packages/server/graphql/public/types/JiraServerIntegration.ts (1 hunks)
  • packages/server/graphql/public/types/JiraServerIssue.ts (1 hunks)
  • packages/server/graphql/public/types/JiraServerRemoteProject.ts (1 hunks)
  • packages/server/graphql/public/types/MSTeamsIntegration.ts (1 hunks)
  • packages/server/graphql/public/types/MattermostIntegration.ts (1 hunks)
  • packages/server/graphql/public/types/Organization.ts (2 hunks)
  • packages/server/graphql/public/types/SlackIntegration.ts (1 hunks)
  • packages/server/graphql/public/types/TeamMemberIntegrations.ts (1 hunks)
  • packages/server/graphql/public/types/_xGitLabProject.ts (1 hunks)
  • packages/server/graphql/rootTypes.ts (2 hunks)
  • packages/server/graphql/types/AtlassianIntegration.ts (1 hunks)
  • packages/server/graphql/types/GitHubIntegration.ts (1 hunks)
  • packages/server/graphql/types/Organization.ts (1 hunks)
  • packages/server/graphql/types/SlackIntegration.ts (1 hunks)
  • packages/server/graphql/types/TeamMemberIntegrations.ts (1 hunks)
Additional context used
Gitleaks
packages/server/graphql/public/types/JiraSearchQuery.ts

3-3: Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality.

(atlassian-api-token)

packages/server/graphql/public/types/JiraServerIssue.ts

14-14: Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality.

(atlassian-api-token)

Biome
packages/server/graphql/public/types/GitLabIntegration.ts

[error] 146-146: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/server/graphql/public/types/JiraServerIntegration.ts

[error] 150-150: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Additional comments not posted (224)
packages/server/graphql/types/SlackIntegration.ts (1)

1-5: Empty fields object in GraphQL type definition.

The SlackIntegration GraphQLObjectType now has an empty fields object. This might indicate a temporary state or a deprecation. Ensure that this change is intentional and that all dependent code is updated accordingly.

packages/server/graphql/types/GitHubIntegration.ts (1)

1-5: Empty fields object in GraphQL type definition.

The GitHubIntegration GraphQLObjectType now has an empty fields object. This might indicate a temporary state or a deprecation. Ensure that this change is intentional and that all dependent code is updated accordingly.

packages/server/graphql/public/types/AzureDevOpsSearchQuery.ts (1)

1-5: Verify the correctness of the resolver function.

The AzureDevOpsSearchQuery resolver defines a single function for the isWIQL field. Ensure that the implementation correctly handles the expected input and output.

Verification successful

The resolver function for isWIQL correctly handles the expected input and output.

The isWIQL field is defined as a boolean in the GraphQL schema, and the resolver function converts the isWIQL property to a boolean, ensuring correct handling.

  • packages/server/graphql/public/typeDefs/AzureDevOpsSearchQuery.graphql
  • packages/server/graphql/public/types/AzureDevOpsSearchQuery.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the resolver function for isWIQL correctly handles the expected input and output.

# Test: Search for the usage of the isWIQL resolver function in the codebase. Expect: Correct handling of input and output.
rg --type js --type ts 'isWIQL'

Length of output: 3131


Script:

#!/bin/bash
# Description: Verify the structure of the input to the isWIQL resolver function and its usage in the GraphQL schema and queries/mutations.

# Search for the definition of the AzureDevOpsSearchQuery type in the GraphQL schema.
rg --type graphql 'type AzureDevOpsSearchQuery'

# Search for queries or mutations that use the isWIQL field.
rg --type graphql 'isWIQL'

Length of output: 140


Script:

#!/bin/bash
# Description: Verify the structure of the input to the isWIQL resolver function and its usage in the GraphQL schema and queries/mutations.

# Find all GraphQL schema files and search for the definition of the AzureDevOpsSearchQuery type.
fd -e graphql -e gql -e js -e ts -x grep -H 'type AzureDevOpsSearchQuery' {}

# Find all GraphQL schema files and search for queries or mutations that use the isWIQL field.
fd -e graphql -e gql -e js -e ts -x grep -H 'isWIQL' {}

Length of output: 2206

packages/server/graphql/types/Organization.ts (1)

6-6: Verify the impact of removing all fields from Organization.

The Organization type has been stripped of all fields, leaving it empty. Ensure that this change does not break any existing functionality and that the fields are correctly migrated or handled elsewhere.

packages/server/graphql/public/typeDefs/MSTeamsIntegration.graphql (1)

1-14: LGTM!

The MSTeamsIntegration type is well-defined and straightforward.

packages/server/graphql/public/typeDefs/MattermostIntegration.graphql (3)

1-3: Well-documented type definition.

The comments provide clear and concise documentation for the MattermostIntegration type.


4-8: Correct use of GraphQL type definition.

The auth field is correctly defined with a clear type and documentation.


10-13: Correct use of GraphQL list type.

The sharedProviders field is correctly defined as a non-nullable list of IntegrationProviderWebhook with clear documentation.

packages/server/graphql/public/typeDefs/GitHubSearchQuery.graphql (4)

1-3: Well-documented type definition.

The comments provide clear and concise documentation for the GitHubSearchQuery type.


4-8: Correct use of GraphQL type definition.

The id field is correctly defined with a clear type and documentation.


10-13: Correct use of GraphQL string type.

The queryString field is correctly defined as a non-nullable string with clear documentation.


15-18: Correct use of GraphQL DateTime type.

The lastUsedAt field is correctly defined as a non-nullable DateTime with clear documentation.

packages/server/graphql/public/types/_xGitLabProject.ts (3)

3-4: Clear explanation for the workaround.

The comments provide a clear explanation for the workaround due to the GraphQL Codegen bug.


5-10: Correct use of TypeScript type definition.

The _xGitLabProjectSource type is correctly defined with the necessary fields.


Line range hint 12-15:
Correct use of TypeScript resolver definition.

The _xGitLabProject resolver is correctly defined and follows TypeScript conventions.

packages/server/graphql/public/typeDefs/PageInfo.graphql (5)

1-3: Well-documented type definition.

The comments provide clear and concise documentation for the PageInfo type.


4-8: Correct use of GraphQL boolean type.

The hasNextPage field is correctly defined as a non-nullable boolean with clear documentation.


10-13: Correct use of GraphQL boolean type.

The hasPreviousPage field is correctly defined as a non-nullable boolean with clear documentation.


15-18: Correct use of GraphQL string type.

The startCursor field is correctly defined as a nullable string with clear documentation.


20-23: Correct use of GraphQL string type.

The endCursor field is correctly defined as a nullable string with clear documentation.

packages/server/graphql/public/typeDefs/PageInfoDateCursor.graphql (4)

8-8: LGTM!

The hasNextPage field is correctly defined and well-documented.


13-13: LGTM!

The hasPreviousPage field is correctly defined and well-documented.


18-18: LGTM!

The startCursor field is correctly defined and well-documented.


23-23: LGTM!

The endCursor field is correctly defined and well-documented.

packages/server/graphql/public/typeDefs/GitLabSearchQuery.graphql (4)

8-8: LGTM!

The id field is correctly defined and well-documented.


13-13: LGTM!

The queryString field is correctly defined and well-documented.


18-18: LGTM!

The selectedProjectsIds field is correctly defined and well-documented.


23-23: LGTM!

The lastUsedAt field is correctly defined and well-documented.

packages/server/graphql/public/typeDefs/AzureDevOpsRemoteProject.graphql (11)

5-5: LGTM!

The id field is correctly defined and well-documented.


6-6: LGTM!

The service field is correctly defined and well-documented.


11-11: LGTM!

The teamId field is correctly defined and well-documented.


16-16: LGTM!

The userId field is correctly defined and well-documented.


17-17: LGTM!

The lastUpdateTime field is correctly defined and well-documented.


18-18: LGTM!

The self field is correctly defined and well-documented.


23-23: LGTM!

The instanceId field is correctly defined and well-documented.


24-24: LGTM!

The name field is correctly defined and well-documented.


25-25: LGTM!

The revision field is correctly defined and well-documented.


26-26: LGTM!

The state field is correctly defined and well-documented.


27-28: LGTM!

The url and visibility fields are correctly defined and well-documented.

packages/server/graphql/public/typeDefs/JiraSearchQuery.graphql (5)

8-8: LGTM!

The id field is correctly defined and well-documented.


13-13: LGTM!

The queryString field is correctly defined and well-documented.


18-18: LGTM!

The isJQL field is correctly defined and well-documented.


23-23: LGTM!

The projectKeyFilters field is correctly defined and well-documented.


28-28: LGTM!

The lastUsedAt field is correctly defined and well-documented.

packages/server/graphql/public/typeDefs/AzureDevOpsSearchQuery.graphql (1)

1-29: LGTM!

The AzureDevOpsSearchQuery type definition is well-structured and adheres to GraphQL best practices.

packages/server/graphql/public/types/AzureDevOpsRemoteProject.ts (1)

1-14: LGTM! But verify the type definition.

The AzureDevOpsRemoteProject resolver is well-structured and adheres to GraphQL best practices.

However, verify the type definition as indicated in the comment.

packages/server/graphql/public/types/SlackIntegration.ts (1)

1-18: LGTM!

The SlackIntegration resolver is well-structured and adheres to GraphQL best practices.

packages/server/graphql/public/types/MSTeamsIntegration.ts (1)

1-24: LGTM!

The MSTeamsIntegration resolver is well-structured and adheres to GraphQL best practices.

packages/server/graphql/public/types/AzureDevOpsWorkItem.ts (3)

16-22: Ensure proper error handling for dataLoader operations.

The project resolver uses dataLoader to fetch project data. Ensure that proper error handling is in place for dataLoader operations to handle potential failures gracefully.


6-6: Ensure the service value is consistent.

The __isTypeOf function checks if the service is 'azureDevOps'. Ensure that this service value is consistent with other parts of the codebase.

Verification successful

Ensure the service value is consistent.

The __isTypeOf function checks if the service is 'azureDevOps'. The term 'azureDevOps' is used consistently across the codebase.

  • packages/server/graphql/public/types/AzureDevOpsWorkItem.ts
  • packages/server/utils/getTaskServicesWithPerms.ts
  • packages/server/utils/AzureDevOpsServerManager.ts
  • packages/client/utils/relay/LocalPokerHandler.ts
  • packages/server/graphql/types/Task.ts
  • Many other files as indicated in the search results.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the 'azureDevOps' service value.

# Test: Search for the service value. Expect: Consistent usage of 'azureDevOps'.
rg --type python -A 5 $'service === \'azureDevOps\''

Length of output: 88


Script:

#!/bin/bash
# Description: Verify the consistency of the 'azureDevOps' service value.

# Test: Search for the service value. Expect: Consistent usage of 'azureDevOps'.
rg --type js -A 5 $'service === \'azureDevOps\''

Length of output: 53


Script:

#!/bin/bash
# Description: Verify the consistency of the 'azureDevOps' service value.

# Test: Search for the service value with a broader pattern to include variations.
rg --type js -i -A 5 'service\s*===\s*[\'"]azureDevOps[\'"]'

Length of output: 93


Script:

#!/bin/bash
# Description: Verify the consistency of the 'azureDevOps' service value.

# Test: Search for the service value with a broader pattern to include variations.
rg --type js -i -A 5 "service\s*===\s*['\"]azureDevOps['\"]"

Length of output: 66


Script:

#!/bin/bash
# Description: Verify the usage of the 'azureDevOps' service value across the codebase.

# Test: Search for the term 'azureDevOps' to gather more context on its usage.
rg -i 'azureDevOps'

Length of output: 80569


7-10: Ensure getInstanceId handles all edge cases.

The id resolver uses getInstanceId to extract an instance ID from the URL. Ensure that getInstanceId handles all possible edge cases and invalid URLs.

packages/server/graphql/public/types/MattermostIntegration.ts (2)

16-24: Ensure proper error handling for dataLoader operations.

The sharedProviders resolver uses dataLoader to fetch team and organisation data. Ensure that proper error handling is in place for dataLoader operations to handle potential failures gracefully.


9-14: Ensure proper error handling for dataLoader operations.

The auth resolver uses dataLoader to fetch authentication data. Ensure that proper error handling is in place for dataLoader operations to handle potential failures gracefully.

packages/server/graphql/public/typeDefs/TeamMemberIntegrations.graphql (1)

53-53: Ensure the gcal field is necessary.

The gcal field was removed and then re-added. Ensure that this field is necessary and not redundant.

Verification successful

The gcal field is necessary.

The gcal field is referenced extensively across multiple files, indicating its integral role in the codebase for Google Calendar integration functionalities.

  • packages/server/dataloader/gcalLoaders.ts
  • packages/server/graphql/public/typeDefs/TeamMemberIntegrations.graphql
  • packages/server/graphql/mutations/addTeamMemberIntegrationAuth.ts
  • packages/client/components/TeamPrompt/WorkDrawer/GCalIntegrationPanel.tsx
  • packages/client/components/ScheduleDialog.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the necessity of the `gcal` field.

# Test: Search for the usage of the `gcal` field. Expect: Necessary usage.
rg --type graphql -A 5 $'gcal'

Length of output: 61


Script:

#!/bin/bash
# Description: Verify the necessity of the `gcal` field.

# Test: Search for the usage of the `gcal` field. Expect: Necessary usage.
rg -A 5 'gcal'

Length of output: 75270

packages/server/graphql/public/typeDefs/JiraServerIntegration.graphql (7)

4-8: Field id looks good.

The id field is correctly documented and typed.


10-13: Field auth looks good.

The auth field is correctly documented and typed.


15-18: Field sharedProviders looks good.

The sharedProviders field is correctly documented and typed.


20-37: Field issues looks good.

The issues field is correctly documented and typed, with appropriate arguments for pagination, searching, and filtering.


39-42: Field projects looks good.

The projects field is correctly documented and typed.


43-43: Field providerId looks good.

The providerId field is correctly typed.


45-48: Field searchQueries looks good.

The searchQueries field is correctly documented and typed.

packages/server/graphql/public/types/GitHubIntegration.ts (4)

7-8: Resolver id looks good.

The id resolver correctly constructs an ID by joining teamId and userId.


10-13: Resolver accessToken looks good.

The accessToken resolver correctly returns the access token if the viewerId matches the userId.


15-15: Resolver isActive looks good.

The isActive resolver correctly returns true if the accessToken is present.


17-27: Resolver githubSearchQueries looks good.

The githubSearchQueries resolver correctly filters out expired queries and updates the database if necessary.

packages/server/graphql/public/types/JiraServerRemoteProject.ts (4)

7-8: Resolver __isTypeOf looks good.

The __isTypeOf resolver correctly checks if the service is jiraServer.


9-9: Resolver id looks good.

The id resolver correctly constructs an ID using IntegrationRepoId.join.


10-10: Resolver service looks good.

The service resolver correctly returns the string jiraServer.


12-21: Resolver avatar looks good.

The avatar resolver correctly fetches the project avatar using JiraServerRestManager and falls back to a default avatar if necessary.

packages/server/graphql/public/typeDefs/SlackIntegration.graphql (14)

4-8: Field id looks good.

The id field is correctly documented and typed.


10-13: Field isActive looks good.

The isActive field is correctly documented and typed.


15-18: Field botUserId looks good.

The botUserId field is correctly documented and typed.


20-23: Field botAccessToken looks good.

The botAccessToken field is correctly documented and typed.


25-28: Field createdAt looks good.

The createdAt field is correctly documented and typed.


30-33: Field defaultTeamChannelId looks good.

The defaultTeamChannelId field is correctly documented and typed.


35-38: Field slackTeamId looks good.

The slackTeamId field is correctly documented and typed.


40-43: Field slackTeamName looks good.

The slackTeamName field is correctly documented and typed.


45-48: Field slackUserId looks good.

The slackUserId field is correctly documented and typed.


50-53: Field slackUserName looks good.

The slackUserName field is correctly documented and typed.


55-58: Field teamId looks good.

The teamId field is correctly documented and typed.


60-63: Field updatedAt looks good.

The updatedAt field is correctly documented and typed.


65-68: Field userId looks good.

The userId field is correctly documented and typed.


70-73: Field notifications looks good.

The notifications field is correctly documented and typed.

packages/server/graphql/public/types/TeamMemberIntegrations.ts (11)

1-2: New imports are correct and necessary.

The new imports for TeamMemberIntegrationsId and isTeamMember are appropriate and required for the newly added resolver functions.


6-12: gcal resolver function looks good.

The gcal resolver function correctly returns an object with teamId and userId.


14-14: id resolver function looks good.

The id resolver function correctly generates an ID using TeamMemberIntegrationsId.join.


16-19: atlassian resolver function looks good.

The atlassian resolver function correctly checks if the user is a team member and retrieves the Atlassian authentication data using the data loader.


21-21: jiraServer resolver function looks good.

The jiraServer resolver function correctly returns the source object.


23-26: github resolver function looks good.

The github resolver function correctly checks if the user is a team member and retrieves the GitHub authentication data using the data loader.


28-28: gitlab resolver function looks good.

The gitlab resolver function correctly returns the source object.


29-29: mattermost resolver function looks good.

The mattermost resolver function correctly returns the source object.


31-35: slack resolver function looks good.

The slack resolver function correctly checks if the user is a team member, retrieves the Slack authentication data using the data loader, and finds the relevant authentication for the team.


37-37: azureDevOps resolver function looks good.

The azureDevOps resolver function correctly returns the source object.


38-38: msTeams resolver function looks good.

The msTeams resolver function correctly returns the source object.

packages/server/graphql/public/typeDefs/AzureDevOpsWorkItem.graphql (3)

1-49: AzureDevOpsWorkItem type looks good.

The AzureDevOpsWorkItem type is well-defined with appropriate fields and descriptions.


51-69: AzureDevOpsWorkItemConnection type looks good.

The AzureDevOpsWorkItemConnection type is well-defined with appropriate fields and descriptions.


71-80: AzureDevOpsWorkItemEdge type looks good.

The AzureDevOpsWorkItemEdge type is well-defined with appropriate fields and descriptions.

packages/server/graphql/public/types/JiraServerIssue.ts (5)

1-3: New imports are correct and necessary.

The new imports for JiraServerIssueId and JiraServerRestIssue are appropriate and required for the newly added resolver functions.


14-15: __isTypeOf resolver function looks good.

The __isTypeOf resolver function correctly checks if the service is jiraServer.

Tools
Gitleaks

14-14: Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality.

(atlassian-api-token)


16-18: id resolver function looks good.

The id resolver function correctly generates an ID using JiraServerIssueId.join.


20-23: url resolver function looks good.

The url resolver function correctly generates a URL using the self field.


25-43: possibleEstimationFieldNames resolver function looks good.

The possibleEstimationFieldNames resolver function correctly filters and maps the field names based on the specified criteria.

packages/server/graphql/public/typeDefs/AtlassianIntegration.graphql (1)

1-59: AtlassianIntegration type looks good.

The AtlassianIntegration type is well-defined with appropriate fields and descriptions.

packages/server/graphql/public/typeDefs/GitLabIntegration.graphql (9)

5-8: Ensure consistent field descriptions.

The description for the auth field is clear, but ensure all field descriptions follow a consistent style.


10-13: Clarify the nullable condition.

The description for the cloudProvider field mentions that it's nullable based on environment variables. Consider specifying which environment variables affect this.


15-18: Ensure consistency in descriptions.

The description for the sharedProviders field is clear, but ensure it follows the same style as other descriptions.


21-24: Ensure consistency in descriptions.

The description for the projects field is clear, but ensure it follows the same style as other descriptions.


25-52: Ensure clear and concise descriptions for arguments.

The descriptions for the projectsIssues field arguments are clear, but ensure they are concise and consistent with other descriptions.


59-62: Ensure consistent field descriptions.

The description for the pageInfo field is clear, but ensure all field descriptions follow a consistent style.


64-67: Ensure consistent field descriptions.

The description for the edges field is clear, but ensure all field descriptions follow a consistent style.


69-72: Ensure consistent field descriptions.

The description for the error field is clear, but ensure all field descriptions follow a consistent style.


79-82: Ensure consistent field descriptions.

The description for the node field is clear, but ensure all field descriptions follow a consistent style.

packages/server/graphql/public/typeDefs/JiraServerIssue.graphql (17)

5-8: Ensure consistent field descriptions.

The description for the pageInfo field is clear, but ensure all field descriptions follow a consistent style.


10-13: Ensure consistent field descriptions.

The description for the edges field is clear, but ensure all field descriptions follow a consistent style.


15-18: Ensure consistent field descriptions.

The description for the error field is clear, but ensure all field descriptions follow a consistent style.


25-28: Ensure consistent field descriptions.

The description for the hasNextPage field is clear, but ensure all field descriptions follow a consistent style.


30-33: Ensure consistent field descriptions.

The description for the hasPreviousPage field is clear, but ensure all field descriptions follow a consistent style.


35-38: Ensure consistent field descriptions.

The description for the startCursor field is clear, but ensure all field descriptions follow a consistent style.


40-43: Ensure consistent field descriptions.

The description for the endCursor field is clear, but ensure all field descriptions follow a consistent style.


50-53: Ensure consistent field descriptions.

The description for the node field is clear, but ensure all field descriptions follow a consistent style.


61-64: Ensure consistent field descriptions.

The description for the id field is clear, but ensure all field descriptions follow a consistent style.


65-67: Ensure consistent field descriptions.

The description for the issueKey field is clear, but ensure all field descriptions follow a consistent style.


68-70: Ensure consistent field descriptions.

The description for the projectId field is clear, but ensure all field descriptions follow a consistent style.


71-74: Ensure consistent field descriptions.

The description for the teamId field is clear, but ensure all field descriptions follow a consistent style.


76-79: Ensure consistent field descriptions.

The description for the userId field is clear, but ensure all field descriptions follow a consistent style.


81-84: Ensure consistent field descriptions.

The description for the url field is clear, but ensure all field descriptions follow a consistent style.


86-89: Ensure consistent field descriptions.

The description for the summary field is clear, but ensure all field descriptions follow a consistent style.


92-95: Ensure consistent field descriptions.

The description for the descriptionHTML field is clear, but ensure all field descriptions follow a consistent style.


99-101: Ensure consistent field descriptions.

The description for the updatedAt field is clear, but ensure all field descriptions follow a consistent style.

packages/server/graphql/rootTypes.ts (2)

Line range hint 1-33: LGTM!

The import statements are well-organized and consistent.


Line range hint 35-63: LGTM!

The removal of AzureDevOpsWorkItem from the rootTypes array is consistent with the PR objectives.

packages/server/graphql/public/rootSchema.ts (8)

Line range hint 1-23: LGTM!

The import statements are well-organized and consistent.


24-31: LGTM!

The renaming of legacyParabolSchema to legacyTypeDefs improves clarity and aligns with the new schema definition approach.


37-41: LGTM!

The merging of old POJO definitions with SDL definitions in parabolTypeDefs is a good approach.


Line range hint 43-53: LGTM!

The nesting of the GitHub endpoint in typeDefsWithGitHub is well-implemented and follows best practices.


Line range hint 55-80: LGTM!

The nesting of the GitLab endpoint in typeDefsWithGitHubGitLab is well-implemented and follows best practices.


82-88: LGTM!

The approach to resolve types for mutation payloads and add resolvers in publicSchema is well-implemented.


Line range hint 90-98: LGTM!

The addition of requestors to the schema in addRequestors is a good approach to handle external service requests.


100-102: LGTM!

The approach to build rootSchema from publicSchema is well-implemented.

packages/server/graphql/public/types/AtlassianIntegration.ts (2)

1-5: LGTM!

The new imports and reordering are consistent and necessary for the new resolver logic.


86-114: LGTM!

The new resolvers for id, isActive, accessToken, projects, and jiraSearchQueries are well-implemented and follow best practices.

packages/server/graphql/public/typeDefs/Organization.graphql (3)

36-39: LGTM!

The renaming of isBillingLeader to isOrgAdmin is well-implemented and aligns with the PR objectives.


46-48: LGTM!

The addition of activeTeamCount is well-implemented and aligns with the PR objectives.


50-63: LGTM!

The addition of allTeams, viewerTeams, and publicTeams is well-implemented and aligns with the PR objectives.

packages/server/dataloader/jiraServerLoaders.ts (2)

58-59: LGTM! But verify the correct usage of the new fields.

The additions of userId and teamId to the JiraServerProject type look good.

However, ensure that these fields are correctly populated and used throughout the codebase.

Verification successful

The new fields userId and teamId are correctly used throughout the codebase.

The search results confirm that userId and teamId are being utilized in various parts of the code, such as fetchAllRepoIntegrations.ts and JiraServerIntegration.ts, indicating proper integration.

  • packages/server/graphql/queries/helpers/fetchAllRepoIntegrations.ts
  • packages/server/graphql/public/types/JiraServerIntegration.ts
  • packages/server/dataloader/jiraServerLoaders.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correct usage of the new fields `userId` and `teamId` in `JiraServerProject`.

# Test: Search for the usage of `JiraServerProject` type. Expect: Correct usage of `userId` and `teamId`.
rg --type-add 'typescript' --type typescript 'JiraServerProject'

Length of output: 122


Script:

#!/bin/bash
# Description: Verify the correct usage of the new fields `userId` and `teamId` in `JiraServerProject`.

# Test: Search for the usage of `JiraServerProject` type. Expect: Correct usage of `userId` and `teamId`.
rg 'JiraServerProject' -A 5

Length of output: 4110


128-130: LGTM! But verify the correct usage of the new properties.

The updates to the allJiraServerProjects function look good.

However, ensure that the userId and teamId properties are correctly populated and used throughout the function.

Verification successful

The userId and teamId properties are correctly populated and used in the allJiraServerProjects function.

The updates to the allJiraServerProjects function are properly integrated and used in the following files:

  • packages/server/graphql/public/types/JiraServerIntegration.ts
  • packages/server/graphql/queries/helpers/fetchAllRepoIntegrations.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correct usage of the new properties `userId` and `teamId` in `allJiraServerProjects`.

# Test: Search for the usage of `allJiraServerProjects` function. Expect: Correct usage of `userId` and `teamId`.
rg --type-add 'typescript' --type typescript 'allJiraServerProjects'

Length of output: 126


Script:

#!/bin/bash
# Description: Verify the correct usage of the new properties `userId` and `teamId` in `allJiraServerProjects`.

# Correct the rg command to add the TypeScript file type and search for the usage of `allJiraServerProjects`.
rg --type-add 'typescript:*.ts' --type typescript 'allJiraServerProjects'

Length of output: 462


Script:

#!/bin/bash
# Extract the relevant code segment from `JiraServerIntegration.ts` to verify the usage of `userId` and `teamId`.
rg --type-add 'typescript:*.ts' --type typescript -A 10 'dataLoader.get\(\'allJiraServerProjects\'\).load\(\{teamId, userId\}\)' packages/server/graphql/public/types/JiraServerIntegration.ts

# Extract the relevant code segment from `fetchAllRepoIntegrations.ts` to verify the usage of `userId` and `teamId`.
rg --type-add 'typescript:*.ts' --type typescript -A 10 'dataLoader.get\(\'allJiraServerProjects\'\).load\(\{teamId, userId\}\)' packages/server/graphql/queries/helpers/fetchAllRepoIntegrations.ts

Length of output: 93


Script:

#!/bin/bash
# Extract the relevant code segment from `JiraServerIntegration.ts` to verify the usage of `userId` and `teamId`.
rg --type-add 'typescript:*.ts' --type typescript -A 10 "dataLoader.get('allJiraServerProjects').load({teamId, userId})" packages/server/graphql/public/types/JiraServerIntegration.ts

# Extract the relevant code segment from `fetchAllRepoIntegrations.ts` to verify the usage of `userId` and `teamId`.
rg --type-add 'typescript:*.ts' --type typescript -A 10 "dataLoader.get('allJiraServerProjects').load({teamId, userId})" packages/server/graphql/queries/helpers/fetchAllRepoIntegrations.ts

Length of output: 753


Script:

#!/bin/bash
# Extract the relevant code segment from `JiraServerIntegration.ts` to verify the usage of `userId` and `teamId`.
rg --type-add 'typescript:*.ts' --type typescript -A 10 "dataLoader.get\('allJiraServerProjects'\).load\(\{teamId, userId\}\)" packages/server/graphql/public/types/JiraServerIntegration.ts

# Extract the relevant code segment from `fetchAllRepoIntegrations.ts` to verify the usage of `userId` and `teamId`.
rg --type-add 'typescript:*.ts' --type typescript -A 10 "dataLoader.get\('allJiraServerProjects'\).load\(\{teamId, userId\}\)" packages/server/graphql/queries/helpers/fetchAllRepoIntegrations.ts

Length of output: 1072

packages/server/graphql/public/types/Organization.ts (11)

3-9: Approved: Necessary imports added.

The new imports for getUserId, isTeamMember, isUserBillingLeader, isUserOrgAdmin, and getActiveTeamCountByOrgIds are necessary for the new resolver methods.

Also applies to: 12-12


48-51: Approved: Added isBillingLeader resolver method.

The isBillingLeader resolver method correctly retrieves the viewer ID and checks if the user is a billing leader for the organization.


53-56: Approved: Added isOrgAdmin resolver method.

The isOrgAdmin resolver method correctly retrieves the viewer ID and checks if the user is an organization admin.


58-60: Approved: Added activeTeamCount resolver method.

The activeTeamCount resolver method correctly retrieves the active team count for the organization.


62-79: Approved: Added allTeams resolver method.

The allTeams resolver method correctly retrieves and sorts all teams for the organization, considering the viewer's permissions and organization settings.


81-86: Approved: Added viewerTeams resolver method.

The viewerTeams resolver method correctly retrieves and sorts the teams that the viewer is a member of.


88-97: Approved: Added publicTeams resolver method.

The publicTeams resolver method correctly retrieves the public teams for the organization, considering the viewer's permissions and organization settings.


99-102: Approved: Added viewerOrganizationUser resolver method.

The viewerOrganizationUser resolver method correctly retrieves the organization user information for the viewer.


104-120: Approved: Added organizationUsers resolver method.

The organizationUsers resolver method correctly retrieves and sorts the organization users, with a TODO comment to implement pagination.


123-130: Approved: Added orgUserCount resolver method.

The orgUserCount resolver method correctly retrieves the count of active and inactive users in the organization.


132-137: Approved: Added billingLeaders resolver method.

The billingLeaders resolver method correctly retrieves the billing leaders and organization admins for the organization.

packages/server/graphql/public/types/GitLabIntegration.ts (10)

1-5: Approved: Necessary imports added.

The new imports for GitLabServerManager, GetProjectIssuesQuery, IssuableState, IssueSort, sendToSentry, and fetchGitLabProjects are necessary for the resolver methods.


7-10: Approved: Added GitLabIntegrationSource type.

The GitLabIntegrationSource type correctly defines the structure for GitLab integration source with teamId and userId fields.


12-23: Approved: Added necessary types.

The types ProjectIssuesRes, ProjectIssueEdgeNullable, ProjectIssueNode, ProjectIssueEdge, and CursorDetails correctly define the structure for project issues and cursor details.


24-27: Approved: Added auth resolver method.

The auth resolver method correctly retrieves the GitLab authentication details for the team and user.


29-34: Approved: Added cloudProvider resolver method.

The cloudProvider resolver method correctly retrieves the global GitLab provider.


36-44: Approved: Added sharedProviders resolver method.

The sharedProviders resolver method correctly retrieves the shared GitLab providers for the team and organization.


46-46: Approved: Added gitlabSearchQueries resolver method.

The gitlabSearchQueries resolver method correctly returns an empty array as a placeholder.


48-50: Approved: Added projects resolver method.

The projects resolver method correctly fetches the GitLab projects for the team and user.


52-151: Approved: Added projectsIssues resolver method.

The projectsIssues resolver method correctly fetches the issues for the specified GitLab projects, handling pagination and error cases.

Tools
Biome

[error] 146-146: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


155-155: Approved: Exported GitLabIntegration resolver.

The GitLabIntegration resolver has been correctly exported as the default export.

packages/server/graphql/public/types/JiraServerIntegration.ts (8)

1-9: Approved: Necessary imports added.

The new imports for IntegrationProviderId, IntegrationRepoId, TeamMember, JiraServerRestManager, IntegrationProviderJiraServer, getLatestIntegrationSearchQueries, getUserId, standardError, and JiraServerIntegrationResolvers are necessary for the resolver methods.


11-14: Approved: Added JiraServerIntegrationSource type.

The JiraServerIntegrationSource type correctly defines the structure for Jira Server integration source with teamId and userId fields.


15-21: Approved: Added IssueArgs type.

The IssueArgs type correctly defines the structure for issue arguments, which are necessary for the issues resolver method.


23-34: Approved: Added id resolver method.

The id resolver method correctly retrieves the Jira Server integration ID for the team and user.


36-40: Approved: Added auth resolver method.

The auth resolver method correctly retrieves the Jira Server authentication details for the team and user.


43-60: Approved: Added sharedProviders resolver method.

The sharedProviders resolver method correctly retrieves the shared Jira Server providers for the team and organization.


62-155: Approved: Added issues resolver method.

The issues resolver method correctly fetches the issues for the specified Jira Server projects, handling pagination and error cases.

Tools
Biome

[error] 150-150: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


158-160: Approved: Added projects resolver method.

The projects resolver method correctly retrieves the Jira Server projects for the team and user.
[

codegen.json (5)

46-46: Verify the intention behind showUnusedMappers: false.

Setting showUnusedMappers to false can hide warnings about unused mappers. Ensure this is intentional and doesn't hide potential issues.


48-58: Verify the correctness of the new mappers.

Ensure the paths and aliases for the new mappers (e.g., _xGitLabProject, JiraServerIntegration, GitHubIntegration, etc.) are correct and point to the intended sources.


71-72: Verify the correctness of the new mappers.

Ensure the paths and aliases for the new mappers (AtlassianIntegration, JiraSearchQuery) are correct and point to the intended sources.


88-89: Verify the correctness of the new mappers.

Ensure the paths and aliases for the new mappers (IntegrationProviderWebhook, IntegrationProviderOAuth1) are correct and point to the intended sources.


147-148: Verify the correctness of the new mappers.

Ensure the paths and aliases for the new mappers (TeamMemberIntegrationAuthWebhook, TeamMemberIntegrationAuthOAuth1) are correct and point to the intended sources.

packages/server/dataloader/azureDevOpsLoaders.ts (3)

106-107: Verify the handling of new fields in AzureDevOpsWorkItem.

Ensure the new fields teamId and userId in the AzureDevOpsWorkItem interface are correctly populated and used in the DataLoader implementations.


128-130: Verify the handling of new fields in AzureProject.

Ensure the new fields userId and teamId in the AzureProject interface are correctly populated and used in the DataLoader implementations.


Line range hint 1-292:
Verify the usage of new fields in DataLoader implementations.

Ensure the new fields teamId and userId in the AzureDevOpsWorkItem and AzureProject interfaces are correctly used in all relevant DataLoader implementations throughout the file.

packages/server/graphql/private/typeDefs/_legacy.graphql (1)

Line range hint 1-665:
Verify the impact of schema changes on existing functionality.

The file contains significant changes to the schema definitions, including the removal of several types and fields. Ensure these changes do not break existing functionality and are consistent with the overall schema design.

packages/server/graphql/public/typeDefs/_legacy.graphql (21)

Line range hint 1-15: LGTM!

The type IntegrationProviderOAuth1 is well-defined and consistent with the IntegrationProvider interface.


Line range hint 17-31: LGTM!

The interface IntegrationProvider is well-defined and provides a consistent structure for integration providers.


Line range hint 33-33: LGTM!

The scalar DateTime is correctly defined.


Line range hint 35-42: LGTM!

The enum IntegrationProviderServiceEnum is well-defined and includes relevant services.


Line range hint 44-49: LGTM!

The enum IntegrationProviderAuthStrategyEnum is well-defined and includes relevant strategies.


Line range hint 51-55: LGTM!

The enum IntegrationProviderScopeEnum is well-defined and includes relevant scopes.


Line range hint 57-57: LGTM!

The scalar URL is correctly defined.


Line range hint 59-77: LGTM!

The type IntegrationProviderOAuth2 is well-defined and consistent with the IntegrationProvider interface.


Line range hint 79-95: LGTM!

The type IntegrationProviderWebhook is well-defined and consistent with the IntegrationProvider interface.


Line range hint 97-107: LGTM!

The type AuthIdentityGoogle is well-defined and consistent with the AuthIdentity interface.


Line range hint 109-119: LGTM!

The type AuthIdentityMicrosoft is well-defined and consistent with the AuthIdentity interface.


Line range hint 121-128: LGTM!

The interface AuthIdentity is well-defined and provides a consistent structure for authentication identities.


Line range hint 130-134: LGTM!

The enum AuthIdentityTypeEnum is well-defined and includes relevant types.


Line range hint 136-144: LGTM!

The type AuthIdentityLocal is well-defined and consistent with the AuthIdentity interface.


Line range hint 146-158: LGTM!

The type CheckInPhase is well-defined and consistent with the NewMeetingPhase interface.


Line range hint 160-168: LGTM!

The interface NewMeetingPhase is well-defined and provides a consistent structure for meeting phases.


Line range hint 170-185: LGTM!

The enum NewMeetingPhaseTypeEnum is well-defined and includes relevant types.


Line range hint 187-215: LGTM!

The interface NewMeetingStage is well-defined and provides a consistent structure for meeting stages.


Line range hint 217-223: LGTM!

The type TaskConnection is well-defined and consistent with GraphQL connection patterns.


Line range hint 225-233: LGTM!

The type PageInfoDateCursor is well-defined and consistent with GraphQL pagination patterns.


Line range hint 235-239: LGTM!

The type TaskEdge is well-defined and consistent with GraphQL edge patterns.

packages/server/graphql/public/typeDefs/AzureDevOpsIntegration.graphql (13)

8-8: LGTM!

The auth field is correctly defined and described.


13-13: LGTM!

The id field is correctly defined and described.


18-18: LGTM!

The accountId field is correctly defined and described.


23-23: LGTM!

The instanceIds field is correctly defined and described.


28-28: LGTM!

The createdAt field is correctly defined and described.


33-33: LGTM!

The teamId field is correctly defined and described.


38-38: LGTM!

The updatedAt field is correctly defined and described.


43-43: LGTM!

The userId field is correctly defined and described.


48-70: LGTM!

The workItems field and its arguments are correctly defined and described.


75-75: LGTM!

The projects field is correctly defined and described.


80-80: LGTM!

The cloudProvider field is correctly defined and described.


85-85: LGTM!

The sharedProviders field is correctly defined and described.


90-90: LGTM!

The azureDevOpsSearchQueries field is correctly defined and described.

packages/server/graphql/public/types/AzureDevOpsIntegration.ts (6)

19-23: LGTM!

The auth resolver is correctly implemented.


25-25: LGTM!

The id resolver is correctly implemented.


27-50: LGTM!

The workItems resolver is correctly implemented.


53-57: LGTM!

The projects resolver is correctly implemented.


59-63: LGTM!

The cloudProvider resolver is correctly implemented.


66-74: LGTM!

The sharedProviders resolver is correctly implemented.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

@@ -123,7 +125,9 @@ export const allJiraServerProjects = (parent: RootDataLoader) => {
.map((project) => ({
...project,
service: 'jiraServer' as const,
providerId: provider.id
providerId: provider.id,
userId,
Copy link
Member Author

Choose a reason for hiding this comment

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

without teamId & userId I'm not sure how we were fetching the project avatar!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 16

Outside diff range, codebase verification and nitpick comments (32)
packages/server/graphql/types/TeamMemberIntegrations.ts (1)

1-6: Potential issues found with the removal of fields in TeamMemberIntegrations.

The following references to TeamMemberIntegrations indicate that removing all fields might break existing functionality:

  • packages/client/hooks/useIsIntegrated.ts: References fields like jiraServer and atlassian.
  • packages/client/components/TaskFooterIntegrateMenuSignup.tsx: References fields like gitlab and azureDevOps.
  • packages/server/graphql/types/TeamMember.ts: Uses TeamMemberIntegrations in a non-nullable field definition.
  • packages/server/graphql/public/types/TeamMemberIntegrations.ts: Defines resolvers for fields like gcal and atlassian.
  • packages/server/graphql/public/typeDefs/TeamMemberIntegrations.graphql: Defines fields like id.

Please ensure that the removal of these fields is intentional and consider the impact on the related code.

Analysis chain

Verify the removal of all fields in TeamMemberIntegrations.

The TeamMemberIntegrations type now has no fields defined. Ensure this change is intentional and doesn't break any existing functionality or dependencies.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the removal of all fields in `TeamMemberIntegrations` doesn't break any existing functionality.

# Test: Search for the usage of `TeamMemberIntegrations` fields. Expect: No breaking changes.
rg --type graphql -A 5 $'TeamMemberIntegrations'

Length of output: 79


Script:

#!/bin/bash
# Description: Verify that the removal of all fields in `TeamMemberIntegrations` doesn't break any existing functionality.

# Test: Search for the usage of `TeamMemberIntegrations` across the codebase. Expect: No breaking changes.
rg 'TeamMemberIntegrations' -A 5

Length of output: 10010

packages/server/graphql/public/typeDefs/MattermostIntegration.graphql (1)

1-3: Add a more detailed description.

The type description could be more detailed to provide better context for developers.

- Integration Auth and shared providers available to the team member
+ Represents the Mattermost integration, including OAuth2 authorization details and shared providers available to the team member.
packages/server/graphql/public/typeDefs/GitHubSearchQuery.graphql (1)

1-3: Add a more detailed description.

The type description could be more detailed to provide better context for developers.

- A GitHub search query including all filters selected when the query was executed
+ Represents a GitHub search query, including all filters selected when the query was executed.
packages/server/graphql/public/typeDefs/PageInfo.graphql (1)

1-3: Add a more detailed description.

The type description could be more detailed to provide better context for developers.

- Information about pagination in a connection.
+ Represents pagination information in a connection, including details about the next and previous pages and cursors for pagination.
packages/server/graphql/public/typeDefs/PageInfoDateCursor.graphql (1)

1-3: Add a period at the end of the description.

For consistency and readability, ensure that all documentation comments end with a period.

- Information about pagination in a connection
+ Information about pagination in a connection.
packages/server/graphql/public/typeDefs/GitLabSearchQuery.graphql (1)

1-3: Add a period at the end of the description.

For consistency and readability, ensure that all documentation comments end with a period.

- A GitLab search query including the search query and the project filters
+ A GitLab search query including the search query and the project filters.
packages/server/graphql/public/typeDefs/AzureDevOpsRemoteProject.graphql (1)

1-3: Add a period at the end of the description.

For consistency and readability, ensure that all documentation comments end with a period.

- A project fetched from Azure DevOps in real time
+ A project fetched from Azure DevOps in real time.
packages/server/graphql/public/typeDefs/JiraSearchQuery.graphql (1)

1-3: Add a period at the end of the description.

For consistency and readability, ensure that all documentation comments end with a period.

- A jira search query including all filters selected when the query was executed
+ A jira search query including all filters selected when the query was executed.
packages/server/graphql/public/types/AzureDevOpsWorkItem.ts (1)

12-14: Consider removing unnecessary async in issueKey.

The issueKey resolver is marked as async but does not perform any asynchronous operations. Consider removing the async keyword.

-  issueKey: async ({id}) => {
+  issueKey: ({id}) => {
packages/server/graphql/public/typeDefs/GitLabIntegration.graphql (14)

1-3: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- Gitlab integration data for a given team member
+ Gitlab integration data for a given team member.

5-7: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- The OAuth2 Authorization for this team member
+ The OAuth2 Authorization for this team member.

10-12: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- The cloud provider the team member may choose to integrate with. Nullable based on env vars
+ The cloud provider the team member may choose to integrate with. Nullable based on env vars.

15-17: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- The non-global providers shared with the team or organization
+ The non-global providers shared with the team or organization.

21-23: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- A list of projects accessible by this team member
+ A list of projects accessible by this team member.

28-30: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- the stringified cursors for pagination
+ the stringified cursors for pagination.

34-36: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- the ids of the projects selected as filters
+ the ids of the projects selected as filters.

39-41: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- the search query that the user enters to filter issues
+ the search query that the user enters to filter issues.

44-46: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- the sort string that defines the order of the returned issues
+ the sort string that defines the order of the returned issues.

49-51: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- the state of issues, e.g. opened or closed
+ the state of issues, e.g. opened or closed.

60-61: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- Information to aid in pagination
+ Information to aid in pagination.

65-66: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- A list of edges
+ A list of edges.

70-71: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- An error with the connection, if any
+ An error with the connection, if any.

80-81: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- The item at the end of the edge
+ The item at the end of the edge.
packages/server/graphql/public/typeDefs/JiraServerIssue.graphql (9)

6-7: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- Information to aid in pagination
+ Information to aid in pagination.

11-12: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- A list of edges
+ A list of edges.

16-17: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- An error with the connection, if any
+ An error with the connection, if any.

26-27: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- When paginating forwards, are there more items?
+ When paginating forwards, are there more items?.

31-32: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- When paginating backwards, are there more items?
+ When paginating backwards, are there more items?.

36-37: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- When paginating backwards, the cursor to continue
+ When paginating backwards, the cursor to continue.

41-42: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- When paginating forwards, the cursor to continue
+ When paginating forwards, the cursor to continue.

51-52: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- The item at the end of the edge
+ The item at the end of the edge.

62-63: Add a period to the end of the description.

For consistency, ensure all descriptions end with a period.

- GUID providerId:repositoryId:issueId
+ GUID providerId:repositoryId:issueId.

"""
The non-global providers shared with the team or organization
"""
sharedProviders: [IntegrationProviderOAuth1!]!
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making sharedProviders optional.

If sharedProviders can be empty, consider making this field optional to better represent the data model.

-  sharedProviders: [IntegrationProviderOAuth1!]!
+  sharedProviders: [IntegrationProviderOAuth1!]
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sharedProviders: [IntegrationProviderOAuth1!]!
sharedProviders: [IntegrationProviderOAuth1!]

"""
A list of projects accessible by this team member. empty if viewer is not the user
"""
projects: [JiraServerRemoteProject!]!
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making projects optional.

If projects can be empty, consider making this field optional to better represent the data model.

-  projects: [JiraServerRemoteProject!]!
+  projects: [JiraServerRemoteProject!]
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
projects: [JiraServerRemoteProject!]!
projects: [JiraServerRemoteProject!]

Comment on lines +4 to +8
type JiraServerIntegration {
"""
Composite key in jiraServer:providerId format
"""
id: ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Field id should be non-nullable.

The id field is a composite key and should be non-nullable to ensure data integrity.

-  id: ID
+  id: ID!
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type JiraServerIntegration {
"""
Composite key in jiraServer:providerId format
"""
id: ID
type JiraServerIntegration {
"""
Composite key in jiraServer:providerId format
"""
id: ID!

A list of projects accessible by this team member. empty if viewer is not the user
"""
projects: [JiraServerRemoteProject!]!
providerId: ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Field providerId should be non-nullable.

The providerId field is essential for identifying the provider and should be non-nullable.

-  providerId: ID
+  providerId: ID!
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
providerId: ID
providerId: ID!

"""
the list of suggested search queries, sorted by most recent. Guaranteed to be < 60 days old
"""
searchQueries: [JiraSearchQuery!]!
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making searchQueries optional.

If searchQueries can be empty, consider making this field optional to better represent the data model.

-  searchQueries: [JiraSearchQuery!]!
+  searchQueries: [JiraSearchQuery!]
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
searchQueries: [JiraSearchQuery!]!
searchQueries: [JiraSearchQuery!]

Comment on lines +8 to +14
const MattermostIntegration: MattermostIntegrationResolvers = {
auth: async ({teamId, userId}, _args, {dataLoader}) => {
const res = await dataLoader
.get('teamMemberIntegrationAuths')
.load({service: 'mattermost', teamId, userId})
return res!
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling in auth resolver.

The auth resolver fetches data using a data loader. Ensure that errors are properly handled and that res! is safe to use. Consider adding error handling logic.

-  const res = await dataLoader
+  let res;
+  try {
+    res = await dataLoader
     .get('teamMemberIntegrationAuths')
     .load({service: 'mattermost', teamId, userId});
+  } catch (error) {
+    throw new Error(`Failed to load Mattermost integration auth: ${error.message}`);
+  }
+  if (!res) {
+    throw new Error('Mattermost integration auth not found');
+  }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const MattermostIntegration: MattermostIntegrationResolvers = {
auth: async ({teamId, userId}, _args, {dataLoader}) => {
const res = await dataLoader
.get('teamMemberIntegrationAuths')
.load({service: 'mattermost', teamId, userId})
return res!
},
const MattermostIntegration: MattermostIntegrationResolvers = {
auth: async ({teamId, userId}, _args, {dataLoader}) => {
let res;
try {
res = await dataLoader
.get('teamMemberIntegrationAuths')
.load({service: 'mattermost', teamId, userId});
} catch (error) {
throw new Error(`Failed to load Mattermost integration auth: ${error.message}`);
}
if (!res) {
throw new Error('Mattermost integration auth not found');
}
return res;
},

Comment on lines +16 to +24
sharedProviders: async ({teamId}, _args, {dataLoader}) => {
const team = await dataLoader.get('teams').loadNonNull(teamId)
const {orgId} = team
const orgTeams = await dataLoader.get('teamsByOrgIds').load(orgId)
const orgTeamIds = orgTeams.map(({id}) => id)
return dataLoader
.get('sharedIntegrationProviders')
.load({service: 'mattermost', orgTeamIds, teamIds: [teamId]})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling in sharedProviders resolver.

The sharedProviders resolver fetches data using data loaders. Ensure that errors are properly handled and that the returned data is safe to use. Consider adding error handling logic.

-  const team = await dataLoader.get('teams').loadNonNull(teamId)
-  const {orgId} = team
-  const orgTeams = await dataLoader.get('teamsByOrgIds').load(orgId)
-  const orgTeamIds = orgTeams.map(({id}) => id)
-  return dataLoader
-    .get('sharedIntegrationProviders')
-    .load({service: 'mattermost', orgTeamIds, teamIds: [teamId]})
+  let team, orgTeams, orgTeamIds, sharedProviders;
+  try {
+    team = await dataLoader.get('teams').loadNonNull(teamId);
+    const {orgId} = team;
+    orgTeams = await dataLoader.get('teamsByOrgIds').load(orgId);
+    orgTeamIds = orgTeams.map(({id}) => id);
+    sharedProviders = await dataLoader
+      .get('sharedIntegrationProviders')
+      .load({service: 'mattermost', orgTeamIds, teamIds: [teamId]});
+  } catch (error) {
+    throw new Error(`Failed to load shared providers: ${error.message}`);
+  }
+  if (!sharedProviders) {
+    throw new Error('Shared providers not found');
+  }
+  return sharedProviders;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sharedProviders: async ({teamId}, _args, {dataLoader}) => {
const team = await dataLoader.get('teams').loadNonNull(teamId)
const {orgId} = team
const orgTeams = await dataLoader.get('teamsByOrgIds').load(orgId)
const orgTeamIds = orgTeams.map(({id}) => id)
return dataLoader
.get('sharedIntegrationProviders')
.load({service: 'mattermost', orgTeamIds, teamIds: [teamId]})
}
sharedProviders: async ({teamId}, _args, {dataLoader}) => {
let team, orgTeams, orgTeamIds, sharedProviders;
try {
team = await dataLoader.get('teams').loadNonNull(teamId);
const {orgId} = team;
orgTeams = await dataLoader.get('teamsByOrgIds').load(orgId);
orgTeamIds = orgTeams.map(({id}) => id);
sharedProviders = await dataLoader
.get('sharedIntegrationProviders')
.load({service: 'mattermost', orgTeamIds, teamIds: [teamId]});
} catch (error) {
throw new Error(`Failed to load shared providers: ${error.message}`);
}
if (!sharedProviders) {
throw new Error('Shared providers not found');
}
return sharedProviders;
}

Comment on lines +104 to +120
organizationUsers: async ({id: orgId}, _args, {dataLoader}) => {
const organizationUsers = await dataLoader.get('organizationUsersByOrgId').load(orgId)
organizationUsers.sort((a, b) => (a.orgId > b.orgId ? 1 : -1))
const edges = organizationUsers.map((node) => ({
cursor: node.id,
node
}))
// TODO implement pagination
const firstEdge = edges[0]
return {
edges,
pageInfo: {
endCursor: firstEdge ? edges[edges.length - 1]!.cursor : null,
hasNextPage: false,
hasPreviousPage: false
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder: Implement pagination in organizationUsers resolver.

The TODO comment indicates that pagination is missing.

Do you want me to generate the pagination code or open a GitHub issue to track this task?

Comment on lines +140 to +150
const firstEdge = projectsIssues[0]
const stringifiedEndCursor = JSON.stringify(endCursor)
return {
error: errors[0],
edges: projectsIssues,
pageInfo: {
startCursor: firstEdge && firstEdge.cursor,
endCursor: stringifiedEndCursor,
hasNextPage,
hasPreviousPage: false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use optional chaining in projectsIssues resolver.

Change to an optional chain to avoid potential errors.

-  const firstEdge = projectsIssues[0]
-  const stringifiedEndCursor = JSON.stringify(endCursor)
-  return {
-    error: errors[0],
-    edges: projectsIssues,
-    pageInfo: {
-      startCursor: firstEdge && firstEdge.cursor,
-      endCursor: firstEdge ? edges[edges.length - 1]!.cursor : null,
-      hasNextPage,
-      hasPreviousPage: false
-    }
-  }
+  const firstEdge = projectsIssues[0]
+  const stringifiedEndCursor = JSON.stringify(endCursor)
+  return {
+    error: errors[0],
+    edges: projectsIssues,
+    pageInfo: {
+      startCursor: firstEdge?.cursor,
+      endCursor: firstEdge ? edges[edges.length - 1]?.cursor : null,
+      hasNextPage,
+      hasPreviousPage: false
+    }
+  }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const firstEdge = projectsIssues[0]
const stringifiedEndCursor = JSON.stringify(endCursor)
return {
error: errors[0],
edges: projectsIssues,
pageInfo: {
startCursor: firstEdge && firstEdge.cursor,
endCursor: stringifiedEndCursor,
hasNextPage,
hasPreviousPage: false
}
const firstEdge = projectsIssues[0]
const stringifiedEndCursor = JSON.stringify(endCursor)
return {
error: errors[0],
edges: projectsIssues,
pageInfo: {
startCursor: firstEdge?.cursor,
endCursor: firstEdge ? edges[edges.length - 1]?.cursor : null,
hasNextPage,
hasPreviousPage: false
}
Tools
Biome

[error] 146-146: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Comment on lines +145 to +155
const firstEdge = edges[0]

return {
edges,
pageInfo: {
startCursor: firstEdge && firstEdge.cursor,
endCursor: firstEdge ? edges[edges.length - 1]!.cursor : null,
hasNextPage: mappedIssues.length > nodes.length,
hasPreviousPage: false
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use optional chaining in issues resolver.

Change to an optional chain to avoid potential errors.

-  const firstEdge = edges[0]
-  return {
-    edges,
-    pageInfo: {
-      startCursor: firstEdge && firstEdge.cursor,
-      endCursor: firstEdge ? edges[edges.length - 1]!.cursor : null,
-      hasNextPage: mappedIssues.length > nodes.length,
-      hasPreviousPage: false
-    }
-  }
+  const firstEdge = edges[0]
+  return {
+    edges,
+    pageInfo: {
+      startCursor: firstEdge?.cursor,
+      endCursor: firstEdge ? edges[edges.length - 1]?.cursor : null,
+      hasNextPage: mappedIssues.length > nodes.length,
+      hasPreviousPage: false
+    }
+  }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const firstEdge = edges[0]
return {
edges,
pageInfo: {
startCursor: firstEdge && firstEdge.cursor,
endCursor: firstEdge ? edges[edges.length - 1]!.cursor : null,
hasNextPage: mappedIssues.length > nodes.length,
hasPreviousPage: false
}
}
const firstEdge = edges[0]
return {
edges,
pageInfo: {
startCursor: firstEdge?.cursor,
endCursor: firstEdge ? edges[edges.length - 1]?.cursor : null,
hasNextPage: mappedIssues.length > nodes.length,
hasPreviousPage: false
}
}
Tools
Biome

[error] 150-150: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

Outside diff range, codebase verification and nitpick comments (15)
packages/server/graphql/types/AtlassianIntegration.ts (1)

1-5: Empty fields object in GraphQL type definition.

The AtlassianIntegration GraphQLObjectType now has an empty fields object. This is likely not intentional, as there are still dependencies on the removed fields in various parts of the codebase. Please re-evaluate this change to ensure that all dependent code is updated accordingly.

  • packages/server/graphql/types/AddAtlassianAuthPayload.ts
  • packages/server/graphql/types/PersistJiraSearchQueryPayload.ts
  • packages/server/graphql/public/types/AtlassianIntegration.ts
  • packages/client/hooks/useIsIntegrated.ts
  • packages/client/mutations/RemoveAtlassianAuthMutation.ts
  • packages/client/modules/teamDashboard/components/ProviderRow/AtlassianProviderRow.tsx
  • packages/client/mutations/AddAtlassianAuthMutation.ts
  • packages/client/modules/demo/initDB.ts
Analysis chain

Empty fields object in GraphQL type definition.

The AtlassianIntegration GraphQLObjectType now has an empty fields object. This might indicate a temporary state or a deprecation. Ensure that this change is intentional and that all dependent code is updated accordingly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that no code depends on the removed fields of AtlassianIntegration.

# Test: Search for fields of AtlassianIntegration in the codebase. Expect: No occurrences of the removed fields.
rg --type js --type ts 'AtlassianIntegration.*\.(id|isActive|accessToken|accountId|cloudIds|createdAt|teamId|updatedAt|userId|projects|jiraSearchQueries)'

Length of output: 156


Script:

#!/bin/bash
# Description: Verify that the empty fields object in AtlassianIntegration is intentional and that no code depends on the removed fields.

# Search for the definition of AtlassianIntegration in the codebase.
rg --type js --type ts 'const AtlassianIntegration = new GraphQLObjectType'

# Search for all references to AtlassianIntegration in the codebase.
rg --type js --type ts 'AtlassianIntegration'

Length of output: 2593


Script:

#!/bin/bash
# Description: Display lines and surrounding context for each reference to AtlassianIntegration to verify if they depend on the removed fields.

# Display lines and surrounding context for each reference to AtlassianIntegration.
rg --type js --type ts 'AtlassianIntegration' -A 5 -B 5

Length of output: 13911

packages/server/graphql/types/TeamMemberIntegrations.ts (1)

6-6: Issues found with the removal of fields from TeamMemberIntegrations.

The TeamMemberIntegrations type has been stripped of all fields, but the fields are still referenced in various parts of the codebase. This will likely break the functionality. The following locations need to be updated to handle the removal of fields:

  • packages/server/graphql/types/TeamMember.ts: The TeamMemberIntegrations type is used in the TeamMember type definition.
  • packages/server/graphql/public/types/TeamMemberIntegrations.ts: The TeamMemberIntegrationsResolvers expects certain fields to be present.
  • packages/client/components/TaskFooterIntegrateMenuSignup.tsx: GraphQL fragments reference fields from TeamMemberIntegrations.
  • packages/client/components/TaskFooterIntegrateMenu.tsx: GraphQL fragments reference fields from TeamMemberIntegrations.
  • packages/client/hooks/useIsIntegrated.ts: GraphQL fragments reference fields from TeamMemberIntegrations.

Please ensure that the fields are either no longer needed or have been migrated elsewhere, and update the corresponding usages accordingly.

Analysis chain

Verify the impact of removing all fields from TeamMemberIntegrations.

The TeamMemberIntegrations type has been stripped of all fields, leaving it empty. Ensure that this change does not break any existing functionality and that the fields are correctly migrated or handled elsewhere.


Verify the impact of removing all fields from TeamMemberIntegrations.

The TeamMemberIntegrations type has been stripped of all fields, leaving it empty. Ensure that this change does not break any existing functionality and that the fields are correctly migrated or handled elsewhere.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `TeamMemberIntegrations` type across the codebase to ensure no functionality is broken.

# Test: Search for the usage of `TeamMemberIntegrations` type. Expect: No breaking changes.
rg --type js --type ts 'TeamMemberIntegrations'

Length of output: 2572


Script:

#!/bin/bash
# Description: Verify the definitions and usages of `TeamMemberIntegrations` in the identified files to ensure no functionality is broken.

# Check the definition of `TeamMemberIntegrations` in the main file
rg --type js --type ts 'const TeamMemberIntegrations' -A 10 packages/server/graphql/types/TeamMemberIntegrations.ts

# Check the usage in the TeamMember file
rg --type js --type ts 'TeamMemberIntegrations' -A 10 packages/server/graphql/types/TeamMember.ts

# Check the usage in the public types file
rg --type js --type ts 'TeamMemberIntegrations' -A 10 packages/server/graphql/public/types/TeamMemberIntegrations.ts

# Check the usage in the client components
rg --type js --type ts 'TeamMemberIntegrations' -A 10 packages/client/components/TaskFooterIntegrateMenuSignup.tsx
rg --type js --type ts 'TeamMemberIntegrations' -A 10 packages/client/components/TaskFooterIntegrateMenu.tsx
rg --type js --type ts 'TeamMemberIntegrations' -A 10 packages/client/hooks/useIsIntegrated.ts

Length of output: 4642

packages/server/graphql/public/typeDefs/GitHubIntegration.graphql (5)

1-1: Add a description for the GitHubIntegration type.

The GitHubIntegration type lacks a description. Adding a description will improve the schema documentation.

"""
Represents a GitHub integration for a team member.
"""
type GitHubIntegration {

20-20: Clarify the isActive field description.

The description for the isActive field can be more descriptive. Clarify what it means for the integration to be active.

"""
Indicates whether the integration is active (i.e., an access token exists).
"""
isActive: Boolean!

25-25: Clarify the githubSearchQueries field description.

The description for the githubSearchQueries field can be more descriptive. Clarify what the search queries are used for.

"""
The list of suggested search queries for GitHub, sorted by most recent. Guaranteed to be less than 60 days old.
"""
githubSearchQueries: [GitHubSearchQuery!]!

35-35: Clarify the scope field description.

The description for the scope field can be more descriptive. Clarify what the scopes are used for.

"""
The comma-separated list of scopes requested from GitHub.
"""
scope: String!

45-45: Clarify the updatedAt field description.

The description for the updatedAt field can be more descriptive. Clarify what the timestamp represents.

"""
The timestamp when the token was last updated.
"""
updatedAt: DateTime!
packages/server/graphql/public/typeDefs/TeamMemberIntegrations.graphql (1)

Line range hint 1-1:
Add a description for the TeamMemberIntegrations type.

The TeamMemberIntegrations type lacks a description. Adding a description will improve the schema documentation.

"""
Represents all the available integrations for a team member.
"""
type TeamMemberIntegrations {
packages/server/graphql/public/typeDefs/GitLabIntegration.graphql (3)

1-3: Add a period to the description.

The description for the GitLabIntegration type is missing a period at the end.

- Gitlab integration data for a given team member
+ Gitlab integration data for a given team member.

55-57: Add a period to the description.

The description for the GitLabIntegrationConnection type is missing a period at the end.

- A connection to a list of items.
+ A connection to a list of items.

75-77: Add a period to the description.

The description for the GitLabIntegrationEdge type is missing a period at the end.

- An edge in a connection.
+ An edge in a connection.
packages/server/graphql/public/typeDefs/JiraServerIssue.graphql (4)

1-3: Add a period to the description.

The description for the JiraServerIssueConnection type is missing a period at the end.

- A connection to a list of items.
+ A connection to a list of items.

21-23: Add a period to the description.

The description for the PageInfo type is missing a period at the end.

- Information about pagination in a connection.
+ Information about pagination in a connection.

46-48: Add a period to the description.

The description for the JiraServerIssueEdge type is missing a period at the end.

- An edge in a connection.
+ An edge in a connection.

57-59: Add a period to the description.

The description for the JiraServerIssue type is missing a period at the end.

- The Jira Issue that comes direct from Jira Server
+ The Jira Issue that comes direct from Jira Server.

@@ -0,0 +1,8 @@
import {JiraSearchQueryResolvers} from '../resolverTypes'

const JiraSearchQuery: JiraSearchQueryResolvers = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential security issue: Detected an Atlassian API token.

Ensure that no sensitive information, such as API tokens, is hardcoded in the codebase.

-const JiraSearchQuery: JiraSearchQueryResolvers = {
+const JiraSearchQuery: JiraSearchQueryResolvers = {
+  // Ensure no sensitive information is hardcoded
}

Committable suggestion was skipped due to low confidence.

Tools
Gitleaks

3-3: Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality.

(atlassian-api-token)

Comment on lines +12 to +14
issueKey: async ({id}) => {
return 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 removing the async keyword if not needed.

The issueKey resolver is marked as async but does not perform any asynchronous operations. Consider removing the async keyword to avoid unnecessary overhead.

-  issueKey: async ({id}) => {
+  issueKey: ({id}) => {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
issueKey: async ({id}) => {
return id
},
issueKey: ({id}) => {
return id
},

The item at the end of the edge
"""
node: TaskIntegration!
cursor: String
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 description for the cursor field.

The cursor field is missing a description. Consider adding a brief description for consistency.

+  """
+  A cursor for pagination.
+  """
  cursor: String
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cursor: String
"""
A cursor for pagination.
"""
cursor: String

The item at the end of the edge
"""
node: JiraServerIssue!
cursor: String
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 description for the cursor field.

The cursor field is missing a description. Consider adding a brief description for consistency.

+  """
+  A cursor for pagination.
+  """
  cursor: String
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cursor: String
"""
A cursor for pagination.
"""
cursor: String

The plaintext summary of the jira issue
"""
summary: String!
description: String!
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 description for the description field.

The description field is missing a description. Consider adding a brief description for consistency.

+  """
+  The plaintext description of the jira issue.
+  """
  description: String!
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
description: String!
"""
The plaintext description of the jira issue.
"""
description: String!

The description converted into raw HTML
"""
descriptionHTML: String!
possibleEstimationFieldNames: [String!]!
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 description for the possibleEstimationFieldNames field.

The possibleEstimationFieldNames field is missing a description. Consider adding a brief description for consistency.

+  """
+  A list of possible estimation field names.
+  """
  possibleEstimationFieldNames: [String!]!
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
possibleEstimationFieldNames: [String!]!
"""
A list of possible estimation field names.
"""
possibleEstimationFieldNames: [String!]!

"""
The access token to github. good forever
"""
accessToken: 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 a more specific scalar type for accessToken.

The accessToken field is currently of type ID. Consider using a more specific scalar type, such as String, if the value is not an identifier.

accessToken: String

"""
*The GitHub login used for queries
"""
login: 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 a more specific scalar type for login.

The login field is currently of type ID. Consider using a more specific scalar type, such as String, if the value is not an identifier.

login: String!

"""
*The team that the token is linked to
"""
teamId: 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 a more specific scalar type for teamId.

The teamId field is currently of type ID. Consider using a more specific scalar type, such as String, if the value is not an identifier.

teamId: String!

"""
The user that the access token is attached to
"""
userId: 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 a more specific scalar type for userId.

The userId field is currently of type ID. Consider using a more specific scalar type, such as String, if the value is not an identifier.

userId: String!

@mattkrick mattkrick merged commit 6d01097 into master Jul 18, 2024
9 checks passed
@mattkrick mattkrick deleted the chore/gql-types-circular-ref branch July 18, 2024 21:51
@github-actions github-actions bot mentioned this pull request Jul 19, 2024
24 tasks
Dschoordsch added a commit that referenced this pull request Jul 23, 2024
There were some type resolver issues caused by #10000 and converting
more types to SDL was the easiest way to fix the issues caused by not
being able to resolve some interface types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant