refactor(torii-sqlite): move types into its own crate#3170
Conversation
WalkthroughOhayo sensei! This update restructures the handling of SQLite-related types within the workspace. The Changes
Sequence Diagram(s)sequenceDiagram
participant CLI
participant torii-sqlite-types
participant torii-sqlite
CLI->>torii-sqlite-types: Import types (Contract, ContractType, ModelIndices)
torii-sqlite->>torii-sqlite-types: Re-export types as public API
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (5)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
Cargo.toml(1 hunks)crates/torii/cli/Cargo.toml(1 hunks)crates/torii/cli/src/args.rs(1 hunks)crates/torii/cli/src/options.rs(1 hunks)crates/torii/grpc/Cargo.toml(1 hunks)crates/torii/sqlite/sqlite/Cargo.toml(1 hunks)crates/torii/sqlite/sqlite/src/lib.rs(1 hunks)crates/torii/sqlite/types/Cargo.toml(1 hunks)
🔇 Additional comments (8)
crates/torii/sqlite/types/Cargo.toml (2)
1-6: Ohayo sensei — New crate manifest with workspace inheritance
The[package]section correctly establishestorii-sqlite-typesand inheritsversion,edition, andrepositoryfrom the workspace to keep metadata consistent.
7-13: Ohayo sensei — Centralized dependency declarations
Dependencies (chrono,dojo-types,serde,anyhow,sqlx,starknet) are all declared withworkspace = true, ensuring a single source of truth for versions across crates.crates/torii/cli/src/options.rs (1)
10-10: Ohayo sensei — Updated types import
The import path forContract,ContractType, andModelIndiceshas been switched to the newtorii_sqlite_typescrate, aligning with the refactoring.crates/torii/cli/src/args.rs (1)
118-118: Ohayo sensei — Corrected test module import
Tests now correctly importContract,ContractType, andModelIndicesfromtorii_sqlite_typesinstead of the old internal module.crates/torii/cli/Cargo.toml (1)
16-16: Ohayo sensei — Added workspace dependency on torii-sqlite-types
Thetorii-clicrate now includestorii-sqlite-typesvia the workspace, reflecting the separation of shared SQLite types into its own crate.crates/torii/sqlite/sqlite/Cargo.toml (1)
12-12: Ohayo sensei — Added workspace dependency on torii-sqlite-types
This ensures thetorii-sqliteimplementation crate depends on the newly extracted types crate for consistency and reuse.crates/torii/grpc/Cargo.toml (1)
17-17: Switch to workspace dependency fortorii-sqlite
Ohayo sensei, usingworkspace = truein place of a relative path aligns with the refactor and keeps dependency resolution in-sync across the workspace.crates/torii/sqlite/sqlite/src/lib.rs (1)
38-38: Re-export external types crate
Ohayo sensei, re-exportingtorii_sqlite_typesastypesreplaces the internal module and maintains backward compatibility with existing imports (use types::ParsedCall).
| torii-sqlite = { path = "crates/torii/sqlite/sqlite" } | ||
| torii-sqlite-types = { path = "crates/torii/sqlite/types" } |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Update workspace dependencies for SQLite crates
Ohayo sensei, updating the path for torii-sqlite and introducing torii-sqlite-types under crates/torii/sqlite/types correctly modularizes the types into their own crate.
Run this script to verify that all internal types imports have been migrated:
🏁 Script executed:
#!/usr/bin/env bash
rg "torii_sqlite::types" -n .Length of output: 2416
Fix remaining types imports to use the new crate
Ohayo sensei, after moving the types into the torii-sqlite-types crate, all imports should reference torii_sqlite_types instead of torii_sqlite::types. The following files still use the old path and need updating:
- crates/torii/runner/src/lib.rs:42
- crates/torii/graphql/src/schema.rs:5
- crates/torii/indexer/src/test.rs:26
- crates/torii/graphql/src/tests/mod.rs:33
- crates/torii/libp2p/src/test.rs:33
- crates/torii/graphql/src/tests/subscription_test.rs:22
- crates/torii/indexer/src/task_manager.rs:10
- crates/torii/graphql/src/object/event.rs:8
- crates/torii/graphql/src/object/model.rs:8
- crates/torii/graphql/src/tests/metadata_test.rs:13
- crates/torii/graphql/src/object/erc/erc_token.rs:10
- crates/torii/graphql/src/object/erc/token_balance.rs:13
- crates/torii/graphql/src/object/transaction.rs:11
- crates/torii/graphql/src/object/event_message.rs:11
- crates/torii/graphql/src/object/entity.rs:11
- crates/torii/indexer/src/engine.rs:28
- crates/torii/indexer/src/processors/store_transaction.rs:10
- crates/torii/grpc/src/server/mod.rs:50
- crates/torii/grpc/src/server/subscriptions/event_message.rs:19
- crates/torii/grpc/src/server/subscriptions/event.rs:19
- crates/torii/grpc/src/server/subscriptions/token.rs:18
- crates/torii/grpc/src/server/tests/entities_test.rs:28
- crates/torii/grpc/src/server/subscriptions/token_balance.rs:18
- crates/torii/grpc/src/server/subscriptions/indexer.rs:18
- crates/torii/grpc/src/server/subscriptions/entity.rs:19
Please update each to, for example:
use torii_sqlite_types::{Contract, ContractType, Model};This will ensure all references point to the extracted types crate.
fe38bcd to
1606eee
Compare
1606eee to
eb821fb
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3170 +/- ##
==========================================
- Coverage 55.63% 55.63% -0.01%
==========================================
Files 443 443
Lines 62987 62987
==========================================
- Hits 35041 35040 -1
- Misses 27946 27947 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
having a version conflict issue when importing
torii-clifromslot.cainomehere isn't even being used bytorii-cli. so this refactor removes that reliance.Summary by CodeRabbit