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(SDK): Artifact upload fails when same file referred multiple times #715

Merged
merged 11 commits into from
May 15, 2024

Conversation

destifo
Copy link
Contributor

@destifo destifo commented May 12, 2024

  • fix the bug where duplicate artifact references causing failure during artifact resolution(typegate) during runtime.
  • add sync mode tests for Python and Deno runtime.
  • add other edge test cases to artifact upload.
    • test for no artifact in typegraph
    • test for duplicate artifact reference in the same typegraph

Issue: MET-501

Migration notes

No Migrations Needed

...

Summary by CodeRabbit

  • New Features

    • Introduced testing functionalities for Deno and Python runtimes, supporting artifact deployment and policy enforcement.
    • Added Python and Deno scripts for deploying Typegraphs and handling runtime configurations.
  • Bug Fixes

    • Improved artifact handling and deployment logic in both Python and Deno runtimes.
  • Tests

    • Added comprehensive test cases for Deno and Python runtimes, including scenarios for duplicate artifacts, no artifacts, and runtime synchronization.
    • Enhanced testing with integration of various services like Redis and S3.
  • Documentation

    • Updated test scripts to include detailed comments and summaries for new functionalities and test scenarios.

@destifo destifo self-assigned this May 12, 2024
@destifo destifo changed the title fix(SDK): Artifact upload fails when same file refered twice fix(SDK): Artifact upload fails when same file referred multiple times May 12, 2024
Base automatically changed from polish to main May 14, 2024 11:04
Copy link
Contributor

coderabbitai bot commented May 14, 2024

Walkthrough

The recent changes introduce and enhance functionalities for testing Deno and Python runtimes within the TypeGraph framework. This involves adding new scripts for handling artifact deployments, defining policies, and setting up runtime environments. Additionally, several test cases have been implemented to ensure the proper functioning of these features, including scenarios for no artifacts, duplicate artifacts, and runtime synchronization.

Changes

Files Change Summary
typegate/tests/runtimes/deno/deno_duplicate_artifact.py Introduced deno_duplicate_artifact function for setting up and deploying artifacts in Deno runtime.
typegate/tests/runtimes/deno/deno_duplicate_artifact.ts Added denoDuplicateArtifact function for handling duplicate artifact imports and deployments in Deno.
typegate/tests/runtimes/deno/deno_no_artifact.py Added deno_no_artifact function for deploying Typegraph in Deno without artifacts.
typegate/tests/runtimes/deno/deno_sync_test.ts Introduced tests for Deno runtime, covering setup, teardown, network access, and various deployment scenarios.
typegate/tests/runtimes/deno/deno_test.ts Added tests for Deno runtime with Python SDK focusing on no artifacts and duplicate artifacts scenarios.
typegate/tests/runtimes/python/python_duplicate_artifact.py Added python_duplicate_artifact function for importing modules and deploying artifacts in Python runtime.
typegate/tests/runtimes/python/python_duplicate_artifact.ts Introduced tgDuplicateArtifact for defining and exposing Python artifacts with policies.
typegate/tests/runtimes/python/python_no_artifact.py Added python_no_artifact function for deploying Typegraph in Python without artifacts.
typegate/tests/runtimes/python/python_no_artifact.ts Defined identityLambda and identityDef functions for identity transformations in Python runtime.
typegate/tests/runtimes/python/python_sync_test.ts Introduced tests for Python runtime synchronization, covering artifact uploads, multiple instances, and various deployment scenarios.
typegate/tests/runtimes/python/python_test.ts Added and modified tests for Python runtime focusing on no artifacts and duplicate artifact uploads.
typegraph/core/src/utils/postprocess/python_rt.rs Modified PythonProcessor logic for handling artifacts and dependencies.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 5db3ef8 and d93b912.
Files selected for processing (12)
  • typegate/tests/runtimes/deno/deno_duplicate_artifact.py (1 hunks)
  • typegate/tests/runtimes/deno/deno_duplicate_artifact.ts (1 hunks)
  • typegate/tests/runtimes/deno/deno_no_artifact.py (1 hunks)
  • typegate/tests/runtimes/deno/deno_sync_test.ts (1 hunks)
  • typegate/tests/runtimes/deno/deno_test.ts (1 hunks)
  • typegate/tests/runtimes/python/python_duplicate_artifact.py (1 hunks)
  • typegate/tests/runtimes/python/python_duplicate_artifact.ts (1 hunks)
  • typegate/tests/runtimes/python/python_no_artifact.py (1 hunks)
  • typegate/tests/runtimes/python/python_no_artifact.ts (1 hunks)
  • typegate/tests/runtimes/python/python_sync_test.ts (1 hunks)
  • typegate/tests/runtimes/python/python_test.ts (2 hunks)
  • typegraph/core/src/utils/postprocess/python_rt.rs (2 hunks)
Additional comments not posted (24)
typegate/tests/runtimes/python/python_no_artifact.ts (1)

1-34: LGTM! The typegraph definition for Python runtime without artifacts is clear and follows best practices.

typegate/tests/runtimes/deno/deno_duplicate_artifact.ts (1)

1-33: LGTM! The typegraph definition for Deno runtime with duplicate artifact references is clear and follows best practices.

typegate/tests/runtimes/python/python_duplicate_artifact.ts (1)

1-39: LGTM! The typegraph definition for Python runtime with duplicate artifact references is clear and follows best practices.

typegate/tests/runtimes/deno/deno_no_artifact.py (1)

1-59: LGTM! The typegraph definition for Deno runtime without artifacts is clear and follows best practices.

typegate/tests/runtimes/python/python_no_artifact.py (1)

1-58: LGTM! The typegraph definition for Python runtime without artifacts is clear and follows best practices.

typegate/tests/runtimes/python/python_duplicate_artifact.py (1)

1-67: LGTM! The typegraph definition for Python runtime with duplicate artifact references is clear and follows best practices.

typegate/tests/runtimes/deno/deno_duplicate_artifact.py (1)

1-68: LGTM! The typegraph definition for Deno runtime with duplicate artifact references is clear and follows best practices.

typegraph/core/src/utils/postprocess/python_rt.rs (1)

Line range hint 10-66: LGTM! The modifications to the PythonProcessor implementation are clear and follow best practices.

typegate/tests/runtimes/deno/deno_test.ts (2)

406-428: Test case for "Deno runtime - Python SDK: with no artifacts in sync mode" looks good.


453-477: Test case for "Deno runtime - Python SDK: with duplicate artifacts in sync mode" looks good.

typegate/tests/runtimes/deno/deno_sync_test.ts (4)

65-155: Test case for "Deno runtime - Python SDK: in sync mode" looks good.


158-199: Test case for "Deno runtime - Python SDK: file name reloading in sync mode" looks good.


201-229: Test case for "Deno runtime - Python SDK: use local imports in sync mode" looks good.


503-533: Test case for "Deno runtime - Python SDK: with no artifacts in sync mode" looks good.

typegate/tests/runtimes/python/python_test.ts (2)

439-466: Test case for "PythonRuntime - Python SDK: typegraph with no artifacts in sync mode" looks good.


527-556: Test case for "Python Runtime - Python SDK: typegraph with duplicate artifact uploads" looks good.

typegate/tests/runtimes/python/python_sync_test.ts (8)

68-161: The test case for "Python Runtime typescript SDK: with Sync Config" is comprehensive and well-structured. Ensure that the cleanUp function is robust, as suggested earlier.


163-260: The test case for "Python runtime: sync mode" is thorough and covers various query operations. Ensure that the cleanUp function is robust, as suggested earlier.


263-301: The test case for "Python runtime: multiple typegate instances sync mode" is well-structured and covers the necessary scenarios. Ensure that the cleanUp function is robust, as suggested earlier.


303-375: The test case for "Deno: def, lambda in sync mode" is comprehensive and well-structured. Ensure that the cleanUp function is robust, as suggested earlier.


378-406: The test case for "Python: infinite loop or similar in sync mode" is well-structured and covers the necessary scenarios. Ensure that the cleanUp function is robust, as suggested earlier.


408-491: The test case for "Python: typegate reloading in sync mode" is comprehensive and well-structured. Ensure that the cleanUp function is robust, as suggested earlier.


494-528: The test case for "PythonRuntime - Python SDK: typegraph with no artifacts in sync mode" is well-structured and covers the necessary scenarios. Ensure that the cleanUp function is robust, as suggested earlier.


596-632: The test case for "Python - Python SDK: typegraph with duplicate artifact uploads in sync mode" is well-structured and covers the necessary scenarios. Ensure that the cleanUp function is robust, as suggested earlier.


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

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration 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
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: 5

Out of diff range and nitpick comments (4)
typegate/tests/runtimes/python/python_sync_test.ts (4)

4-13: Ensure all imported modules are necessary and used in the code.

Consider removing any unused imports to keep the code clean and maintainable.


16-18: Consider adding comments to explain the purpose of these constants.

Adding comments can improve code readability and maintainability.


31-48: The syncConfig object is well-defined, but consider adding comments to explain each section.

Adding comments can help future developers understand the configuration more easily.


530-594: Consider removing the commented-out test cases if they are no longer needed.

Keeping commented-out code can clutter the codebase. If these tests are not required, it's better to remove them.

Copy link

codecov bot commented May 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.05%. Comparing base (5db3ef8) to head (d93b912).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #715      +/-   ##
==========================================
+ Coverage   73.85%   74.05%   +0.19%     
==========================================
  Files         120      120              
  Lines       13777    13777              
  Branches     1393     1408      +15     
==========================================
+ Hits        10175    10202      +27     
+ Misses       3576     3549      -27     
  Partials       26       26              

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

@destifo destifo merged commit bbdfd35 into main May 15, 2024
14 checks passed
@destifo destifo deleted the test/artifact-tests branch May 15, 2024 09:17
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.

None yet

3 participants