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

refactor(torii-client): remove deprecated model storage and subscription #2267

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

Larkooo
Copy link
Collaborator

@Larkooo Larkooo commented Aug 5, 2024

Summary by CodeRabbit

  • New Features

    • Streamlined client design by removing local state management for model storage and subscriptions.
  • Bug Fixes

    • Addressed issues related to unnecessary complexity in the client’s data handling.
  • Chores

    • Removed the utils module from public visibility, simplifying the library's structure.

Copy link

coderabbitai bot commented Aug 5, 2024

Walkthrough

Ohayo, sensei! The recent changes streamline the Client struct in the Torii crate by removing local storage and subscription management features. This transition simplifies data handling, focusing more on external service interactions while eliminating unnecessary state management. Additionally, the utils module has been made private, indicating a potential shift in the library's design philosophy. Overall, these adjustments aim for a cleaner and more efficient architecture.

Changes

Files Change Summary
crates/torii/client/src/client/mod.rs The Client struct has removed storage, subscribed_models, and subscription-related methods, simplifying state management and focusing on external service interactions.
crates/torii/client/src/lib.rs The utils module has been removed from exports, making it inaccessible to external modules, indicating a potential redesign or internal focus for the library.

Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bd5b146 and 5f519e0.

Files selected for processing (2)
  • crates/torii/client/src/client/mod.rs (6 hunks)
  • crates/torii/client/src/lib.rs (1 hunks)
Additional comments not posted (19)
crates/torii/client/src/client/mod.rs (19)

Line range hint 69-72:
LGTM!

The changes to the new method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 74-76:
LGTM!

The changes to the relay_runner method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 78-83:
LGTM!

The changes to the publish_message method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


85-88: LGTM!

The changes to the metadata method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 90-98:
LGTM!

The changes to the entities method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 100-108:
LGTM!

The changes to the event_messages method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 110-115:
LGTM!

The changes to the starknet_events method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 117-123:
LGTM!

The changes to the on_entity_updated method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 125-131:
LGTM!

The changes to the update_entity_subscription method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 133-139:
LGTM!

The changes to the on_event_message_updated method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 141-147:
LGTM!

The changes to the update_event_message_subscription method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


Line range hint 149-154:
LGTM!

The changes to the on_starknet_event method ensure that the client retains essential functionality while removing obsolete subscription and storage logic.


50-52: Ohayo, sensei! The subscribed_models method has been removed.

This change indicates that the client will no longer manage subscriptions to models. Ensure that any dependent code is updated to reflect this change.

Verification successful

Ohayo, sensei! The subscribed_models method has been removed.

This change indicates that the client will no longer manage subscriptions to models. The verification process confirms that there are no lingering references to the subscribed_models method in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the `subscribed_models` method in the codebase.

# Test: Search for the usage of the `subscribed_models` method. Expect: No occurrences of the `subscribed_models` method.
rg --type rust -A 5 $'subscribed_models'

Length of output: 39


59-61: Ohayo, sensei! The add_models_to_sync method has been removed.

This change indicates that the client will no longer add models to sync. Ensure that any dependent code is updated to reflect this change.

Verification successful

Ohayo, sensei! The add_models_to_sync method has been successfully removed from the codebase, and there are no remaining references to it in the code or documentation.

  • No occurrences of add_models_to_sync found in the codebase.
  • No references to add_models_to_sync found in comments or documentation.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the `add_models_to_sync` method in the codebase.

# Test: Search for the usage of the `add_models_to_sync` method. Expect: No occurrences of the `add_models_to_sync` method.
rg --type rust -A 5 $'add_models_to_sync'

Length of output: 40


Script:

#!/bin/bash
# Description: Verify all references to the `add_models_to_sync` method in comments and documentation.

# Test: Search for the usage of the `add_models_to_sync` method in comments and documentation files.
rg 'add_models_to_sync' --glob '*.rs' --glob '*.md' --glob '*.txt'

Length of output: 66


62-64: Ohayo, sensei! The remove_models_to_sync method has been removed.

This change indicates that the client will no longer remove models to sync. Ensure that any dependent code is updated to reflect this change.

Verification successful

Ohayo, sensei! The remove_models_to_sync method has been successfully removed, and no dependent code or documentation references were found.

  • No occurrences of remove_models_to_sync in the codebase.
  • No references in comments or documentation.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the `remove_models_to_sync` method in the codebase.

# Test: Search for the usage of the `remove_models_to_sync` method. Expect: No occurrences of the `remove_models_to_sync` method.
rg --type rust -A 5 $'remove_models_to_sync'

Length of output: 43


Script:

#!/bin/bash
# Description: Verify all references to the `remove_models_to_sync` method in the codebase, including comments and documentation.

# Test: Search for any references to the `remove_models_to_sync` method. Expect: No occurrences of the `remove_models_to_sync` method.
rg --type rust 'remove_models_to_sync'

# Test: Search for any references to the `remove_models_to_sync` method in comments and documentation. Expect: No occurrences of the `remove_models_to_sync` method.
rg --type rust '//.*remove_models_to_sync'
rg --type rust '/\*.*remove_models_to_sync.*\*/'
rg --type markdown 'remove_models_to_sync'

Length of output: 177


12-23: Ohayo, sensei! The Client struct has been simplified.

The removal of storage, subscribed_models, and sub_client_handle fields indicates a shift towards a more streamlined design, reducing state management overhead. Ensure that any dependent code is updated to reflect these changes.

Verification successful

Ohayo, sensei! The Client struct has been simplified.

The removal of storage, subscribed_models, and sub_client_handle fields indicates a shift towards a more streamlined design, reducing state management overhead. The search results confirm that these fields are not referenced elsewhere in the codebase, so their removal should not impact other parts of the project.

  • Ensure that any dependent code is updated to reflect these changes.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the removed fields in the codebase.

# Test: Search for the usage of the removed fields. Expect: No occurrences of the removed fields.
rg --type rust -A 5 $'storage|subscribed_models|sub_client_handle'

Length of output: 270980


Line range hint 56-58:
Ohayo, sensei! The start_subscription method has been removed.

This change indicates that the client will no longer initiate subscriptions to models. Ensure that any dependent code is updated to reflect this change.

Verification successful

Ohayo, sensei! The start_subscription method has been successfully removed, and no references to it exist in the codebase.

  • The method definition and all references to start_subscription have been verified as absent.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the `start_subscription` method in the codebase.

# Test: Search for the usage of the `start_subscription` method. Expect: No occurrences of the `start_subscription` method.
rg --type rust -A 5 $'start_subscription'

Length of output: 40


Script:

#!/bin/bash
# Description: Verify the removal of the `start_subscription` method.

# Test 1: Search for the definition of the `start_subscription` method. Expect: No occurrences of the `start_subscription` method definition.
rg --type rust 'fn start_subscription'

# Test 2: Search for any references to the `start_subscription` method in the codebase. Expect: No occurrences of the `start_subscription` method.
rg --type rust 'start_subscription'

Length of output: 76


Line range hint 53-55:
Ohayo, sensei! The model method has been removed.

This change indicates that the client will no longer fetch models based on keys. Ensure that any dependent code is updated to reflect this change.


Line range hint 65-67:
Ohayo, sensei! The storage method has been removed.

This change indicates that the client will no longer manage local storage for models. Ensure that any dependent code is updated to reflect this change.

Verification successful

Ohayo, sensei! Let's verify the removal of the storage method and ensure all dependencies are updated.


Ohayo, sensei! Let's ensure the storage method is indeed absent and there were no errors in the previous execution.


Ohayo, sensei! The storage method has been successfully removed, and there are no references to it in the crates/torii/client/src/client/ directory. The changes are correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the `storage` method in the codebase.

# Test: Search for the usage of the `storage` method. Expect: No occurrences of the `storage` method.
rg --type rust -A 5 $'storage'

Length of output: 270942


Script:

#!/bin/bash
# Verify the removal of the `storage` method in the specified file and lines.
rg --type rust -A 5 'fn storage' crates/torii/client/src/client/mod.rs

# Check for any references to the `storage` method in the `crates/torii/client/src/client/` directory.
rg --type rust 'storage' crates/torii/client/src/client/

Length of output: 129


Script:

#!/bin/bash
# Verify the removal of the `storage` method in the specified file and lines.
rg --type rust -A 5 'fn storage' crates/torii/client/src/client/mod.rs || echo "No storage method found in mod.rs"

# Check for any references to the `storage` method in the `crates/torii/client/src/client/` directory.
rg --type rust 'storage' crates/torii/client/src/client/ || echo "No references to storage found in client directory"

Length of output: 317


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 as 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.

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

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

Outside diff range, codebase verification and nitpick comments (1)
crates/torii/client/src/lib.rs (1)

5-5: Ohayo, sensei! The utils module has been made private.

The change could indeed impact external code relying on the utils module. The search results show numerous references to utils across different crates, indicating potential issues.

  • Locations to review:
    • crates/torii/core/src/sql.rs
    • crates/torii/graphql/src/schema.rs
    • crates/torii/graphql/src/tests/subscription_test.rs
    • crates/torii/graphql/src/object/event_message.rs
    • crates/torii/graphql/src/object/inputs/keys_input.rs
    • crates/torii/graphql/src/object/mod.rs
    • crates/torii/graphql/src/object/model_data.rs
    • crates/torii/graphql/src/object/entity.rs

Please ensure that all dependencies are updated accordingly.

Analysis chain

Ohayo, sensei! The utils module has been made private.

This change could impact any external code that relied on the utils module. Ensure that all dependencies are updated accordingly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the `utils` module in the codebase.

# Test: Search for the usage of the `utils` module. Expect: No occurrences of the `utils` module outside the crate.
rg --type rust -A 5 $'utils::'

Length of output: 125717

Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.40%. Comparing base (bd5b146) to head (5f519e0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2267      +/-   ##
==========================================
+ Coverage   70.24%   70.40%   +0.16%     
==========================================
  Files         345      342       -3     
  Lines       45466    45018     -448     
==========================================
- Hits        31938    31697     -241     
+ Misses      13528    13321     -207     

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

@glihm glihm merged commit 9eac7cf into dojoengine:main Aug 5, 2024
15 checks passed
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