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

🏷️ Manually update types for pr:comment:edited #7

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

NatoBoram
Copy link
Collaborator

@NatoBoram NatoBoram commented Sep 27, 2024

Atlassian's docs is terrible. I had to update these types manually from a dummy webhook.

Summary by CodeRabbit

  • New Features

    • Enhanced pull request comment structure with new properties for improved tracking and management.
    • Added links to actors and projects for better navigation and context.
    • Introduced optional comment parent ID for flexibility in comment referencing.
  • Bug Fixes

    • Updated interfaces to align with defined schemas, ensuring consistency and reliability.

@NatoBoram NatoBoram requested a review from a team as a code owner September 27, 2024 19:04
@NatoBoram NatoBoram self-assigned this Sep 27, 2024
Copy link

coderabbitai bot commented Sep 27, 2024

📝 Walkthrough

Walkthrough

The changes involve significant updates to TypeScript interfaces related to pull request comments and associated entities. Key modifications include the addition of new properties and interfaces, such as ActorLinks, and enhancements to existing interfaces like Comment, PullRequest, and Repository. These modifications aim to improve the structure and typing of the interfaces, ensuring better alignment with defined schemas.

Changes

File Path Change Summary
src/server/webhooks/events/pr/comment_edited.ts - Updated Actor to include links: ActorLinks.
- Added ActorLinks interface with self: Self[].
- Modified Author to derive role and status from SchemaPullRequestParticipant.
- Enhanced Comment with new properties: severity, state, threadResolved, threadResolvedDate, threadResolver; removed tasks.
- Updated PRCommentEdited to make commentParentId optional.
- Updated Project to include links: ActorLinks and derive type from SchemaProject.
- Enhanced PullRequest with description and links: ActorLinks.
- Updated Ref to include type from SchemaRestMinimalRef.
- Expanded Repository with new properties: archived, hierarchyId, links: RepositoryLinks, and updated state to derive from SchemaRepository.
- Updated RepositoryLinks with clone: Clone[] and self: Self[].
- Added Self interface with href: string.

Possibly related PRs

  • ✨ Add type guards for events #6: The changes in this PR involve the addition of type guards for events, which may relate to the modifications in the interfaces for pull request comments and associated entities in the main PR, particularly in how events are handled and typed.

Suggested labels

enhancement, javascript, documentation


🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

@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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4cdda29 and 1183e87.

📒 Files selected for processing (1)
  • src/server/webhooks/events/pr/comment_edited.ts (5 hunks)
🔇 Additional comments (11)
src/server/webhooks/events/pr/comment_edited.ts (11)

14-18: Update 'Actor' interface with 'links' and 'type' properties

Adding the links property of type ActorLinks and updating type to SchemaApplicationUser["type"] in the Actor interface improves type accuracy and aligns it with the schema definitions.


20-21: Definition of 'ActorLinks' interface

The ActorLinks interface is correctly defined with a self property containing an array of Self objects, appropriately representing actor links.


26-27: Enhancement of 'Author' interface with 'role' and 'status' properties

Including role and status properties, derived from SchemaPullRequestParticipant, enhances the Author interface by providing more detailed participant information.


31-34: Definition of 'Clone' interface

The Clone interface is properly defined with href and name properties, representing clone URLs effectively.


71-74: Update 'Project' interface with 'links' and 'type' properties

Adding links of type ActorLinks and updating type to SchemaProject["type"] in the Project interface enhances consistency with schema definitions.


106-106: Addition of 'type' property to 'Ref' interface

The inclusion of type, derived from SchemaRestMinimalRef["type"], in the Ref interface improves type specificity.


110-120: Update 'Repository' interface with new properties

Adding properties such as archived, hierarchyId, links (of type RepositoryLinks), and updating state to SchemaRepository["state"] enhances the Repository interface. Ensure that these additions reflect actual webhook data and that the application handles these properties appropriately.

To validate these properties, consider examining sample webhook payloads or writing tests.


124-127: Definition of 'RepositoryLinks' interface

The RepositoryLinks interface is accurately defined with clone and self properties, containing arrays of Clone and Self objects, respectively.


129-131: Definition of 'Self' interface

The Self interface is properly defined with an href property, effectively representing a link reference.


85-89: Enhancement of 'PullRequest' interface with 'description' and 'links'

Including description and links properties in the PullRequest interface provides more comprehensive information about pull requests. Verify that these properties are correctly handled in the application logic.

You can use the following script to check for these properties in webhook payloads:

#!/bin/bash
# Verify 'PullRequest' interface properties in webhook payloads

# Search for 'pullRequest' objects and check for 'description' and 'links'
rg --type json '"pullRequest".*' -A 20 | rg '"description"| "links"'

42-47: Addition of new properties to 'Comment' interface

Introducing properties such as severity, state, threadResolved, threadResolvedDate, and threadResolver enriches the Comment interface. Ensure that these properties are accurately populated from the webhook payloads and that any consumers of this interface handle them correctly.

To confirm these properties are present in the webhook data, you can run:

@NatoBoram NatoBoram merged commit 3159979 into main Sep 27, 2024
2 checks passed
@NatoBoram NatoBoram deleted the feature/PRCommentEdited branch September 27, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant