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

fix(katana): merging server args from file #3044

Merged
merged 2 commits into from
Feb 18, 2025
Merged

Conversation

kariy
Copy link
Member

@kariy kariy commented Feb 17, 2025

Summary by CodeRabbit

  • Refactor
    • Updated default server behavior so that RPC modules are now disabled by default. Users must explicitly enable desired modules during configuration, offering enhanced control and a streamlined setup.
    • Improved the handling of server configuration options by allowing for more flexible merging from configuration files.
    • Enhanced the RPC server configuration with additional parameters for improved customizability.

Copy link

coderabbitai bot commented Feb 17, 2025

Walkthrough

Ohayo sensei! This update modifies the default behavior of the ServerOptions struct in crates/katana/cli/src/options.rs. The http_modules field, which was previously set to a default list of RPC modules, is now initialized to None. Additionally, a new merge method has been introduced to facilitate the merging of server configuration options. In crates/katana/cli/src/args.rs, the handling of the server field has been streamlined by utilizing the new merge method, enhancing the configuration flexibility for server and RPC components.

Changes

File(s) Change Summary
crates/katana/cli/src/options.rs Updated ServerOptions: changed default initialization of http_modules from Some(RpcModulesList::default()) to None and added a merge method.
crates/katana/cli/src/args.rs Modified NodeArgs: replaced default value checks with merge method in with_config_file, and updated rpc_config to include new fields in RpcConfig.

Possibly related PRs

  • fix(katana-cli): ensure compilation without server feature #2896: The changes in the main PR, specifically the addition of the merge method in the ServerOptions struct, are directly related to the modifications in the rpc_config method of the NodeArgs struct in the retrieved PR, as both involve handling server configuration options.
  • fix: cli args for torii and katana with serde default #2692: The changes in the main PR, specifically the addition of the merge method in the ServerOptions struct, are directly related to the modifications in the retrieved PR that also involve the ServerOptions struct and its merging logic.
  • feat(katana-rpc): rpc server builder  #2788: The changes in the main PR, specifically the modifications to the ServerOptions struct and the addition of the merge method, are related to the updates in the retrieved PR that involve the handling of the server field and the use of the merge method in the NodeArgs struct, indicating a direct connection in their configuration management logic.

Suggested reviewers

  • glihm

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3073a14 and 794f72c.

📒 Files selected for processing (2)
  • crates/katana/cli/src/args.rs (2 hunks)
  • crates/katana/cli/src/options.rs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: ensure-wasm
  • GitHub Check: docs
  • GitHub Check: build
🔇 Additional comments (3)
crates/katana/cli/src/options.rs (2)

146-146: Ohayo sensei! LGTM on the default value change.

The change to initialize http_modules with None aligns better with the merging strategy, allowing for more flexible configuration from different sources.


157-193: Ohayo sensei! The merge implementation looks solid.

The merge method follows a consistent pattern of updating fields only when they are in their default state, which is a robust approach for configuration merging.

crates/katana/cli/src/args.rs (1)

390-390: Ohayo sensei! Nice simplification of server options merging.

The use of the new merge method makes the code more maintainable and consistent with the merging strategy used for other options.


🪧 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

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

🧹 Nitpick comments (1)
crates/katana/cli/src/options.rs (1)

102-106: Ohayo sensei! Consider enhancing the documentation for http_modules.

The documentation should clarify that no RPC modules are enabled by default and users need to explicitly specify which modules they want to enable.

-    /// API's offered over the HTTP-RPC interface.
+    /// API's offered over the HTTP-RPC interface.
+    /// 
+    /// By default, no RPC modules are enabled. You must explicitly specify
+    /// which modules you want to enable.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 040c1d6 and 3073a14.

📒 Files selected for processing (1)
  • crates/katana/cli/src/options.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: clippy
  • GitHub Check: docs
  • GitHub Check: ensure-wasm
  • GitHub Check: build
🔇 Additional comments (1)
crates/katana/cli/src/options.rs (1)

146-146:

❓ Verification inconclusive

Verify the impact of removing default RPC modules.

This change modifies the default behavior by not enabling any RPC modules by default. This could be a breaking change for systems that expect certain modules to be available.

Let's check for any direct dependencies on the default RPC modules:


🏁 Script executed:

#!/bin/bash
# Search for direct usage of ServerOptions where default modules might be expected
rg -A 5 "ServerOptions::default\(\)" 

# Search for places where RPC modules are accessed without explicit checks
ast-grep --pattern 'match $obj.http_modules {
  $$$
}'

Length of output: 2215


Ohayo, sensei! Please verify the breaking change regarding default RPC modules.

The change at crates/katana/cli/src/options.rs:146 sets http_modules to None by default, meaning no RPC modules will be enabled unless explicitly configured. Our search shows several spots in the code (e.g., in crates/katana/cli/src/file.rs, crates/katana/cli/src/args.rs, and crates/torii/cli/src/args.rs) that compare options against ServerOptions::default(). This indicates that some parts of the system expect the previous default behavior—i.e., having certain modules enabled. We didn’t find explicit runtime checks (via pattern matching on http_modules), but the reliance on ServerOptions::default() suggests potential impacts.

  • Location: crates/katana/cli/src/options.rs, line 146 (http_modules: None,)
  • Impact: Systems expecting default RPC modules may break unless they update their configurations.
  • Recommendation:
    • Double-check that clients and tests dependent on ServerOptions::default() are updated accordingly.
    • Update documentation to clearly state the new default behavior and advise explicit configuration for RPC modules.

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 13.88889% with 31 lines in your changes missing coverage. Please review.

Project coverage is 57.71%. Comparing base (1065468) to head (794f72c).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/katana/cli/src/options.rs 11.42% 31 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3044      +/-   ##
==========================================
- Coverage   57.76%   57.71%   -0.05%     
==========================================
  Files         437      437              
  Lines       59305    59336      +31     
==========================================
- Hits        34256    34248       -8     
- Misses      25049    25088      +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kariy kariy marked this pull request as draft February 17, 2025 22:21
@kariy kariy force-pushed the katana/fix-merge-file-config branch from 3073a14 to 794f72c Compare February 18, 2025 03:56
@kariy kariy marked this pull request as ready for review February 18, 2025 03:56
@glihm glihm merged commit 20e0552 into main Feb 18, 2025
13 of 15 checks passed
@glihm glihm deleted the katana/fix-merge-file-config branch February 18, 2025 13:52
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