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(sozo): ensure already registered resources don't make migration fail #2350

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

glihm
Copy link
Collaborator

@glihm glihm commented Aug 27, 2024

Description

As now the core is panicking if a resource is already registered, we need to check first if the resource if not already registered.

This check wasn't done for namespaces and models.

For testing, we need a way to avoid compiling from the code due to too long times. A script should be ok to modify actions and try to migrate again.

Summary by CodeRabbit

  • New Features

    • Enhanced migration process to prevent duplicate registrations of namespaces and models.
    • Improved user feedback with conditional printing of headers reflecting the number of processed namespaces and models.
  • Bug Fixes

    • Resolved issues related to unnecessary registrations, optimizing the migration workflow.

Copy link

coderabbitai bot commented Aug 27, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

Ohayo, sensei! The changes involve significant modifications to the migration process in the migrate.rs file. The implementation now includes checks to prevent multiple registrations of namespaces and models, optimizing the registration process and ensuring consistency. Additional improvements provide clearer feedback during the migration by conditionally printing headers based on the processed namespaces and models.

Changes

Files Change Summary
crates/sozo/ops/src/migration/... Added checks to prevent multiple registrations of namespaces and models; improved feedback during migration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MigrationProcess
    participant World

    User->>MigrationProcess: Initiate migration
    MigrationProcess->>World: Check registered namespaces
    World-->>MigrationProcess: Return registered namespaces
    MigrationProcess->>MigrationProcess: Filter out already registered namespaces
    MigrationProcess->>World: Register new namespaces
    MigrationProcess->>World: Check declared models
    World-->>MigrationProcess: Return declared models
    MigrationProcess->>MigrationProcess: Filter out already declared models
    MigrationProcess->>World: Register new models
    MigrationProcess->>User: Print migration summary
Loading

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.

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.

@glihm glihm marked this pull request as draft August 27, 2024 22:50
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 73.68421% with 5 lines in your changes missing coverage. Please review.

Project coverage is 67.51%. Comparing base (e1a349b) to head (6f287a1).
Report is 3 commits behind head on main.

Files Patch % Lines
crates/sozo/ops/src/migration/migrate.rs 73.68% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2350   +/-   ##
=======================================
  Coverage   67.51%   67.51%           
=======================================
  Files         359      359           
  Lines       46853    46871   +18     
=======================================
+ Hits        31634    31647   +13     
- Misses      15219    15224    +5     

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

@glihm glihm marked this pull request as ready for review August 28, 2024 14:31
@glihm glihm merged commit 94e4508 into dojoengine:main Aug 28, 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.

1 participant