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

[WEB-2359] chore: resolved the bugs reported in sentry #5447

Merged
merged 3 commits into from
Aug 30, 2024

Conversation

NarayanBavisetti
Copy link
Collaborator

@NarayanBavisetti NarayanBavisetti commented Aug 28, 2024

chore:

  • added error handling for missing webhooks.
  • added error handling for cases where a page does not exist in the page version and page transaction tasks.
  • included the module name when deleting a module through an external API.
  • handled errors when a cycle does not exist.
  • addressed cases where the inbox is not available for a project.
  • fixed an issue where labels in issue exports were coming as None, causing the download to fail.

Issue Link: WEB-2359

Summary by CodeRabbit

  • New Features

    • Enhanced API functionality by providing contextual information during module deletions.
    • Improved data retrieval processes by filtering out archived records in cycles.
    • Introduced early exit conditions in processing functions to prevent runtime errors.
  • Bug Fixes

    • Implemented error handling for missing records in cycle retrieval, returning appropriate 404 responses.
    • Added robust exception handling in various background tasks to prevent crashes and improve stability.
  • Chores

    • Streamlined import statements for better code readability.

Copy link
Contributor

coderabbitai bot commented Aug 28, 2024

Walkthrough

The changes across multiple files focus on enhancing error handling, improving data retrieval methods, and refining parameter management in API views. Key modifications include the introduction of try-except blocks for better robustness, filtering conditions to exclude archived records, and adjustments in how parameters are processed, particularly in delete and retrieval methods. Additionally, a new function was added to handle HTML content safely.

Changes

Files Change Summary
apiserver/plane/api/views/module.py Updated current_instance in delete method to include JSON-encoded module_name.
apiserver/plane/app/views/cycle/base.py Added filtering for non-archived records in retrieve method and improved 404 error handling.
apiserver/plane/app/views/inbox/base.py Changed list and retrieve methods to use get() for direct retrieval of Inbox instances.
apiserver/plane/bgtasks/export_task.py Enhanced handling of labels__name to prevent None values in generate_table_row and generate_json_row.
apiserver/plane/bgtasks/page_transaction_task.py Added try-except block for error handling in page_transaction function.
apiserver/plane/bgtasks/page_version_task.py Introduced error handling in page_version function with try-except for Page retrieval.
apiserver/plane/bgtasks/webhook_task.py Added try-except block for webhook.DoesNotExist in webhook_task function.
apiserver/plane/bgtasks/email_notification_task.py Introduced early exit for None content in process_html_content function.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Database
    participant Logger

    Client->>API: Request to delete module
    API->>Database: Retrieve module details
    Database-->>API: Return module details
    API->>Logger: Log module deletion
    API->>Database: Delete module
    Database-->>API: Confirm deletion
    API-->>Client: Respond with success
Loading

🐰 In the meadow where bunnies play,
Changes hop in a bright array.
With errors caught, and data clear,
The code now sings, oh so dear!
Through filters and logs, we dance with glee,
A robust future for you and me! 🌼


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 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
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: 5

Outside diff range, codebase verification and nitpick comments (1)
apiserver/plane/bgtasks/webhook_task.py (1)

155-156: Approve addition of exception handling for missing webhooks.

The new exception handling for webhook.DoesNotExist is a necessary improvement. It ensures that the task exits gracefully when the specified webhook is not found, which enhances the robustness of the webhook handling mechanism.

The code changes are approved.

Consider adding a log statement before returning to provide clarity on why the task was terminated:

+ logging.info(f"Webhook with ID {webhook} does not exist.")
  return
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0cce39e and adc3080.

Files selected for processing (7)
  • apiserver/plane/api/views/module.py (1 hunks)
  • apiserver/plane/app/views/cycle/base.py (2 hunks)
  • apiserver/plane/app/views/inbox/base.py (3 hunks)
  • apiserver/plane/bgtasks/export_task.py (2 hunks)
  • apiserver/plane/bgtasks/page_transaction_task.py (2 hunks)
  • apiserver/plane/bgtasks/page_version_task.py (2 hunks)
  • apiserver/plane/bgtasks/webhook_task.py (1 hunks)
Additional comments not posted (4)
apiserver/plane/bgtasks/page_version_task.py (1)

9-9: Good addition of the exception logger.

Importing log_exception from plane.utils.exception_logger is a good practice as it centralizes error logging, making the application easier to maintain and debug.

apiserver/plane/bgtasks/page_transaction_task.py (1)

13-13: Good addition of the exception logger.

Importing log_exception from plane.utils.exception_logger is a good practice as it centralizes error logging, making the application easier to maintain and debug.

apiserver/plane/api/views/module.py (1)

301-305: Approve the inclusion of module_name in current_instance.

The update to include module_name in the current_instance parameter is a positive change, providing more context for actions related to module deletions. This can enhance logging and auditing capabilities.

The code changes are approved.

Ensure that this change does not adversely affect any downstream processes that rely on the current_instance data. Consider reviewing how this data is used in logging, auditing, or other integrations to ensure compatibility.

apiserver/plane/app/views/cycle/base.py (1)

Line range hint 381-426: Enhanced robustness with improved error handling.

The modifications to the retrieve method correctly implement the filtering for non-archived records and handle cases where no data is found, which aligns with the PR objectives to improve error handling. The addition of a clear error message when the cycle is not found enhances user feedback and system robustness.

The changes are well-implemented and improve the functionality as intended.

apiserver/plane/bgtasks/page_version_task.py Show resolved Hide resolved
apiserver/plane/bgtasks/export_task.py Show resolved Hide resolved
apiserver/plane/app/views/inbox/base.py Show resolved Hide resolved
apiserver/plane/app/views/inbox/base.py Show resolved Hide resolved
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between adc3080 and 19410ef.

Files selected for processing (1)
  • apiserver/plane/bgtasks/email_notification_task.py (1 hunks)

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 19410ef and 084e8bf.

Files selected for processing (1)
  • apiserver/plane/bgtasks/webhook_task.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apiserver/plane/bgtasks/webhook_task.py

@NarayanBavisetti NarayanBavisetti changed the title chore: resolved the bugs reported in sentry [WEB-2359] chore: resolved the bugs reported in sentry Aug 30, 2024
@sriramveeraghanta sriramveeraghanta merged commit 1d2e7d3 into preview Aug 30, 2024
13 of 14 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore/sentry-reported-bugs branch August 30, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants