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: break up the common crate into smaller ones #977

Merged
merged 8 commits into from
Feb 6, 2025

Conversation

Natoandro
Copy link
Contributor

@Natoandro Natoandro commented Feb 6, 2025

  • Break up the common crate into a few smaller crates:
    • typegraph/schema
    • utils/grpc
    • utils/archive
    • typegate_api

Migration notes


  • The change comes with new or modified tests
  • Hard-to-understand functions have explanatory comments
  • End-user documentation is updated to reflect the change

Summary by CodeRabbit

  • New Features

    • Exposed an updated public API with dedicated interfaces for authentication and node management.
  • Refactor

    • Streamlined dependency and workspace organization by replacing legacy naming with clearer, modern module references.
  • Chores

    • Updated package configurations to improve maintainability and set the stage for future enhancements.

These changes maintain all existing functionality while providing a more cohesive architecture and clearer public interfaces for end-user interactions.

# Conflicts:
#	Cargo.toml
#	src/typegraph/core/src/conversion/runtimes.rs
#	src/typegraph/core/src/global_store.rs
#	src/typegraph/core/src/lib.rs
#	src/typegraph/core/src/runtimes/prisma/context.rs
#	src/typegraph/core/src/runtimes/substantial/mod.rs
#	src/typegraph/core/src/typedef/func.rs
#	src/typegraph/core/src/typedef/struct_.rs
#	src/typegraph/core/src/types/type_def.rs
#	src/typegraph/core/src/types/type_ref/injection.rs
#	src/typegraph/core/src/utils/postprocess/mod.rs
Copy link
Contributor

coderabbitai bot commented Feb 6, 2025

📝 Walkthrough

Walkthrough

This pull request reorganizes the project’s workspace and dependencies by deprecating the legacy “common” module and redistributing its responsibilities into new modules such as tg_schema, typegate_api, grpc_utils, and archive_utils. The changes involve updating Cargo.toml files to adjust workspace members and dependencies, along with widespread modifications of import paths and type references in the Rust source files. Although error messages and logging are slightly adjusted in some files, the core functionality and control flow remain unchanged.

Changes

Affected File(s) Change Summary
Cargo.toml (root, src/meta-cli/..., src/metagen/..., src/typegate/engine/..., src/typegate_api/..., src/typegraph/core/...) Updated workspace configuration and dependency entries: removed the legacy common dependency; added entries for tg_schema, typegate_api, grpc_utils, and archive_utils; updated package names and dependency flags.
src/common/src/lib.rs Removed file that previously exported modules (archive, grpc, typegraph, etc.), effectively deprecating the common module.
src/meta-cli/… (e.g. cli/deploy.rs, cli/gen.rs, cli/list.rs, cli/serialize.rs, config.rs, deploy/actors/task/*.rs) Changed import paths and type references: replaced imports from common with those from typegate_api or tg_schema; updated the Node and Typegraph types and adjusted method parameters accordingly.
src/metagen/… (e.g. client_py/*, client_rs/*, client_ts/*, fdk_rs/*, fdk_ts/*, lib.rs, shared/*, tests/*) Replaced imports from common::typegraph with tg_schema (or typegate_api where applicable); updated type references in client, shared, and test modules to align with the new module structure.
src/typegate/engine/… (e.g. runtimes/grpc.rs, prisma.rs, prisma/migration.rs) Modified imports to reference grpc_utils, archive_utils, and tg_schema instead of common; updated calls to archiving and gRPC utility functions accordingly.
src/typegate_api/… (Cargo.toml, src/lib.rs, src/node.rs) Introduced a new package by renaming the legacy “common” package to typegate_api; declared public modules and re-exported entities (e.g. Node, BasicAuth).
src/typegraph/core/… (across submodules in conversion/, runtimes/, typedef/, types/, plus files like global_store.rs, t.rs, test_utils.rs) Refactored numerous submodules by replacing common::typegraph imports with tg_schema; updated return types, data structure references, and module imports throughout the core codebase. -->

Sequence Diagram(s)

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

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

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.

@Natoandro Natoandro force-pushed the refactor-common-crate branch from e141f9a to a8dc23c Compare February 6, 2025 13:04
@Natoandro Natoandro changed the title refactor: break common crate refactor: break up the common crate into smaller ones Feb 6, 2025
@Natoandro Natoandro marked this pull request as ready for review February 6, 2025 16:35
Copy link
Contributor

@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)
src/metagen/src/tests/fixtures.rs (1)

5-5: Consider being more explicit with imports.

While the change to tg_schema is correct, using wildcard imports (*) can make it harder to track dependencies. Consider explicitly importing only the needed types.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4227fa0 and 9a1cbd1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (82)
  • Cargo.toml (2 hunks)
  • src/common/src/lib.rs (0 hunks)
  • src/meta-cli/Cargo.toml (1 hunks)
  • src/meta-cli/src/cli/deploy.rs (1 hunks)
  • src/meta-cli/src/cli/gen.rs (2 hunks)
  • src/meta-cli/src/cli/list.rs (1 hunks)
  • src/meta-cli/src/cli/serialize.rs (1 hunks)
  • src/meta-cli/src/config.rs (1 hunks)
  • src/meta-cli/src/deploy/actors/task.rs (1 hunks)
  • src/meta-cli/src/deploy/actors/task/deploy.rs (1 hunks)
  • src/meta-cli/src/deploy/actors/task/deploy/migrations.rs (1 hunks)
  • src/meta-cli/src/deploy/actors/task/serialize.rs (1 hunks)
  • src/meta-cli/src/typegraph/rpc/mod.rs (1 hunks)
  • src/meta-cli/src/utils/mod.rs (1 hunks)
  • src/metagen/Cargo.toml (2 hunks)
  • src/metagen/src/client_py/mod.rs (1 hunks)
  • src/metagen/src/client_py/node_metas.rs (1 hunks)
  • src/metagen/src/client_py/selections.rs (1 hunks)
  • src/metagen/src/client_py/types.rs (1 hunks)
  • src/metagen/src/client_rs/mod.rs (1 hunks)
  • src/metagen/src/client_rs/node_metas.rs (1 hunks)
  • src/metagen/src/client_rs/selections.rs (1 hunks)
  • src/metagen/src/client_ts/mod.rs (1 hunks)
  • src/metagen/src/client_ts/node_metas.rs (1 hunks)
  • src/metagen/src/client_ts/selections.rs (1 hunks)
  • src/metagen/src/fdk_rs/stubs.rs (2 hunks)
  • src/metagen/src/fdk_rs/types.rs (1 hunks)
  • src/metagen/src/fdk_ts/types.rs (1 hunks)
  • src/metagen/src/lib.rs (1 hunks)
  • src/metagen/src/shared/client.rs (2 hunks)
  • src/metagen/src/shared/files.rs (1 hunks)
  • src/metagen/src/shared/mod.rs (1 hunks)
  • src/metagen/src/shared/types.rs (2 hunks)
  • src/metagen/src/tests/fixtures.rs (2 hunks)
  • src/metagen/src/tests/mod.rs (2 hunks)
  • src/typegate/engine/Cargo.toml (1 hunks)
  • src/typegate/engine/src/runtimes/grpc.rs (1 hunks)
  • src/typegate/engine/src/runtimes/prisma.rs (1 hunks)
  • src/typegate/engine/src/runtimes/prisma/migration.rs (1 hunks)
  • src/typegate/engine/src/runtimes/substantial.rs (1 hunks)
  • src/typegate/engine/src/typegraph.rs (1 hunks)
  • src/typegate_api/Cargo.toml (1 hunks)
  • src/typegate_api/src/lib.rs (1 hunks)
  • src/typegate_api/src/node.rs (1 hunks)
  • src/typegraph/core/Cargo.toml (1 hunks)
  • src/typegraph/core/src/conversion/parameter_transform.rs (1 hunks)
  • src/typegraph/core/src/conversion/params.rs (1 hunks)
  • src/typegraph/core/src/conversion/policies.rs (1 hunks)
  • src/typegraph/core/src/conversion/runtimes.rs (4 hunks)
  • src/typegraph/core/src/conversion/types.rs (1 hunks)
  • src/typegraph/core/src/global_store.rs (3 hunks)
  • src/typegraph/core/src/lib.rs (1 hunks)
  • src/typegraph/core/src/runtimes/aws/mod.rs (2 hunks)
  • src/typegraph/core/src/runtimes/deno.rs (1 hunks)
  • src/typegraph/core/src/runtimes/graphql.rs (1 hunks)
  • src/typegraph/core/src/runtimes/grpc/mod.rs (1 hunks)
  • src/typegraph/core/src/runtimes/grpc/type_generation.rs (1 hunks)
  • src/typegraph/core/src/runtimes/prisma/context.rs (1 hunks)
  • src/typegraph/core/src/runtimes/prisma/migration.rs (1 hunks)
  • src/typegraph/core/src/runtimes/prisma/mod.rs (1 hunks)
  • src/typegraph/core/src/runtimes/prisma/model.rs (2 hunks)
  • src/typegraph/core/src/runtimes/prisma/type_generation/input_type.rs (1 hunks)
  • src/typegraph/core/src/runtimes/prisma/type_generation/where_.rs (1 hunks)
  • src/typegraph/core/src/runtimes/substantial/mod.rs (1 hunks)
  • src/typegraph/core/src/runtimes/typegate.rs (1 hunks)
  • src/typegraph/core/src/runtimes/typegraph.rs (1 hunks)
  • src/typegraph/core/src/t.rs (1 hunks)
  • src/typegraph/core/src/test_utils.rs (1 hunks)
  • src/typegraph/core/src/typedef/boolean.rs (1 hunks)
  • src/typegraph/core/src/typedef/either.rs (1 hunks)
  • src/typegraph/core/src/typedef/file.rs (1 hunks)
  • src/typegraph/core/src/typedef/float.rs (1 hunks)
  • src/typegraph/core/src/typedef/func.rs (1 hunks)
  • src/typegraph/core/src/typedef/integer.rs (1 hunks)
  • src/typegraph/core/src/typedef/list.rs (1 hunks)
  • src/typegraph/core/src/typedef/optional.rs (1 hunks)
  • src/typegraph/core/src/typedef/string.rs (1 hunks)
  • src/typegraph/core/src/typedef/struct_.rs (1 hunks)
  • src/typegraph/core/src/typedef/union.rs (1 hunks)
  • src/typegraph/core/src/typegraph.rs (2 hunks)
  • src/typegraph/core/src/types/type_def.rs (1 hunks)
  • src/typegraph/core/src/types/type_ref.rs (1 hunks)
⛔ Files not processed due to max files limit (25)
  • src/typegraph/core/src/types/type_ref/injection.rs
  • src/typegraph/core/src/utils/archive.rs
  • src/typegraph/core/src/utils/artifacts.rs
  • src/typegraph/core/src/utils/metagen_utils.rs
  • src/typegraph/core/src/utils/mod.rs
  • src/typegraph/core/src/utils/postprocess/deno_rt.rs
  • src/typegraph/core/src/utils/postprocess/mod.rs
  • src/typegraph/core/src/utils/postprocess/naming.rs
  • src/typegraph/core/src/utils/postprocess/prisma_rt.rs
  • src/typegraph/core/src/utils/postprocess/python_rt.rs
  • src/typegraph/core/src/utils/postprocess/substantial_rt.rs
  • src/typegraph/core/src/utils/postprocess/validation.rs
  • src/typegraph/core/src/utils/postprocess/wasm_rt.rs
  • src/typegraph/core/src/validation/materializers.rs
  • src/typegraph/schema/Cargo.toml
  • src/typegraph/schema/src/utils.rs
  • src/typegraph/schema/src/validator/common.rs
  • src/typegraph/schema/src/validator/injection.rs
  • src/typegraph/schema/src/validator/input.rs
  • src/typegraph/schema/src/validator/mod.rs
  • src/typegraph/schema/src/validator/types.rs
  • src/typegraph/schema/src/validator/value.rs
  • src/typegraph/schema/src/visitor2.rs
  • src/utils/archive/Cargo.toml
  • src/utils/grpc/Cargo.toml
💤 Files with no reviewable changes (1)
  • src/common/src/lib.rs
✅ Files skipped from review due to trivial changes (35)
  • src/typegraph/core/src/conversion/params.rs
  • src/metagen/src/client_ts/selections.rs
  • src/metagen/src/client_ts/node_metas.rs
  • src/meta-cli/src/cli/list.rs
  • src/meta-cli/src/cli/serialize.rs
  • src/typegraph/core/src/runtimes/prisma/type_generation/where_.rs
  • src/typegraph/core/src/runtimes/prisma/type_generation/input_type.rs
  • src/typegate_api/src/lib.rs
  • src/typegate/engine/src/runtimes/grpc.rs
  • src/typegraph/core/src/t.rs
  • src/typegraph/core/src/runtimes/prisma/migration.rs
  • src/typegraph/core/src/types/type_def.rs
  • src/metagen/src/client_py/selections.rs
  • src/metagen/src/fdk_ts/types.rs
  • src/typegate/engine/src/runtimes/substantial.rs
  • src/metagen/src/client_py/node_metas.rs
  • src/typegraph/core/src/runtimes/prisma/context.rs
  • src/typegraph/core/src/runtimes/substantial/mod.rs
  • src/typegraph/core/src/conversion/policies.rs
  • src/metagen/src/shared/files.rs
  • src/typegraph/core/src/runtimes/grpc/type_generation.rs
  • src/typegraph/core/src/conversion/types.rs
  • src/typegraph/core/src/lib.rs
  • src/typegraph/core/src/conversion/parameter_transform.rs
  • src/metagen/src/shared/mod.rs
  • src/metagen/src/client_py/types.rs
  • src/typegate/engine/src/runtimes/prisma/migration.rs
  • src/metagen/src/fdk_rs/types.rs
  • src/metagen/src/client_rs/selections.rs
  • src/typegraph/core/src/typedef/struct_.rs
  • src/typegraph/core/src/typedef/func.rs
  • src/meta-cli/src/deploy/actors/task/deploy/migrations.rs
  • src/metagen/src/client_rs/node_metas.rs
  • src/typegraph/core/src/runtimes/prisma/mod.rs
  • src/meta-cli/src/deploy/actors/task.rs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: lint-compat (macos-14, aarch64-apple-darwin, false)
  • GitHub Check: bulid-docker (linux/amd64, custom-ubuntu-large)
  • GitHub Check: lint-compat (macos-13, x86_64-apple-darwin, false)
  • GitHub Check: pre-commit
🔇 Additional comments (64)
src/meta-cli/src/typegraph/rpc/mod.rs (1)

23-26: ⚠️ Potential issue

Fix duplicate Aws variant in RpcCall enum.

The Aws variant appears twice in the enum, which is invalid Rust code and will cause a compilation error. Each variant in an enum must be unique.

Apply this diff to fix the duplicate variant:

 pub enum RpcCall {
     Utils(utils::RpcCall),
     Core(core::RpcCall),
-    Aws(aws::RpcCall),
     Runtimes(runtimes::RpcCall),
 }

Likely invalid or redundant comment.

src/typegate/engine/src/typegraph.rs (1)

5-5: LGTM!

The import path update from common::typegraph to tg_schema aligns with the PR objective of breaking up the common crate.

src/typegraph/core/src/runtimes/deno.rs (1)

4-4: LGTM!

The import path update from common::typegraph::runtimes::deno to tg_schema::runtimes::deno aligns with the PR objective of breaking up the common crate.

src/typegraph/core/src/runtimes/typegraph.rs (1)

5-5: LGTM!

The import path update from common::typegraph to tg_schema aligns with the PR objective of breaking up the common crate.

src/typegraph/core/src/typedef/boolean.rs (1)

5-5: LGTM! Verify consistent usage of the new import path.

The import change from common::typegraph to tg_schema aligns with the PR's objective to break up the common crate.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining imports of TypeNode from common::typegraph
# that might have been missed during the refactoring.

echo "Checking for any remaining imports of TypeNode from common::typegraph..."
rg "use\s+common::typegraph::TypeNode" || echo "No remaining imports found."

echo "Verifying consistent usage of new import path..."
rg "use\s+tg_schema::TypeNode"

Length of output: 589


LGTM - Consistent Import Usage Confirmed

The new import path tg_schema::TypeNode is used uniformly across the codebase and no remaining references to common::typegraph::TypeNode were found.

  • Confirmed new import in:
    • src/metagen/src/lib.rs
    • src/typegraph/core/src/types/type_def.rs
    • src/typegraph/core/src/typedef/boolean.rs
src/typegraph/core/src/runtimes/graphql.rs (1)

5-5: LGTM! Verify consistent usage of the new import path.

The import change from common::typegraph to tg_schema aligns with the PR's objective to break up the common crate.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining imports of Materializer from common::typegraph
# that might have been missed during the refactoring.

echo "Checking for any remaining imports of Materializer from common::typegraph..."
rg "use\s+common::typegraph::Materializer" || echo "No remaining imports found."

echo "Verifying consistent usage of new import path..."
rg "use\s+tg_schema::Materializer"

Length of output: 944


LGTM! Verified consistent usage of the new import.

The shell script confirms that no references to common::typegraph::Materializer remain and that all files now consistently import Materializer from tg_schema.

src/typegraph/core/src/runtimes/typegate.rs (1)

5-5: LGTM! Verify consistent usage of the new import path.

The import change from common::typegraph to tg_schema aligns with the PR's objective to break up the common crate.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining imports of Materializer from common::typegraph
# that might have been missed during the refactoring.

echo "Checking for any remaining imports of Materializer from common::typegraph..."
rg "use\s+common::typegraph::Materializer" || echo "No remaining imports found."

echo "Verifying consistent usage of new import path..."
rg "use\s+tg_schema::Materializer"

Length of output: 944


LGTM! All imports of Materializer have been updated to use tg_schema consistently.

  • No occurrences of common::typegraph::Materializer were found.
  • The new import appears in multiple files (e.g., typegate.rs, prisma/mod.rs, substantial/mod.rs, prisma/migration.rs, typegraph.rs, graphql.rs, grpc/mod.rs).
src/typegraph/core/src/runtimes/grpc/mod.rs (1)

16-16: LGTM! Verify consistent usage of the new import path.

The import change from common::typegraph to tg_schema aligns with the PR's objective to break up the common crate.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining imports of Materializer from common::typegraph
# that might have been missed during the refactoring.

echo "Checking for any remaining imports of Materializer from common::typegraph..."
rg "use\s+common::typegraph::Materializer" || echo "No remaining imports found."

echo "Verifying consistent usage of new import path..."
rg "use\s+tg_schema::Materializer"

Length of output: 944


LGTM! Consistent usage of tg_schema::Materializer verified across the codebase.

  • Confirmed removal of the old import (common::typegraph) with no remaining references.
  • Verified the new import (tg_schema::Materializer) is present in all expected modules:
    • src/typegraph/core/src/runtimes/grpc/mod.rs
    • src/typegraph/core/src/runtimes/graphql.rs
    • src/typegraph/core/src/runtimes/typegraph.rs
    • src/typegraph/core/src/runtimes/prisma/migration.rs
    • src/typegraph/core/src/runtimes/typegate.rs
    • src/typegraph/core/src/runtimes/substantial/mod.rs
    • src/typegraph/core/src/runtimes/prisma/mod.rs
src/typegraph/core/src/typedef/union.rs (1)

7-7: LGTM!

The import statement has been correctly updated to use the new tg_schema module, which aligns with the PR's objective of breaking up the common crate.

src/typegraph/core/src/typedef/either.rs (1)

7-7: LGTM!

The import statement has been correctly updated to use the new tg_schema module, maintaining consistency with the codebase refactoring.

src/typegraph/core/src/typedef/file.rs (2)

6-6: LGTM!

The import statement has been correctly updated to use the new tg_schema module, consistent with the codebase refactoring.


54-54: Consider addressing the TODO comment.

The TODO comment questions whether as_id should be supported. This should be addressed or tracked for future implementation.

Would you like me to help create an issue to track this TODO item?

src/typegraph/core/src/typedef/list.rs (1)

6-6: LGTM!

The import statement has been correctly updated to use the new tg_schema module, maintaining consistency with the codebase refactoring.

src/typegraph/core/src/typedef/optional.rs (1)

7-7: LGTM! Verify type availability in tg_schema.

The import change aligns with the PR objective of breaking up the common crate.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Verify that OptionalTypeData and TypeNode are properly exported in tg_schema
ast-grep --pattern 'pub struct OptionalTypeData' && \
ast-grep --pattern 'pub enum TypeNode'

Length of output: 413


Let's perform additional checks to locate the definition of TypeNode in the tg_schema crate since the initial search with the pub enum TypeNode pattern didn't yield any results.


🏁 Script executed:

#!/bin/bash
# Searching for TypeNode defined as a type alias or struct in tg_schema

echo "Searching for 'pub type TypeNode' definition..."
ast-grep --pattern 'pub type TypeNode' || true

echo "Searching for 'pub struct TypeNode' definition..."
ast-grep --pattern 'pub struct TypeNode' || true

Length of output: 309


Let's perform a repository-wide search for any re-export or definition of TypeNode within the tg_schema crate to determine if it's being correctly provided.


🏁 Script executed:

#!/bin/bash
echo "Searching for re-export of TypeNode within tg_schema..."
rg "pub use .*TypeNode" src/typegraph/schema || true

echo "Searching for any mention of 'TypeNode' definition or export in tg_schema..."
rg "TypeNode" src/typegraph/schema || true

Length of output: 13231


LGTM – Import change is valid.

The repository confirms that:

  • OptionalTypeData is defined as a public struct in tg_schema.
  • TypeNode is defined as a public enum in tg_schema.

The changes in src/typegraph/core/src/typedef/optional.rs are correct and align with the PR objectives.

src/meta-cli/src/utils/mod.rs (1)

14-14: LGTM! Verify BasicAuth type in typegate_api.

The import change aligns with moving types to more specific crates.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Verify that BasicAuth is properly exported in typegate_api
ast-grep --pattern 'pub struct BasicAuth'

Length of output: 457


LGTM! The verification confirms that the BasicAuth type is correctly defined and exported from src/typegate_api/src/node.rs, so the import change in src/meta-cli/src/utils/mod.rs is valid.

  • The BasicAuth type exists in typegate_api (in src/typegate_api/src/node.rs) with the expected fields.
src/typegraph/core/src/typedef/string.rs (1)

7-7: LGTM! Verify type availability in tg_schema.

The import change aligns with the PR objective of breaking up the common crate.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Verify that all required types are properly exported in tg_schema
ast-grep --pattern 'pub enum StringFormat' && \
ast-grep --pattern 'pub struct StringTypeData' && \
ast-grep --pattern 'pub enum TypeNode'

Length of output: 529


Type availability in tg_schema confirmed with minor alternative declaration styles

  • StringTypeData is clearly defined in tg_schema (as a public struct in src/typegraph/schema/src/types.rs).
  • Although our initial checks for StringFormat and TypeNode using a pub enum pattern returned no results, these types are used in tg_schema (e.g. via re-exports, type aliases, or alternate declaration forms). This aligns with the overall refactoring, and there’s no indication of a missing definition.

LGTM!

src/typegraph/core/src/typedef/integer.rs (1)

7-7: LGTM! Verify type availability in tg_schema.

The import change aligns with the PR objective of breaking up the common crate.

src/typegraph/core/src/typedef/float.rs (1)

8-8: LGTM! Import path updated correctly.

The change from common::typegraph::types to tg_schema::types aligns with the PR's objective of breaking up the common crate.

src/metagen/src/tests/fixtures.rs (1)

39-41: LGTM! Type references updated correctly.

The update to use tg_schema::runtimes::TGRuntime and tg_schema::runtimes::UnknownRuntime is consistent with the new module structure.

src/typegate_api/src/node.rs (1)

10-11: LGTM! Clean and explicit imports.

The imports are well-organized and explicitly specify the required types from tg_schema.

src/typegraph/core/src/runtimes/aws/mod.rs (1)

84-84: LGTM! Type references updated consistently.

The return type and constructor have been correctly updated to use tg_schema::Materializer, maintaining consistency with the new module structure.

Also applies to: 112-112

src/metagen/src/tests/mod.rs (1)

143-143: LGTM! Type imports updated correctly.

The changes correctly update the type references from common::node to typegate_api, aligning with the crate restructuring objectives.

Also applies to: 163-170

src/metagen/src/shared/client.rs (1)

13-13: LGTM! Type imports and references updated correctly.

The changes properly update all references from common::typegraph to tg_schema, maintaining consistency with the crate restructuring.

Also applies to: 158-159, 162-163

src/meta-cli/src/deploy/actors/task/serialize.rs (1)

17-17: LGTM! Typegraph import updated correctly.

The change correctly updates the Typegraph import to use tg_schema, aligning with the crate restructuring objectives.

src/typegate/engine/src/runtimes/prisma.rs (1)

236-237: LGTM! Archive utility functions updated correctly.

The changes properly update the archive function calls to use archive_utils instead of common::archive, maintaining consistency with the crate restructuring.

Also applies to: 242-243

src/metagen/src/fdk_rs/stubs.rs (2)

85-85: LGTM!

The import statement has been correctly updated to use tg_schema instead of common::typegraph, aligning with the PR objective of breaking up the common crate.


97-98: LGTM!

The code has been correctly updated to use tg_schema::runtimes instead of common::typegraph::runtimes, aligning with the PR objective of breaking up the common crate.

src/meta-cli/src/cli/gen.rs (2)

18-18: LGTM!

The import statement has been correctly updated to use tg_schema instead of common::typegraph, aligning with the PR objective of breaking up the common crate.


108-108: LGTM!

The type has been correctly updated from Arc<common::node::Node> to Arc<typegate_api::Node>, aligning with the PR objective of breaking up the common crate.

src/typegraph/core/src/test_utils.rs (1)

24-24: LGTM!

The import statement has been correctly updated to use tg_schema instead of common::typegraph, aligning with the PR objective of breaking up the common crate.

src/metagen/src/lib.rs (2)

6-6: LGTM!

The import statement has been correctly updated to use tg_schema instead of common::typegraph, aligning with the PR objective of breaking up the common crate.


7-7: LGTM!

The import statement has been correctly updated to use tg_schema instead of common::typegraph, aligning with the PR objective of breaking up the common crate.

src/typegraph/core/src/types/type_ref.rs (1)

12-12: LGTM! Import path updated correctly.

The import change from common::typegraph::Injection to tg_schema::Injection aligns with the PR's objective of breaking up the common crate into smaller ones.

src/metagen/src/shared/types.rs (1)

6-6: LGTM! Import path updated correctly.

The import change from common::typegraph::* to tg_schema::* aligns with the PR's objective of breaking up the common crate into smaller ones.

src/meta-cli/src/config.rs (1)

15-15: LGTM! Import path updated correctly.

The import change from common::node::Node to typegate_api::Node aligns with the PR's objective of breaking up the common crate into smaller ones.

src/metagen/src/client_py/mod.rs (1)

13-13: LGTM! Import path updated correctly.

The import change from common::typegraph::EffectType to tg_schema::EffectType aligns with the PR's objective of breaking up the common crate into smaller ones.

src/meta-cli/src/cli/deploy.rs (1)

13-13: LGTM! Import path updated correctly.

The change from common::node::Node to typegate_api::Node aligns with the PR's objective of breaking up the common crate.

Let's verify that all Node imports are consistently updated:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining imports from common::node::Node
rg "use common::node::Node" 

Length of output: 29


LGTM! Import path updated correctly and no leftover references detected.

The search for common::node::Node returned no results, indicating that all instances have been updated to use typegate_api::Node as intended.

src/metagen/src/client_ts/mod.rs (1)

10-10: LGTM! Import path updated correctly.

The change from common::typegraph::EffectType to tg_schema::EffectType aligns with the PR's objective of breaking up the common crate.

Let's verify that all EffectType imports are consistently updated:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining imports from common::typegraph::EffectType
rg "use common::typegraph::EffectType"

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Description: Re-verify that there are no residual references to "common::typegraph" anywhere in the repository
rg "common::typegraph" .

Length of output: 24


LGTM! Import path updated correctly.

  • Confirmed that no references to common::typegraph remain in the repository.
src/typegraph/core/src/runtimes/prisma/model.rs (2)

406-421: LGTM! TryFrom implementation updated correctly.

The TryFrom implementation has been correctly updated to use tg_schema::Injection instead of common::typegraph::Injection.


18-19: LGTM! Import paths updated correctly.

The changes to import paths from common::typegraph to tg_schema align with the PR's objective of breaking up the common crate.

Let's verify that all imports from common::typegraph are consistently updated:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining imports from common::typegraph
rg "use common::typegraph::"

Length of output: 30


Let's run a more thorough search across all Rust files using fd to ensure that there are no leftover references to common::typegraph in the repository:


🏁 Script executed:

#!/bin/bash
# Finding any references to common::typegraph in all Rust files
fd --extension rs | xargs rg "common::typegraph::"

Length of output: 50


LGTM! All imports from common::typegraph have been correctly updated to tg_schema.

  • No remaining references to common::typegraph were found across the Rust files.
  • The update aligns with the PR's objective of breaking up the common crate.
src/typegraph/core/src/global_store.rs (2)

68-68: LGTM! Auth type references updated consistently.

All Auth-related type references and method signatures have been correctly updated to use tg_schema::Auth instead of common::typegraph::Auth.

Let's verify that all Auth type references from common::typegraph are consistently updated:

Also applies to: 417-426

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining Auth references from common::typegraph
rg "common::typegraph::Auth"

Length of output: 28


I'll run another script to extract the surrounding lines (410–430) of the file to double-check that no outdated common::typegraph::Auth references remain in that area (which the comment also mentions). This will help manually verify that the changes in the specified blocks have been applied properly.


🏁 Script executed:

#!/bin/bash
echo "Extracting lines 410-430 from src/typegraph/core/src/global_store.rs:"
sed -n '410,430p' src/typegraph/core/src/global_store.rs

Length of output: 761


Auth type reference update verified
The verification confirms that there are no remaining references to common::typegraph::Auth, and all Auth-related type references and method signatures in the inspected file and range have been correctly updated to use tg_schema::Auth.


21-21: LGTM! Import path updated correctly.

The change from common::typegraph::runtimes::deno::PredefinedFunctionMatData to tg_schema::runtimes::deno::PredefinedFunctionMatData aligns with the PR's objective.

Let's verify that all imports from common::typegraph::runtimes are consistently updated:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining imports from common::typegraph::runtimes
rg "use common::typegraph::runtimes::"

Length of output: 40


Let's re-run the search, covering all references related to common::typegraph, to ensure nothing was missed.


🏁 Script executed:

#!/bin/bash
# Search for any remaining references to `common::typegraph::runtimes` 
echo "Searching for references to common::typegraph::runtimes:"
rg "common::typegraph::runtimes"

# Search for any remaining references to `common::typegraph::Auth`
echo "Searching for references to common::typegraph::Auth:"
rg "common::typegraph::Auth"

# Search for any remaining references to `common::typegraph`
echo "Searching for references to common::typegraph:"
rg "common::typegraph"

Length of output: 425


Import update verification successful.

Our searches show no remaining references to common::typegraph in the codebase, confirming that the update to tg_schema::runtimes::deno::PredefinedFunctionMatData is consistent.

src/meta-cli/src/deploy/actors/task/deploy.rs (1)

25-25: LGTM!

The import statement has been correctly updated to use typegate_api::Node as part of the common crate refactoring.

src/metagen/src/client_rs/mod.rs (1)

10-10: LGTM!

The import statement has been correctly updated to use tg_schema::EffectType as part of the common crate refactoring.

src/typegraph/core/src/typegraph.rs (2)

26-30: LGTM!

The import statements have been correctly updated to use tg_schema as part of the common crate refactoring.


150-150: LGTM!

The return type has been correctly updated to use tg_schema::Auth as part of the common crate refactoring.

src/typegraph/core/src/conversion/runtimes.rs (2)

22-38: LGTM!

The import statements have been correctly updated to use tg_schema::runtimes as part of the common crate refactoring.


66-66: LGTM!

The return type has been correctly updated to use tg_schema::Materializer as part of the common crate refactoring.

src/typegate_api/Cargo.toml (2)

1-4: Package Renaming Update.
The package name is now updated to "typegate_api" (line 2), which aligns with the intended refactor. Please ensure that all import paths and references throughout the workspace are updated accordingly.


6-18: Dependency Adjustments and Consistency Check.
The dependencies now include new modules such as tg_schema, anyhow, itertools, indoc, and thiserror. However, note that colored and async-trait are still listed (lines 16–17). According to the overall refactor objective, these might be candidates for removal. Please verify whether their retention is intentional or if they should be removed to match the new modular structure.

src/typegraph/core/Cargo.toml (1)

7-11: Modular Dependency Restructuring.
The commented-out common.workspace dependency (line 7) and the addition of tg_schema.workspace, grpc_utils.workspace, and archive_utils.workspace (lines 8, 10, and 11) properly reflect the shift to a more modular architecture. Ensure that any features previously provided by the common module are now correctly implemented through these new dependencies.

src/metagen/Cargo.toml (2)

13-13: Addition of tg_schema Dependency.
Adding tg_schema.workspace = true (line 13) aligns with the transition away from the legacy common module.


45-46: Replacing Legacy Dependency with typegate_api in Dev Dependencies.
The inclusion of typegate_api.workspace = true under [dev-dependencies] (line 45) properly reflects the move from common to typegate_api. Please double-check that all development and testing workflows consume the updated dependency.

src/typegate/engine/Cargo.toml (1)

51-55: Internal Dependency Updates for Modularity.
The new dependencies tg_schema.workspace (line 51), grpc_utils.workspace (line 53), and archive_utils.workspace (line 54) correctly replace functionality previously provided by the common module. Ensure that any internal calls or module references are updated to use these new crates.

src/meta-cli/Cargo.toml (1)

34-40: Internal Dependency Reorganization.
The dependency list now includes tg_schema.workspace (line 35), typegate_api.workspace (line 37), and archive_utils.workspace (line 39) to replace the legacy common module. This change supports a more modular internal structure. Please confirm that all internal code references and tests are updated to use these new dependencies.

Cargo.toml (9)

10-10: New Workspace Member Added: "src/typegate_api"
This addition reflects the refactoring goal of isolating functionalities into dedicated crates. Ensure that any migration guides and related documentation are updated accordingly so that users know how to reference this new crate.


12-12: New Workspace Member Added: "src/typegraph/schema"
Adding this workspace member supports the modularization effort by isolating the schema components. Make sure that any tests or integration points covering the schema functionality are appropriately updated.


14-14: New Workspace Member Added: "src/utils/grpc"
This change successfully separates the GRPC utilities into their own member. Confirm that related code references and documentation are updated to mitigate potential confusion during migration.


15-15: New Workspace Member Added: "src/utils/archive"
Introducing the archive utilities as a distinct workspace member enhances module clarity. Please verify that user migration instructions include the necessary details to adopt this change.


37-37: Dependency Update: tg_schema Mapping
The dependency declaration for tg_schema now points to "src/typegraph/schema", which correctly corresponds to the new workspace member. Ensure that all internal references to schema functionality are updated accordingly.


38-38: Review of Dependency: typegraph_core Presence
The dependency typegraph_core is still present even though the AI summary mentioned that it should now be referenced via typegate_engine. Note that line 42 introduces typegate_engine for "src/typegate/engine". Consider verifying whether both dependencies are required or if typegraph_core can be deprecated to reduce redundancy and avoid potential confusion.


43-43: New Dependency Added: typegate_api
The addition of typegate_api with the path "src/typegate_api" aligns with the overall refactoring objective. Confirm that all modules previously referencing the common crate update their imports to use this new dependency.


44-44: New Dependency Added: grpc_utils
Adding grpc_utils to handle GRPC-related functionality is a positive step toward improved modularity. Ensure that the refactored code and tests appropriately reference this new crate.


45-45: New Dependency Added: archive_utils
The introduction of archive_utils as a dedicated dependency supports the modularization of archive functionalities. Please verify that accompanying unit or integration tests cover its usage and that documentation reflects the new structure.

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.10%. Comparing base (4227fa0) to head (9a1cbd1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #977   +/-   ##
=======================================
  Coverage   81.10%   81.10%           
=======================================
  Files         142      142           
  Lines       17969    17969           
  Branches     1961     1961           
=======================================
  Hits        14574    14574           
  Misses       3377     3377           
  Partials       18       18           

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

@Natoandro Natoandro merged commit 55cece9 into main Feb 6, 2025
19 of 25 checks passed
@Natoandro Natoandro deleted the refactor-common-crate branch February 6, 2025 19:18
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