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

Tests and bugfix #102

Merged
merged 4 commits into from
May 24, 2024
Merged

Tests and bugfix #102

merged 4 commits into from
May 24, 2024

Conversation

akorchyn
Copy link
Collaborator

@akorchyn akorchyn commented May 24, 2024

Summary by CodeRabbit

  • New Features

    • Introduced test functions for handling GitHub-related operations, scoring, merging, excluding, and finalizing pull requests.
    • Added new methods for interacting with GitHub comments.
  • Bug Fixes

    • Improved logic for updating streak data.
  • Refactor

    • Restructured event handling logic for better efficiency and readability.
    • Removed redundant parameters and simplified function signatures.
  • Enhancements

    • Added new field best to StreakUserData for enhanced tracking of user streaks.
    • Defined constants for score timeout durations.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@NEAR-DevHub NEAR-DevHub deleted a comment from coderabbitai bot May 24, 2024
@race-of-sloths
Copy link

race-of-sloths commented May 24, 2024

🏆 Race of Sloths Status Update 🏆

Hey there! 🎉 Your PR has been executed! Here are the final results. Thanks for being a part of the Race of Sloths! 🙌

  • Final Score: Sorry, your PR wasn't scored. As a result, it's been included with a score of 0. 📉

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@race-of-sloths
Copy link

Hello, Maintainer! 👋 @akorchyn has submitted another valuable pull request in the Race of Sloths. We appreciate their continued efforts to enhance the project. Your review will help further their contribution's impact.

Learn more about the race and how your feedback drives our community forward.

Here’s what you can do next: Use @race-of-sloths reject to remove this PR from the race, @race-of-sloths score [1/2/3/5/8/13] to assign points, or @race-of-sloths pause to silence notifications temporarily. For a complete guide on how the Race of Sloths works and our scoring system, click here: link.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths exclude

@race-of-sloths
Copy link

😔 It looks like this pull request has been excluded from the Race of Sloths. We understand it’s disappointing, but every contribution matters, and your participation is highly appreciated.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@race-of-sloths
Copy link

Greetings, Maintainer! 🛠️ Here’s another contribution by @akorchyn in the Race of Sloths. Their consistent participation is what keeps our project thriving. Your expert review is crucial for their progress.

Click here to dive deeper into how your support impacts our collaborative success.

Use @race-of-sloths reject to exclude this PR from the race, @race-of-sloths score [1/2/3/5/8/13] to award points, or @race-of-sloths pause to stop my notifications for your repository. For more on how the race runs and our scoring nuances, check out this link.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@race-of-sloths
Copy link

Greetings, Maintainer! 🛠️ Here’s another contribution by @akorchyn in the Race of Sloths. Their consistent participation is what keeps our project thriving. Your expert review is crucial for their progress.

Click here to dive deeper into how your support impacts our collaborative success.

Here’s what you can do next: Use @race-of-sloths reject to remove this PR from the race, @race-of-sloths score [1/2/3/5/8/13] to assign points, or @race-of-sloths pause to silence notifications temporarily. For a complete guide on how the Race of Sloths works and our scoring system, click here: link.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths exclude

@race-of-sloths
Copy link

🙁 This pull request has been excluded by the maintainer of the project. We’re truly sorry to see your work not make it this time.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@race-of-sloths
Copy link

Hello, Maintainer! 👋 @akorchyn has submitted another valuable pull request in the Race of Sloths. We appreciate their continued efforts to enhance the project. Your review will help further their contribution's impact.

Learn more about the race and how your feedback drives our community forward.

Here’s what you can do next: Use @race-of-sloths reject to remove this PR from the race, @race-of-sloths score [1/2/3/5/8/13] to assign points, or @race-of-sloths pause to silence notifications temporarily. For a complete guide on how the Race of Sloths works and our scoring system, click here: link.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths exclude

@race-of-sloths
Copy link

🙁 We're sorry to see this pull request excluded from the Race of Sloths. While it’s sad to see your effort sidelined, we value every contribution and look forward to your future submissions.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@race-of-sloths
Copy link

Greetings, Maintainer! 🛠️ Here’s another contribution by @akorchyn in the Race of Sloths. Their consistent participation is what keeps our project thriving. Your expert review is crucial for their progress.

Click here to dive deeper into how your support impacts our collaborative success.

Use @race-of-sloths reject to exclude this PR from the race, @race-of-sloths score [1/2/3/5/8/13] to award points, or @race-of-sloths pause to stop my notifications for your repository. For more on how the race runs and our scoring nuances, check out this link.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths exclude

@race-of-sloths
Copy link

😔 It looks like this pull request has been excluded from the Race of Sloths. We understand it’s disappointing, but every contribution matters, and your participation is highly appreciated.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@race-of-sloths
Copy link

Greetings, Maintainer! 🛠️ Here’s another contribution by @akorchyn in the Race of Sloths. Their consistent participation is what keeps our project thriving. Your expert review is crucial for their progress.

Click here to dive deeper into how your support impacts our collaborative success.

Use @race-of-sloths reject to exclude this PR from the race, @race-of-sloths score [1/2/3/5/8/13] to award points, or @race-of-sloths pause to stop my notifications for your repository. For more on how the race runs and our scoring nuances, check out this link.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@NEAR-DevHub NEAR-DevHub deleted a comment from coderabbitai bot May 24, 2024
@race-of-sloths
Copy link

Greetings, Maintainer! 🛠️ Here’s another contribution by @akorchyn in the Race of Sloths. Their consistent participation is what keeps our project thriving. Your expert review is crucial for their progress.

Click here to dive deeper into how your support impacts our collaborative success.

Here’s what you can do next: Use @race-of-sloths reject to remove this PR from the race, @race-of-sloths score [1/2/3/5/8/13] to assign points, or @race-of-sloths pause to silence notifications temporarily. For a complete guide on how the Race of Sloths works and our scoring system, click here: link.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths exclude

@race-of-sloths
Copy link

🙁 We're sorry to see this pull request excluded from the Race of Sloths. While it’s sad to see your effort sidelined, we value every contribution and look forward to your future submissions.

@akorchyn
Copy link
Collaborator Author

@race-of-sloths include

@race-of-sloths
Copy link

Greetings, Maintainer! 🛠️ Here’s another contribution by @akorchyn in the Race of Sloths. Their consistent participation is what keeps our project thriving. Your expert review is crucial for their progress.

Click here to dive deeper into how your support impacts our collaborative success.

Use @race-of-sloths reject to exclude this PR from the race, @race-of-sloths score [1/2/3/5/8/13] to award points, or @race-of-sloths pause to stop my notifications for your repository. For more on how the race runs and our scoring nuances, check out this link.

@akorchyn
Copy link
Collaborator Author

@coderabbitai review

Copy link

coderabbitai bot commented May 24, 2024

Actions Performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

coderabbitai bot commented May 24, 2024

Walkthrough

The recent updates streamline PR management and event handling within the contract and server components. The changes include removing the comment_id parameter from various functions and structs, introducing new methods for GitHub API interactions, and enhancing the logic for handling streak data. Additionally, tests have been added to ensure robust functionality. These modifications aim to simplify the codebase, improve performance, and enhance maintainability.

Changes

File(s) Summary of Changes
contract/src/lib.rs, contract/src/views.rs Removed comment_id parameter from PR::new and updated streak logic.
contract/src/tests.rs Added test functions for handling GitHub operations, PR management, and streak calculations.
server/src/api/github/mod.rs Introduced Event struct, refactored get_events, and added delete_comment and get_comment_id methods.
server/src/api/near.rs Removed comment_id parameter from send_start function.
server/src/events/commands/start.rs Updated BotIncluded implementation to streamline start command sending.
server/src/events/mod.rs Restructured Event enum into a struct and introduced EventType enum.
server/src/main.rs Refactored event handling logic, simplifying event processing and updating data structures.
shared-types/src/pr.rs Added constants for score timeouts and removed comment_id from PRInfo and PR structs.
shared-types/src/streak.rs Added best field to StreakUserData struct.

🐇
In code's vast garden, changes bloom,
PRs now simpler, less room for gloom.
Events now structured, clear and bright,
Streaks are tracked with data's might.
A rabbit hops with joy, you see,
For cleaner code, and bugs set free! 🐇

Tip

New Features and Improvements

Review Settings

Introduced new personality profiles for code reviews. Users can now select between "Chill" and "Assertive" review tones to tailor feedback styles according to their preferences. The "Assertive" profile posts more comments and nitpicks the code more aggressively, while the "Chill" profile is more relaxed and posts fewer comments.

AST-based Instructions

CodeRabbit offers customizing reviews based on the Abstract Syntax Tree (AST) pattern matching. Read more about AST-based instructions in the documentation.

Community-driven AST-based Rules

We are kicking off a community-driven initiative to create and share AST-based rules. Users can now contribute their AST-based rules to detect security vulnerabilities, code smells, and anti-patterns. Please see the ast-grep-essentials repository for more information.

New Static Analysis Tools

We are continually expanding our support for static analysis tools. We have added support for biome, hadolint, and ast-grep. Update the settings in your .coderabbit.yaml file or head over to the settings page to enable or disable the tools you want to use.

Tone Settings

Users can now customize CodeRabbit to review code in the style of their favorite characters or personalities. Here are some of our favorite examples:

  • Mr. T: "You must talk like Mr. T in all your code reviews. I pity the fool who doesn't!"
  • Pirate: "Arr, matey! Ye must talk like a pirate in all yer code reviews. Yarrr!"
  • Snarky: "You must be snarky in all your code reviews. Snark, snark, snark!"

Revamped Settings Page

We have redesigned the settings page for a more intuitive layout, enabling users to find and adjust settings quickly. This change was long overdue; it not only improves the user experience but also allows our development team to add more settings in the future with ease. Going forward, the changes to .coderabbit.yaml will be reflected in the settings page, and vice versa.

Miscellaneous

  • Turn off free summarization: You can switch off free summarization of PRs opened by users not on a paid plan using the enable_free_tier setting.
  • Knowledge-base scope: You can now set the scope of the knowledge base to either the repository (local) or the organization (global) level using the knowledge_base setting. In addition, you can specify Jira project keys and Linear team keys to limit the knowledge base scope for those integrations.
  • High-level summary placement: You can now customize the location of the high-level summary in the PR description using the high_level_summary_placeholder setting (default @coderabbitai summary).
  • Revamped request changes workflow: You can now configure CodeRabbit to auto-approve or request changes on PRs based on the review feedback using the request_changes_workflow setting.

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration 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.

@akorchyn akorchyn merged commit 072d39f into main May 24, 2024
1 check passed
@akorchyn akorchyn deleted the tests_and_bugfix branch May 24, 2024 09:46
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: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 2eaf271 and c0c3091.
Files selected for processing (10)
  • contract/src/lib.rs (4 hunks)
  • contract/src/tests.rs (1 hunks)
  • contract/src/views.rs (1 hunks)
  • server/src/api/github/mod.rs (5 hunks)
  • server/src/api/near.rs (1 hunks)
  • server/src/events/commands/start.rs (2 hunks)
  • server/src/events/mod.rs (3 hunks)
  • server/src/main.rs (11 hunks)
  • shared-types/src/pr.rs (5 hunks)
  • shared-types/src/streak.rs (1 hunks)
Files skipped from review due to trivial changes (1)
  • server/src/api/near.rs
Additional comments not posted (14)
server/src/events/mod.rs (3)

24-27: The updated Event struct with optional fields for notification_id and comment_id is well-aligned with the new event handling requirements.


31-41: The changes to the execute method to handle different event types and manage notifications are correctly implemented.


56-66: The EventType enum and its method to fetch PrMetadata are well-implemented, ensuring clear separation and handling of different event types.

server/src/events/commands/start.rs (1)

61-64: The update to the execute method to omit comment_id when calling send_start correctly reflects the structural changes intended in the PR.

shared-types/src/streak.rs (1)

138-138: The addition of the best field to the StreakUserData struct enhances the tracking capabilities for user streaks, aligning with the PR's objectives.

shared-types/src/pr.rs (1)

7-8: The addition of SCORE_TIMEOUT_IN_SECONDS and SCORE_TIMEOUT_IN_NANOSECONDS constants is a prudent choice for defining clear timeouts for scoring operations.

contract/src/tests.rs (1)

1-205: The new testing functions and the ContractExt struct are well-designed to enhance test coverage and provide necessary utilities for testing various contract functionalities.

server/src/main.rs (3)

10-10: The addition of EventType in the imports aligns with the structural changes in the event handling system. Good to see the codebase being updated to reflect these new types.


92-94: The refactoring in event_task to accommodate the new Event structure is well-implemented. Using event.event.pr() is a clear way to access PR metadata from events, enhancing readability and maintainability.


Line range hint 144-199: The updates in the execute function to handle the new optional comment_id in the Event structure are correctly implemented. This change ensures that the function can handle events without a comment ID gracefully, which is crucial for robustness.

server/src/api/github/mod.rs (3)

7-7: The addition of Event and EventType in the imports aligns with the structural changes in the event handling system. This update is essential for the new methods introduced in this file.


Line range hint 32-134: The refactoring in get_events to accommodate the new Event and EventType structures is well-implemented. The detailed handling of different event types and conditions ensures that the function remains robust and adaptable to various scenarios.


264-307: The addition of delete_comment and get_comment_id methods is a welcome enhancement, allowing more granular control over comment interactions through the GitHub API. These methods are well-implemented and follow best practices for asynchronous operations.

contract/src/lib.rs (1)

144-144: The update in the sloth_include method to use PR::new without comment_id aligns with the removal of comment_id from the PR structure. This change simplifies the data model and reduces potential points of failure.

@race-of-sloths
Copy link

⚡ The PR is merged! Note: it wasn't scored. The scoring process will end in 24 hours. 🕛

@race-of-sloths
Copy link

🎊 Woohoo! The PR has been completed. Thanks for your fantastic contribution! The scoring process is now done. 🏆

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.

2 participants