Summary
Add support for fetching and displaying general pull request review comments (i.e., the review summary body) from the GitHub GraphQL API. This will supplement the existing functionality that only fetches inline code comments (reviewThreads).
Description
Currently, the application only fetches reviewThreads via the GitHub GraphQL API. These correspond to inline comments associated with specific lines of code in a pull request's diff. This implementation misses other crucial forms of feedback provided during a code review.
Specifically, it omits the main review comment body (pullRequest.reviews.body), which is the general message a reviewer writes when submitting their review (e.g., "LGTM! Some questions though..."). It also omits general conversation comments on the PR.
This feature proposes extending our data fetching capabilities to include the review body comments to provide users with a more complete context of the discussion happening on a pull request.
The different types of comments can be summarized as follows:
| Type |
GraphQL |
Description |
reviewThreads |
Currently Fetched |
Inline comments on specific lines of code |
reviews.body |
To be Added |
The reviewer's general message upon submission |
comments |
Out of Scope |
General comments in the PR conversation thread |
Objectives
- Fetch general review summary comments (
pullRequest.reviews.body) from the GitHub GraphQL API.
- Extend the application's data models to represent these context-free comments.
- Integrate and display these comments within the application's UI to provide a comprehensive view of all review feedback.
- Differentiate the user actions available for general comments versus inline, code-specific comments.
Proposed Solution
The implementation will involve extending the GitHub GraphQL query to include the reviews field on the pullRequest object.
- Extend GraphQL Query: Modify the query to fetch
reviews { nodes { body author state } }.
- Update Data Models: Introduce or adapt data structures to handle these new comments. A key consideration is that these comments are generic and do not have
path or diff_hunk attributes, unlike reviewThreads.
- Adapt Application Logic: The backend and frontend logic must be updated to process and display these comments. Since they lack specific code context, features like "AI Review & Fix" would not apply in the same way. The primary interaction might be limited to "Reply".
Implementation Phases
Phase 1: Data Fetching & Modeling
- Modify the GraphQL query to fetch
pullRequest.reviews.
- Create or extend data models to represent review body comments, ensuring they can be handled without code-specific context (
path, line, etc.).
Phase 2: Backend Integration
- Implement the backend logic to process and store the fetched review body comments.
- Update the relevant API endpoints to serve these new comments to the client.
Phase 3: Frontend & User Interaction
- Update the UI to render general review comments, visually distinguishing them from inline code comments if necessary.
- Implement a distinct set of actions for these general comments (e.g., "Reply") since code-contextual actions are not applicable.
Tasks
Acceptance Criteria
- General review comments (
reviews.body) are successfully fetched from GitHub and displayed within the application.
- Existing functionality for fetching and displaying inline comments (
reviewThreads) remains unaffected.
- The system correctly handles and displays both types of comments in a cohesive view.
- No regressions are introduced in the code review workflow.
Testing Strategy
Unit Tests:
- Test the updated GraphQL query construction and response parsing.
- Test the new data models and their ability to handle comments with and without code context.
Integration Tests:
- Create an integration test that uses a mock GitHub API response containing both
reviewThreads and reviews to verify the end-to-end processing and data mapping.
Manual Testing:
- Select a pull request that contains a mix of inline comments and general review submission comments.
- Verify that all comments are fetched and displayed correctly in the UI.
- Confirm that actions available for general comments are appropriate (e.g., "Reply") and that code-specific actions are not shown.
Considerations
- Context-Free Comments: The core challenge is handling comments that are not tied to a specific file or line of code. The data model and UI must be robust enough to manage this distinction.
- User Actions: Features that rely on code context, such as "AI Review & Fix," will not be applicable to general review comments. The UI must clearly reflect this limitation, offering a simplified set of interactions.
- Scope: This feature will focus exclusively on fetching
pullRequest.reviews.body. Support for general PR conversation comments (comments) is considered out of scope for this task and may be addressed in a future feature.
Summary
Add support for fetching and displaying general pull request review comments (i.e., the review summary body) from the GitHub GraphQL API. This will supplement the existing functionality that only fetches inline code comments (
reviewThreads).Description
Currently, the application only fetches
reviewThreadsvia the GitHub GraphQL API. These correspond to inline comments associated with specific lines of code in a pull request's diff. This implementation misses other crucial forms of feedback provided during a code review.Specifically, it omits the main review comment body (
pullRequest.reviews.body), which is the general message a reviewer writes when submitting their review (e.g., "LGTM! Some questions though..."). It also omits general conversation comments on the PR.This feature proposes extending our data fetching capabilities to include the review body comments to provide users with a more complete context of the discussion happening on a pull request.
The different types of comments can be summarized as follows:
reviewThreadsreviews.bodycommentsObjectives
pullRequest.reviews.body) from the GitHub GraphQL API.Proposed Solution
The implementation will involve extending the GitHub GraphQL query to include the
reviewsfield on thepullRequestobject.reviews { nodes { body author state } }.pathordiff_hunkattributes, unlikereviewThreads.Implementation Phases
Phase 1: Data Fetching & Modeling
pullRequest.reviews.path,line, etc.).Phase 2: Backend Integration
Phase 3: Frontend & User Interaction
Tasks
pullRequest.reviews.Acceptance Criteria
reviews.body) are successfully fetched from GitHub and displayed within the application.reviewThreads) remains unaffected.Testing Strategy
Unit Tests:
Integration Tests:
reviewThreadsandreviewsto verify the end-to-end processing and data mapping.Manual Testing:
Considerations
pullRequest.reviews.body. Support for general PR conversation comments (comments) is considered out of scope for this task and may be addressed in a future feature.