Skip to content

feat: upgrade script from 0.4.10 to 0.5.0 #941

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

Merged
merged 20 commits into from
Jan 16, 2025
Merged

Conversation

Natoandro
Copy link
Contributor

@Natoandro Natoandro commented Dec 16, 2024

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

Release Notes v0.5.0

Version Highlights

  • Transitioned from release candidate (0.5.0-rc.9) to stable release (0.5.0)
  • Updated Typegraph version to 0.0.4

New Features

  • Added support for namespaces in TypeMeta struct
  • Enhanced version management and validation processes
  • Introduced new configuration module for synchronization processes
  • Added asynchronous function for downloading CLI tools
  • New test suite for validating SDK functionality
  • New end-to-end test for Typegate upgrade process

Improvements

  • Refined environment configuration management
  • Updated SDK and runtime configurations across multiple platforms
  • Improved error handling in version upgrade processes
  • Enhanced logging and output precision in test results

Breaking Changes

  • Removed METATYPE_VERSION constant
  • Modified version constants and import paths
  • Updated type definitions in some modules

Compatibility

  • Compatible with Deno, Node.js, and Python runtimes
  • Supports latest SDK and CLI versions

Upgrade Recommendations

  • Recommended to update all dependencies to 0.5.0
  • Review and adjust any custom configurations

Copy link

linear bot commented Dec 16, 2024

@Natoandro Natoandro force-pushed the met-774-typegraph-upgrade branch from e0626e6 to 1ac6397 Compare December 27, 2024 08:26
j03-dev and others added 4 commits December 27, 2024 14:50
Add python code validation on deploy

---

- [x] The change comes with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
# Conflicts:
#	deno.lock
#	tests/e2e/published/published_test.ts
Copy link
Contributor

coderabbitai bot commented Jan 11, 2025

📝 Walkthrough

Walkthrough

This pull request represents a comprehensive version update from 0.5.0-rc.9 to 0.5.0 across multiple components of the project. The changes span various files and configurations, including version updates in Cargo.toml, pyproject.toml, package.json, and other configuration files. The update involves modifying version constants, environment variables, and SDK references to reflect the transition from a release candidate to a stable version. Additionally, some minor structural changes were made, such as adding a namespaces field to the TypeMeta struct and updating import paths.

Changes

File Change Summary
.ghjk/lock.json Updated version numbers and environment keys for multiple tasks
Cargo.toml Updated workspace package version to 0.5.0
examples/**/compose.yml Updated Typegate image version to v0.5.0
examples/**/package.json Updated SDK dependency version to ^0.5.0
examples/**/pyproject.toml Updated project and dependency versions to 0.5.0
ghjk.ts Modified version-related constants and tasks
src/common/typegraph/mod.rs Added namespaces field to TypeMeta struct
src/typegate/src/typegraph/versions.ts Updated typegraph version to 0.0.4
tools/consts.ts Replaced version constants with new versioning approach
tests/e2e/published/common.ts Added downloadSteps function for handling test downloads
tests/e2e/published/config.ts Introduced configuration module for synchronization processes
tests/e2e/published/sdk_test.ts New test suite for published SDKs
tests/e2e/published/typegate_upgrade_test.ts New test for validating Typegate upgrade process

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Repo as Repository
    participant Build as Build System
    participant Version as Version Management

    Dev->>Repo: Prepare release
    Repo->>Version: Update version constants
    Version-->>Repo: Confirm version updates
    Repo->>Build: Trigger build with new version
    Build->>Build: Update version in multiple files
    Build->>Repo: Commit version changes
    Dev->>Repo: Review and merge changes
Loading

Possibly related PRs

Suggested reviewers

  • michael-0acf4
  • Yohe-Am
  • zifeo

Finishing Touches

  • 📝 Generate Docstrings (Beta)

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 marked this pull request as ready for review January 13, 2025 09:25
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: 7

🧹 Nitpick comments (14)
tests/e2e/published/sdk_test.ts (2)

100-175: Refactor to reduce code duplication in test cases

The test cases for npm_jsr, deno_jsr, and pypa (lines 100-175) contain similar setup and deployment logic. Consider refactoring these sections to use shared functions or loops to reduce code duplication and improve maintainability.


177-177: Consider graceful termination of the spawned process

Using proc.kill("SIGKILL") forcefully terminates the process, which might prevent proper cleanup or release of resources. Consider terminating the process gracefully using SIGTERM or implementing a shutdown mechanism within the process to handle termination signals.

tests/e2e/published/common.ts (1)

34-34: Address the FIXME: Implement caching across test runs

There's a FIXME comment indicating the need to cache the cloned repository across test runs. Implementing caching can significantly reduce test execution time by avoiding redundant downloads.

Do you want me to help implement a caching mechanism to improve test performance?

tests/e2e/published/config.ts (1)

18-36: Reduce code duplication between config function and Config class.

The configuration logic is duplicated between the config function and Config class constructor.

Consider refactoring to share the common logic:

+ function createSyncConfig(redisDb: number, s3Bucket: string) {
+   const syncEnvs = {
+     SYNC_REDIS_URL: `redis://:password@localhost:6379/${redisDb}`,
+     SYNC_S3_BUCKET: s3Bucket,
+     ...defaultSyncEnvs,
+   };
+   const syncConfig = transformSyncConfig({
+     redis_url: new URL(syncEnvs.SYNC_REDIS_URL),
+     s3_host: new URL(syncEnvs.SYNC_S3_HOST),
+     s3_region: syncEnvs.SYNC_S3_REGION,
+     s3_access_key: syncEnvs.SYNC_S3_ACCESS_KEY,
+     s3_secret_key: syncEnvs.SYNC_S3_SECRET_KEY,
+     s3_bucket: syncEnvs.SYNC_S3_BUCKET,
+     s3_path_style: true,
+     force_remove: false,
+   });
+   return { syncConfig, syncEnvs };
+ }

  export function config(p: { redisDb: number; s3Bucket: string }) {
-   const syncEnvs = {
-     SYNC_REDIS_URL: `redis://:password@localhost:6379/${p.redisDb}`,
-     SYNC_S3_BUCKET: p.s3Bucket,
-     ...defaultSyncEnvs,
-   };
-   const syncConfig = transformSyncConfig({...});
-   return { syncConfig, syncEnvs };
+   return createSyncConfig(p.redisDb, p.s3Bucket);
  }

  export class Config {
    syncEnvs: Record<string, string>;
    syncConfig: ReturnType<typeof transformSyncConfig>;

    constructor(redisDb: number, s3Bucket: string) {
-     this.syncEnvs = {...};
-     this.syncConfig = transformSyncConfig({...});
+     const config = createSyncConfig(redisDb, s3Bucket);
+     this.syncEnvs = config.syncEnvs;
+     this.syncConfig = config.syncConfig;
    }
    // ...
  }

Also applies to: 38-67

tools/tasks/lock.ts (1)

63-87: Enhance error messages in version validation.

The version validation logic is solid, but the error messages could be more descriptive to help users understand and fix version-related issues.

Consider enhancing the error messages with more context:

  assert(
    semver.greaterThan(currentVersion, latestRelease),
-   "expected current version to be greater than latest release version",
+   `Current version ${currentVersion} must be greater than latest release ${latestRelease}`,
  );

  if (isPreRelease) {
    assert(
      semver.greaterThan(currentVersion, latestPreRelease!),
-     "expected current version to be greater than latest pre-release version",
+     `Current pre-release ${currentVersion} must be greater than latest pre-release ${latestPreRelease}`,
    );
  }
tests/e2e/published/utils.ts (1)

16-32: Enhance error handling in checkMetaBin.

The function catches all errors and only logs them. Consider:

  1. Differentiating between expected errors (version mismatch) and unexpected ones
  2. Adding more context to the error message
 async function checkMetaBin(path: typeof tempDir, version: string) {
   try {
     if (!(await path.exists())) {
       return false;
     }
     const res = await $`bash -c 'meta-old --version'`
       .env("PATH", `${path.parent()!.toString()}:${Deno.env.get("PATH")}`)
       .stdout("piped");
     if (res.stdout.includes(version)) {
       return true;
     }
-    throw new Error(`version mismatch: ${res.stdout}`);
+    throw new Error(`CLI version mismatch: expected ${version}, got ${res.stdout.trim()}`);
   } catch (e) {
-    console.error(e);
+    if (e instanceof Error && e.message.startsWith('CLI version mismatch')) {
+      console.warn(e.message);
+    } else {
+      console.error('Unexpected error checking meta binary:', e);
+    }
     return false;
   }
 }
src/typegate/src/typegate/register.ts (1)

107-107: Consider log level for meta information.

Debug logging of meta information might be too verbose for production.

Consider adding a condition or using a more specific log level:

-    console.debug("meta", engine.tg.tg.meta);
+    if (process.env.DEBUG_TYPEGRAPH) {
+      console.debug("typegraph meta:", engine.tg.tg.meta);
+    }
src/typegate/src/transports/graphql/typegraph.ts (1)

150-170: Consider optimizing the namespace initialization.

The recursive traversal of object nodes could be optimized:

  1. Consider using a Set to avoid duplicate indices
  2. Consider using a non-recursive implementation for large type graphs

Here's an optimized version using a Set:

-export function setNamespaces(tg: TypeGraphDS) {
-  if (tg.meta.namespaces != null) {
-    return;
-  }
-  const namespaces: number[] = [];
-
-  const rootNode = tg.types[0] as ObjectNode;
-
-  const addNamespacesFrom = (node: ObjectNode, nodeIdx: number) => {
-    namespaces.push(nodeIdx);
-    for (const [, typeIdx] of Object.entries(node.properties)) {
-      const childNode = tg.types[typeIdx];
-      if (childNode.type === Type.OBJECT) {
-        addNamespacesFrom(childNode, typeIdx);
-      }
-    }
-  };
-
-  addNamespacesFrom(rootNode, 0);
-  tg.meta.namespaces = namespaces;
+export function setNamespaces(tg: TypeGraphDS) {
+  if (tg.meta.namespaces != null) {
+    return;
+  }
+  const namespaces = new Set<number>();
+  const stack = [{node: tg.types[0] as ObjectNode, idx: 0}];
+  
+  while (stack.length > 0) {
+    const {node, idx} = stack.pop()!;
+    namespaces.add(idx);
+    
+    for (const [, typeIdx] of Object.entries(node.properties)) {
+      const childNode = tg.types[typeIdx];
+      if (childNode.type === Type.OBJECT) {
+        stack.push({node: childNode, idx: typeIdx});
+      }
+    }
+  }
+  
+  tg.meta.namespaces = Array.from(namespaces);
+}
ghjk.ts (1)

157-167: Improve version bump error handling.

The version bump logic should validate the version format and handle edge cases for pre-release versions.

Consider adding version format validation:

  if (bump === "prerelease") {
+   if (!semver.valid(CURRENT_VERSION) || !semver.valid(LATEST_PRE_RELEASE_VERSION || LATEST_RELEASE_VERSION)) {
+     throw new Error('Invalid version format');
+   }
    $.logStep(
      `Bumping published version ${
        LATEST_PRE_RELEASE_VERSION || LATEST_RELEASE_VERSION
      } → ${CURRENT_VERSION}`,
    );
tests/e2e/published/typegate_upgrade_test.ts (3)

17-19: Document the disabled tests rationale.

The comment about build.rs and meta-old is unclear. Please provide more detailed documentation about why these tests are disabled and when they can be re-enabled.


66-82: Enhance process management robustness.

The process spawning could be more robust with timeout handling and proper error management.

Consider adding timeout and error handling:

-    const proc = new Deno.Command("meta-old", {
+    const TIMEOUT_MS = 30000;
+    const proc = await Promise.race([
+      new Deno.Command("meta-old", {
       args: ["typegate"],
       env: {
         ...Deno.env.toObject(),
         LOG_LEVEL: "DEBUG",
         PATH: `${metaBinDir}:${Deno.env.get("PATH")}`,
         TG_SECRET: tgSecret,
         TG_ADMIN_PASSWORD: "password",
         TMP_DIR: typegateTempDir,
         TG_PORT: port,
         VERSION: previousVersion,
         ...testConfig.syncEnvs,
       },
       stdout: "piped",
-    }).spawn();
+    }).spawn(),
+      new Promise((_, reject) => 
+        setTimeout(() => reject(new Error('Process spawn timeout')), TIMEOUT_MS)
+      )
+    ]).catch(error => {
+      throw new Error(`Failed to spawn process: ${error.message}`);
+    });

192-194: Enhance test assertions.

The test only verifies array equality. Consider adding more specific assertions about the typegraph content and structure.

Consider adding more detailed assertions:

-    await t.should("have the same typegraphs", () => {
-      assertEquals(typegraphs.sort(), typegraphs2.sort());
+    await t.should("verify typegraph compatibility", () => {
+      // Verify array equality
+      assertEquals(typegraphs.sort(), typegraphs2.sort());
+      
+      // Verify each typegraph exists and has expected structure
+      for (const tg of typegraphs) {
+        t.assert(tg.includes('/'), `Invalid typegraph path: ${tg}`);
+        // Add more specific assertions about typegraph structure
+      }
     });
src/typegate/src/runtimes/deno/deno.ts (1)

233-233: Consider making the debug log conditional.

The unconditional log statement could clutter logs in production. Consider wrapping it with a debug flag check:

-    console.log("root type", this.tg.types[0]);
+    if (this.verbose) {
+      logger.debug("root type", this.tg.types[0]);
+    }
src/typegate/src/engine/planner/mod.ts (1)

548-554: LGTM! Clean and safe implementation.

The changes improve code clarity and null safety. The explicit block structure and nullish coalescing operator make the code more robust.

Consider extracting the type check into a descriptive variable for even better readability:

-          inputType.id?.includes(key) ?? false,
+          const isRequiredField = inputType.id?.includes(key) ?? false;
+          isRequiredField,
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 324dffa and 3a619fd.

⛔ Files ignored due to path filters (4)
  • .ghjk/deno.lock is excluded by !**/*.lock
  • Cargo.lock is excluded by !**/*.lock
  • deno.lock is excluded by !**/*.lock
  • tests/metagen/__snapshots__/metagen_test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (45)
  • .ghjk/lock.json (43 hunks)
  • Cargo.toml (1 hunks)
  • examples/templates/deno/api/example.ts (1 hunks)
  • examples/templates/deno/compose.yml (1 hunks)
  • examples/templates/node/compose.yml (1 hunks)
  • examples/templates/node/package.json (1 hunks)
  • examples/templates/python/compose.yml (1 hunks)
  • examples/templates/python/pyproject.toml (1 hunks)
  • ghjk.ts (4 hunks)
  • pyproject.toml (1 hunks)
  • src/common/src/typegraph/mod.rs (1 hunks)
  • src/pyrt_wit_wire/pyproject.toml (1 hunks)
  • src/typegate/src/engine/planner/mod.ts (1 hunks)
  • src/typegate/src/runtimes/deno/deno.ts (1 hunks)
  • src/typegate/src/runtimes/wit_wire/mod.ts (1 hunks)
  • src/typegate/src/transports/graphql/typegraph.ts (2 hunks)
  • src/typegate/src/typegate/mod.ts (1 hunks)
  • src/typegate/src/typegate/register.ts (3 hunks)
  • src/typegate/src/typegraph/types.ts (1 hunks)
  • src/typegate/src/typegraph/versions.ts (2 hunks)
  • src/typegate/src/typegraphs/introspection.json (1 hunks)
  • src/typegate/src/typegraphs/prisma_migration.json (1 hunks)
  • src/typegate/src/typegraphs/typegate.json (1 hunks)
  • src/typegraph/core/Cargo.toml (1 hunks)
  • src/typegraph/core/src/global_store.rs (1 hunks)
  • src/typegraph/core/src/typegraph.rs (2 hunks)
  • src/typegraph/deno/deno.json (1 hunks)
  • src/typegraph/python/pyproject.toml (1 hunks)
  • src/typegraph/python/typegraph/__init__.py (1 hunks)
  • src/xtask/Cargo.toml (1 hunks)
  • tests/e2e/published/common.ts (1 hunks)
  • tests/e2e/published/config.ts (1 hunks)
  • tests/e2e/published/published_test.ts (0 hunks)
  • tests/e2e/published/sdk_test.ts (1 hunks)
  • tests/e2e/published/typegate_upgrade_test.ts (1 hunks)
  • tests/e2e/published/utils.ts (1 hunks)
  • tests/metagen/typegraphs/sample/rs/Cargo.toml (1 hunks)
  • tests/metagen/typegraphs/sample/rs_upload/Cargo.toml (1 hunks)
  • tests/runtimes/wasm_reflected/rust/Cargo.toml (1 hunks)
  • tools/consts.ts (5 hunks)
  • tools/deps.ts (1 hunks)
  • tools/jsr/deno2node.ts (2 hunks)
  • tools/jsr/jsr-gen.ts (2 hunks)
  • tools/tasks/lock.ts (2 hunks)
  • whiz.yaml (1 hunks)
💤 Files with no reviewable changes (1)
  • tests/e2e/published/published_test.ts
✅ Files skipped from review due to trivial changes (20)
  • src/typegate/src/typegate/mod.ts
  • src/xtask/Cargo.toml
  • whiz.yaml
  • src/typegate/src/runtimes/wit_wire/mod.ts
  • tests/metagen/typegraphs/sample/rs_upload/Cargo.toml
  • src/typegate/src/typegraphs/typegate.json
  • src/typegraph/deno/deno.json
  • src/pyrt_wit_wire/pyproject.toml
  • src/typegate/src/typegraphs/introspection.json
  • examples/templates/deno/compose.yml
  • tests/runtimes/wasm_reflected/rust/Cargo.toml
  • src/typegraph/python/pyproject.toml
  • src/typegraph/python/typegraph/init.py
  • src/typegraph/core/src/global_store.rs
  • tests/metagen/typegraphs/sample/rs/Cargo.toml
  • src/typegate/src/typegraphs/prisma_migration.json
  • examples/templates/python/compose.yml
  • examples/templates/deno/api/example.ts
  • examples/templates/node/compose.yml
  • src/typegraph/core/Cargo.toml
🧰 Additional context used
🪛 Gitleaks (8.21.2)
.ghjk/lock.json

1010-1010: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1016-1016: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1021-1021: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1027-1027: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1032-1032: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1038-1038: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1044-1044: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1050-1050: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1055-1055: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1061-1061: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1066-1066: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1071-1071: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1076-1076: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1081-1081: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1087-1087: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1094-1094: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1099-1099: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1107-1107: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1113-1113: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1120-1120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1126-1126: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1132-1132: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1138-1138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1144-1144: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1150-1150: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1156-1156: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1162-1162: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1168-1168: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1174-1174: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1179-1179: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1184-1184: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1192-1192: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1200-1200: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1208-1208: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1217-1217: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1222-1222: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: lint-compat (macos-14, aarch64-apple-darwin, false)
  • GitHub Check: lint-compat (macos-13, x86_64-apple-darwin, false)
  • GitHub Check: test-full
  • GitHub Check: pre-commit
🔇 Additional comments (23)
tests/e2e/published/sdk_test.ts (2)

34-34: Caution: Use of 'only' may skip other tests

The use of only: version === LATEST_PRE_RELEASE_VERSION in the test configuration will cause the test framework to run only this test when version equals LATEST_PRE_RELEASE_VERSION. This may unintentionally skip other versions in previousVersions. Please verify if this behavior is intended.


74-74: Confirm logging with 'console.error'

In line 74, console.error("typegate>", line); is used to log standard output. If the intention is to log regular information, consider using console.log instead of console.error to differentiate between standard output and error messages.

tools/jsr/jsr-gen.ts (1)

60-60: Version update aligns with current version

Changing the version from METATYPE_VERSION to CURRENT_VERSION ensures that the deno.json file reflects the accurate current version of the package. This update is appropriate and maintains consistency across the codebase.

tools/jsr/deno2node.ts (1)

6-6: LGTM! Version reference updates are consistent.

The changes correctly update the version references to use CURRENT_VERSION, maintaining consistency with the version upgrade across the codebase.

Also applies to: 59-59

src/typegate/src/typegraph/versions.ts (2)

9-9: LGTM! Version update is consistent.

The typegraph version has been correctly updated to "0.0.4".


42-49: Verify the migration strategy for version 0.0.4.

The migration enforces a manual upgrade process by requiring the SYNC_FORCE_REMOVE=true environment variable. This is a breaking change that requires user intervention.

Please ensure that:

  1. This requirement is documented in the migration guide
  2. Users are informed about potential data loss when using SYNC_FORCE_REMOVE=true
tools/tasks/lock.ts (1)

18-18: LGTM! Version validation is called at the right place.

The validateVersions() function is correctly called at the beginning of the task to ensure version consistency.

tests/e2e/published/utils.ts (1)

1-10: LGTM! Clean import organization.

The imports are well-organized, grouped by functionality (local tools, download utilities, and encoding/IO operations).

tools/deps.ts (1)

49-49: LGTM! Clean addition of assert export.

The addition of the assert export from the standard library is well-placed with other std exports.

tools/consts.ts (2)

4-6: Verify version sequence logic.

The version constants follow this sequence:

  • CURRENT_VERSION: "0.5.0"
  • LATEST_RELEASE_VERSION: "0.4.10"
  • LATEST_PRE_RELEASE_VERSION: "0.5.0-rc.9"

This looks correct for upgrading from RC to stable.

✅ Verification successful

Version constants are correctly sequenced

The version constants accurately reflect the repository's version history:

  • LATEST_RELEASE_VERSION "0.4.10" matches the latest stable release tag
  • LATEST_PRE_RELEASE_VERSION "0.5.0-rc.9" matches the latest pre-release tag
  • CURRENT_VERSION "0.5.0" is correctly prepared for the upcoming stable release
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify version tags in the repository
gh api repos/metatypedev/metatype/tags | jq -r '.[].name' | head -n 5

Length of output: 131


Script:

#!/bin/bash
# Get all tags and filter for relevant versions
gh api repos/metatypedev/metatype/tags | jq -r '.[].name' | grep -E "v0\.4\.10|v0\.5\.0"

Length of output: 218


Line range hint 27-88: Verify all version pattern replacements.

The sedLockLines patterns have been updated to use CURRENT_VERSION. Let's verify the changes are complete.

✅ Verification successful

Version pattern replacements are correctly implemented

The version patterns in sedLockLines are being properly replaced with CURRENT_VERSION. The existing version constants (METATYPE_VERSION, SDK_VERSION, TYPEGRAPH_VERSION) serve different purposes in the codebase and should not be replaced.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any remaining references to old version constants
rg "METATYPE_VERSION" --type-not snap

Length of output: 66


Script:

#!/bin/bash
# Search for any remaining version-related constants
rg -i "version" --type ts --type rust --type python --type toml -g '!**/node_modules/**' -g '!**/target/**'

# Also check for specific version patterns that might have been missed
rg -i '(version|tag)\s*[=:]\s*["'\''][0-9]+\.[0-9]+\.[0-9]+' --type ts --type rust --type python --type toml -g '!**/node_modules/**' -g '!**/target/**'

Length of output: 324


Script:

#!/bin/bash
# Search for version-related constants in specific file types
rg -i "version" -g '*.{ts,rs,py,toml}' -g '!**/node_modules/**' -g '!**/target/**' -g '!**/dist/**'

# Search for hardcoded version numbers
rg -i '(version|tag)\s*[=:]\s*["'\''][0-9]+\.[0-9]+\.[0-9]+' -g '*.{ts,rs,py,toml}' -g '!**/node_modules/**' -g '!**/target/**' -g '!**/dist/**'

# Search for any remaining old version constants
rg "(METATYPE_VERSION|SDK_VERSION|TYPEGRAPH_VERSION)" -g '*.{ts,rs,py,toml}' -g '!**/node_modules/**' -g '!**/target/**' -g '!**/dist/**'

Length of output: 69014

src/typegate/src/typegate/register.ts (1)

64-69: Review temporary namespace initialization hack.

The comment indicates this is a temporary fix. We should:

  1. Understand why namespaces aren't set
  2. Create a tracking issue for proper fix

Would you like me to create a GitHub issue to track the proper fix for namespace initialization?

✅ Verification successful

Namespace initialization safety check is warranted

The "temporary hack" serves as a necessary fallback mechanism. Namespaces are critical for GraphQL query/mutation organization and are checked by multiple runtimes. While they should be initialized during typegraph processing, this safety check ensures system stability.

  • The proper initialization happens in src/transports/graphql/typegraph.ts
  • Multiple runtimes depend on namespaces being set correctly
  • Consider documenting this dependency in the typegraph initialization flow
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for namespace initialization patterns
ast-grep --pattern 'meta.namespaces = $_'

Length of output: 43


Script:

#!/bin/bash
# Search for namespace-related code and setNamespaces function
rg -t ts "namespaces|setNamespaces" -A 3

# Find files containing setNamespaces function
ast-grep --pattern 'function setNamespaces($_) {
  $$$
}'

# Look for property assignments with namespaces
ast-grep --pattern '$_.namespaces = $$$'

Length of output: 9677

src/typegate/src/transports/graphql/typegraph.ts (1)

149-150: Remove or document the TEMPORARY comment.

The comment indicates this is a temporary solution. Please either remove the TEMPORARY marker if this is now a permanent solution or document when and why this temporary solution will be replaced.

src/common/src/typegraph/mod.rs (1)

100-102: LGTM! Well-structured field addition.

The namespaces field is well-defined with appropriate serde attributes for serialization optimization.

src/typegate/src/typegraph/types.ts (1)

71-71: Verify the implications of making id optional in ObjectNode.

Making the id property optional could affect type checking and validation throughout the codebase. Please ensure that:

  1. All code paths handle the case where id is undefined
  2. This change doesn't break any existing functionality that relies on the presence of id
✅ Verification successful

Making id optional in ObjectNode appears safe

The codebase already handles the optional nature of the id property safely through:

  • Optional chaining when accessing the property (e.g., inputType.id?.includes())
  • Proper type guards and validation
  • No direct property access that assumes id is required
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usages of ObjectNode.id to ensure they handle undefined case
rg -A 3 'ObjectNode.*id'

Length of output: 26


Script:

#!/bin/bash
# Find ObjectNode definition and usage
ast-grep --pattern 'interface ObjectNode'
ast-grep --pattern 'class ObjectNode'

# Search for ObjectNode usage with broader context
rg -A 5 'ObjectNode'

# Look for id property access patterns
rg -A 3 '\.id\s*[=?:]'
rg -A 3 '\bid:'

# Search specifically in types.ts
cat src/typegate/src/typegraph/types.ts

Length of output: 72002


Script:

#!/bin/bash
# Search for ObjectNode type definition and direct id access
ast-grep --pattern 'type ObjectNode = { $$$id$$$}'
ast-grep --pattern 'ObjectNode.id'
ast-grep --pattern '$_.id?.includes'
ast-grep --pattern '$_.id?.'

# Look for validation and type checking code
rg -A 5 'ObjectNode.*type.*=.*"object"'
rg -A 5 'isObject.*\{'

Length of output: 2180

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

119-119: Verify namespace initialization.

The new namespaces field is initialized with a default value. Please ensure:

  1. The default value is appropriate for all use cases
  2. Existing code that might interact with namespaces is updated
✅ Verification successful

The namespace initialization is appropriate and safe.

The namespaces field is correctly initialized using Default::default(), which creates an empty Vec<u32>. This is consistent with:

  • The type definition in common/typegraph/mod.rs
  • The initialization pattern used for other collection fields in the same struct
  • Rust's idiomatic practices for safe default values
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for namespace-related code that might need updates
rg "namespaces" --type rust

Length of output: 169


Script:

#!/bin/bash
# Get struct definition containing namespaces in typegraph.rs
echo "=== Struct Definition ==="
ast-grep --pattern 'struct $_ {
  $$$
  namespaces: $_
  $$$
}'

# Find methods accessing namespaces
echo -e "\n=== Methods Accessing Namespaces ==="
ast-grep --pattern '
  fn $name($_) {
    $$$
    namespaces
    $$$
  }'

# Check imports
echo -e "\n=== Imports ==="
rg "use.*typegraph" --type rust

Length of output: 12733


Script:

#!/bin/bash
# Get more context around the namespaces field in typegraph.rs
echo "=== Typegraph.rs Context ==="
rg -B 5 -A 5 "namespaces: Default::default" src/typegraph/core/src/typegraph.rs

# Get struct and impl blocks
echo -e "\n=== Struct Definition and Implementations ==="
ast-grep --pattern 'struct TypegraphContext {
  $$$
}'

echo -e "\n=== Implementations ==="
ast-grep --pattern 'impl $_ for TypegraphContext {
  $$$
}'

Length of output: 805

examples/templates/python/pyproject.toml (1)

3-3: LGTM! Version updates are consistent.

The version updates from 0.5.0-rc.9 to 0.5.0 align with the project-wide transition from release candidate to stable version.

Also applies to: 9-9

examples/templates/node/package.json (1)

9-9: LGTM! Version update is consistent.

The dependency version update from ^0.5.0-rc.9 to ^0.5.0 aligns with the project-wide transition to stable version.

pyproject.toml (1)

9-9: LGTM! Version update is consistent.

The version update from 0.5.0-rc.9 to 0.5.0 aligns with the project-wide transition to stable version.

Cargo.toml (1)

27-27: LGTM! Version update is consistent.

The workspace package version update from 0.5.0-rc.9 to 0.5.0 aligns with the project-wide transition to stable version.

.ghjk/lock.json (3)

1010-1010: LGTM! Environment key updates look consistent.

The environment keys have been systematically updated across all tasks, maintaining the expected format and uniqueness.

Also applies to: 1016-1016, 1021-1021, 1027-1027, 1032-1032, 1038-1038, 1044-1044, 1050-1050, 1055-1055, 1061-1061, 1066-1066, 1071-1071, 1076-1076, 1081-1081, 1087-1087, 1094-1094, 1099-1099, 1107-1107, 1113-1113, 1120-1120, 1126-1126, 1132-1132, 1138-1138, 1144-1144, 1150-1150, 1156-1156, 1162-1162, 1168-1168, 1174-1174, 1179-1179, 1184-1184, 1192-1192, 1200-1200, 1208-1208, 1217-1217, 1222-1222

🧰 Tools
🪛 Gitleaks (8.21.2)

1010-1010: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1280-1280: LGTM! TYPEGRAPH_VERSION update is consistent.

The TYPEGRAPH_VERSION environment variable has been updated from 0.0.3 to 0.0.4 consistently across all environments.

Also applies to: 1313-1313, 1346-1346, 1379-1379, 1412-1412, 1445-1445, 1478-1478, 1516-1516, 1549-1549, 1582-1582, 1615-1615, 1683-1683, 1786-1786, 1819-1819, 1857-1857, 1895-1895, 1933-1933, 1966-1966, 1999-1999, 2037-2037


2063-2070: LGTM! Environment mappings are consistent.

The environment name to key mappings have been updated correctly to match the new environment keys.

Yohe-Am
Yohe-Am previously approved these changes Jan 13, 2025
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

🔭 Outside diff range comments (1)
ghjk.ts (1)

Line range hint 1615-1615: Security: Hardcoded credentials in environment configuration

The configuration contains hardcoded credentials in environment variables:

  • Redis password
  • TG_SECRET
  • TG_ADMIN_PASSWORD

These should be moved to a secure secrets management system.

Consider using environment-specific secret management:

  1. Development: Use .env files (added to .gitignore)
  2. Production: Use a secrets manager or environment variables
  3. CI/CD: Use repository secrets

Also applies to: 1645-1647

🧹 Nitpick comments (1)
.ghjk/lock.json (1)

Line range hint 1635-1655: Review Redis configuration security

The Redis configuration uses default ports and basic authentication. Consider:

  1. Using non-default ports
  2. Enabling SSL/TLS
  3. Implementing connection pooling
  4. Setting up proper ACLs
🧰 Tools
🪛 Gitleaks (8.21.2)

1010-1010: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1016-1016: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1021-1021: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1027-1027: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1032-1032: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1038-1038: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1044-1044: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1050-1050: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1055-1055: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1061-1061: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1066-1066: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1071-1071: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1076-1076: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1081-1081: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1087-1087: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1094-1094: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1099-1099: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1107-1107: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1113-1113: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1120-1120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1126-1126: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1132-1132: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1138-1138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1144-1144: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1150-1150: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1156-1156: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1162-1162: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1168-1168: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1174-1174: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1179-1179: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1184-1184: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1192-1192: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1200-1200: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1208-1208: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b4de195 and 6c904f2.

📒 Files selected for processing (5)
  • .ghjk/lock.json (43 hunks)
  • ghjk.ts (4 hunks)
  • src/typegate/src/typegraphs/typegate.json (1 hunks)
  • tests/e2e/published/common.ts (1 hunks)
  • tests/e2e/published/utils.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/typegate/src/typegraphs/typegate.json
  • tests/e2e/published/utils.ts
🧰 Additional context used
🪛 Gitleaks (8.21.2)
.ghjk/lock.json

1010-1010: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1016-1016: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1021-1021: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1027-1027: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1032-1032: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1038-1038: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1044-1044: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1050-1050: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1055-1055: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1061-1061: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1066-1066: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1071-1071: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1076-1076: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1081-1081: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1087-1087: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1094-1094: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1099-1099: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1107-1107: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1113-1113: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1120-1120: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1126-1126: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1132-1132: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1138-1138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1144-1144: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1150-1150: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1156-1156: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1162-1162: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1168-1168: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1174-1174: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1179-1179: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1184-1184: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1192-1192: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1200-1200: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1208-1208: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1217-1217: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1222-1222: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🔇 Additional comments (9)
tests/e2e/published/common.ts (6)

1-8: LGTM! Well-structured imports and proper licensing.

The file starts with appropriate copyright and license headers, and the imports are well-organized and properly scoped.


9-13: LGTM! Clear and purposeful type definition.

The PreludeStepsOutput type clearly defines the structure of the function's return value with descriptive field names.


14-17: LGTM! Well-designed function signature.

The function signature is clear, properly typed, and follows TypeScript best practices.


18-24: LGTM! Clear and well-documented test step.

The CLI download step is well-implemented with clear progress reporting through the test framework.


50-54: LGTM! Clean and type-safe return statement.

The return statement properly matches the PreludeStepsOutput type and handles path conversion correctly.


26-48: Optimize git operations and clean up configuration.

Several improvements could be made to this section:

  1. The git clone operation could be optimized and made more resilient
  2. The undefined dir parameter seems unnecessary
  3. The FIXME comment about caching should be addressed

Consider applying these improvements:

-  const examplesDir = $.path(
-    await newTempDir({
-      dir: undefined,
-    }),
-  );
+  const examplesDir = $.path(await newTempDir());

   await t.should(
     "download example typegraphs for the published version",
     async () => {
       const tag = `v${version}`;
-      // FIXME: cache across test runs
-      await $`git clone https://github.com/metatypedev/metatype.git --depth 1 --branch ${tag}`
+      try {
+        await $`git clone https://github.com/metatypedev/metatype.git --depth 1 --single-branch --branch ${tag}`
+      } catch (error) {
+        throw new Error(`Failed to clone repository: ${error.message}`);
+      }

Regarding the FIXME comment about caching, let's verify if there's an existing caching mechanism we could leverage:

✅ Verification successful

Optimize git clone operation and remove caching FIXME

The FIXME comment about caching can be removed as implementing cross-run caching would add unnecessary complexity for e2e tests that require version-specific fresh clones. The git clone operation can still be optimized as suggested in the original review:

-      // FIXME: cache across test runs
-      await $`git clone https://github.com/metatypedev/metatype.git --depth 1 --branch ${tag}`
+      try {
+        await $`git clone https://github.com/metatypedev/metatype.git --depth 1 --single-branch --branch ${tag}`
+      } catch (error) {
+        throw new Error(`Failed to clone repository: ${error.message}`);
+      }
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for existing caching implementations in test files
rg -g '*.ts' -g '*.js' 'cache.*test' ./tests

Length of output: 205


Script:

#!/bin/bash
# Check the related test file and look for test utilities
echo "=== Related test file ==="
cat ./tests/e2e/published/typegate_upgrade_test.ts

echo -e "\n=== Test utilities and configuration ==="
fd -e ts -e js "test.*config|test.*utils|test.*helper" ./tests

Length of output: 6518

ghjk.ts (2)

126-127: Verify version bump implementation

The version bump logic looks correct but should be tested with different version patterns to ensure it handles all cases correctly.

Run this script to verify version bump behavior:

Also applies to: 131-169

✅ Verification successful

Version bump implementation verified successfully

The implementation correctly handles both regular releases (x.y.z) and pre-releases (x.y.z-rc.n) while maintaining version history and ensuring consistency across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Test version bump logic with different patterns

# Check for version references
echo "Checking version references..."
rg -A 2 'CURRENT_VERSION|LATEST_PRE_RELEASE_VERSION|LATEST_RELEASE_VERSION'

# Check version format consistency
echo "Checking version format consistency..."
rg -o 'version["\s]+:\s+"[^"]+"' | sort | uniq

Length of output: 6980


28-28: ⚠️ Potential issue

Breaking changes in version 0.0.4 require documentation

The update to TYPEGRAPH_VERSION "0.0.4" introduces breaking changes (as evidenced by the migration logic throwing an error), but no migration guide or documentation was found. This could impact dependent systems.

Run this script to check for migration guides and breaking changes:

.ghjk/lock.json (1)

Line range hint 1269-1313: Version consistency check required across environments

The TYPEGRAPH_VERSION is set to "0.0.4" across multiple environments. Ensure this is intentionally synchronized and verify compatibility with all dependent services.

Run this script to verify version consistency:

Also applies to: 1336-1346, 1369-1379, 1402-1412, 1435-1445, 1468-1478, 1506-1516, 1539-1549, 1572-1582, 1605-1615, 1673-1683, 1776-1786, 1809-1819, 1847-1857, 1885-1895, 1923-1933, 1956-1966, 1989-1999, 2032-2042

✅ Verification successful

Version consistency verified across environments

The TYPEGRAPH_VERSION is consistently set to "0.0.4" across all 20 environments in lock.json. The old version "0.0.3" appears only in test snapshots and test files, which likely need updating but don't affect the runtime environments.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check version consistency across environments

# Extract and compare versions
echo "Checking version consistency..."
rg -o '"TYPEGRAPH_VERSION".*"([^"]+)"' | sort | uniq -c

# Check for any remaining old versions
echo "Checking for old versions..."
rg "0.0.3" 

Length of output: 75309


Script:

#!/bin/bash
# Search specifically for TYPEGRAPH_VERSION in lock.json
echo "Checking TYPEGRAPH_VERSION in lock.json..."
rg -A 1 '"TYPEGRAPH_VERSION"' .ghjk/lock.json

# Count occurrences
echo -e "\nCounting occurrences..."
rg -c '"TYPEGRAPH_VERSION"' .ghjk/lock.json

Length of output: 1891

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

🔭 Outside diff range comments (1)
.ghjk/lock.json (1)

Line range hint 1590-1620: Security: Hardcoded credentials in environment variables.

Several environment variables contain hardcoded sensitive information:

  • Redis passwords
  • Admin passwords
  • Secret keys
  • S3 credentials

Consider:

  1. Using environment-specific configuration files
  2. Implementing a secrets management solution
  3. Using placeholder values in the lock file
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6c904f2 and 67f53c1.

📒 Files selected for processing (2)
  • .ghjk/lock.json (83 hunks)
  • examples/typegraphs/metagen/rs/fdk.rs (1 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
.ghjk/lock.json

969-969: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


975-975: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


980-980: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


986-986: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


991-991: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


997-997: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1003-1003: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1009-1009: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1014-1014: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1020-1020: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1025-1025: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1030-1030: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1035-1035: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1040-1040: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1046-1046: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1053-1053: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1058-1058: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1066-1066: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1072-1072: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1079-1079: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1085-1085: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1091-1091: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1097-1097: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1103-1103: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1109-1109: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1115-1115: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1121-1121: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1127-1127: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1133-1133: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1138-1138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1143-1143: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1151-1151: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1159-1159: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1167-1167: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1176-1176: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1181-1181: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: bulid-docker (linux/arm64, custom-arm)
  • GitHub Check: bulid-docker (linux/amd64, custom-ubuntu-large)
🔇 Additional comments (4)
.ghjk/lock.json (4)

1239-1239: Consistent version update across environments.

The TYPEGRAPH_VERSION has been updated from 0.0.3 to 0.0.4 consistently across all environment configurations.

Also applies to: 1272-1272, 1305-1305, 1338-1338, 1371-1371, 1404-1404, 1437-1437, 1475-1475, 1508-1508, 1541-1541, 1574-1574, 1642-1642, 1745-1745, 1778-1778, 1816-1816, 1854-1854, 1892-1892, 1925-1925, 1958-1958, 2001-2001


Line range hint 969-1181: Task configurations are well-structured and properly updated.

The task configurations have been updated with:

  • Clear descriptions for each task
  • Proper dependency chains
  • Updated environment keys
  • Consistent naming conventions
🧰 Tools
🪛 Gitleaks (8.21.2)

969-969: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


975-975: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


980-980: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


986-986: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


991-991: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


997-997: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1003-1003: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1009-1009: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1014-1014: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1020-1020: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1025-1025: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1030-1030: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1035-1035: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1040-1040: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1046-1046: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1053-1053: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1058-1058: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1066-1066: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1072-1072: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1079-1079: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1085-1085: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1091-1091: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1097-1097: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1103-1103: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1109-1109: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1115-1115: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1121-1121: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1127-1127: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1133-1133: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1138-1138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1143-1143: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1151-1151: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1159-1159: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


1167-1167: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


969-969: Static analysis false positives: Environment keys are not sensitive.

The Gitleaks tool has flagged multiple environment keys as potential API keys. These are false positives as these keys are:

  • Internal configuration identifiers
  • Not used for authentication
  • Required by the system's architecture
  • Generated deterministically based on the configuration

No action is required for these detections.

Also applies to: 975-975, 980-980, 986-986, 991-991, 997-997, 1003-1003, 1009-1009, 1014-1014, 1020-1020, 1025-1025, 1030-1030, 1035-1035, 1040-1040, 1046-1046, 1053-1053, 1058-1058, 1066-1066, 1072-1072, 1079-1079, 1085-1085, 1091-1091, 1097-1097, 1103-1103, 1109-1109, 1115-1115, 1121-1121, 1127-1127, 1133-1133, 1138-1138, 1143-1143, 1151-1151, 1159-1159, 1167-1167, 1176-1176, 1181-1181

🧰 Tools
🪛 Gitleaks (8.21.2)

969-969: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


12-12: Verify compatibility with major version updates.

Several dependencies have been updated to newer versions, with some significant version jumps:

  • git_aa: 2.34.1 -> 2.45.2 (major version jump)
  • cargo_binstall_ghrel: v1.10.9 -> v1.10.21
  • tar_aa: 1.34 -> 1.35

Please ensure that these updates, especially the major version jump in git_aa, don't introduce breaking changes that could affect the build process.

Run the following script to check for any compatibility issues:

Also applies to: 23-23, 29-29, 38-38, 50-50, 71-71, 83-83, 98-98, 107-107, 120-120, 132-132, 156-156, 168-168, 195-195, 252-252, 264-264, 288-288, 300-300, 342-342, 351-351, 377-377, 388-388, 519-519, 531-531, 555-555, 567-567, 640-640, 652-652, 696-696, 708-708

✅ Verification successful

Version updates are safe and follow semantic versioning

The version updates in .ghjk/lock.json are routine maintenance changes:

  • tar_aa: Minor version bump (1.34 -> 1.35)
  • git_aa: Major version bump but with Git's backward compatibility guarantee
  • cargo_binstall_ghrel: Minor version updates (v1.10.9 -> v1.10.21)

These are build tool dependencies with strong backward compatibility guarantees. The updates follow semantic versioning principles and are safe to apply.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential compatibility issues with updated dependencies

# Check git version compatibility
git --version

# Check cargo-binstall version
cargo binstall --version

# Check tar version
tar --version

# Look for any error patterns in recent builds that might indicate compatibility issues
rg -i "error|failed|incompatible" .ghjk/logs/ || echo "No logs found or no issues detected"

Length of output: 667

@Natoandro Natoandro force-pushed the met-774-typegraph-upgrade branch from 5840d96 to 9427fb9 Compare January 16, 2025 10:37
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 80.28846% with 41 lines in your changes missing coverage. Please review.

Project coverage is 78.04%. Comparing base (eeb69c4) to head (b3e05db).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
tests/e2e/published/config.ts 69.49% 18 Missing ⚠️
tests/e2e/published/utils.ts 73.52% 18 Missing ⚠️
src/typegate/src/typegraph/versions.ts 50.00% 4 Missing ⚠️
src/typegate/src/engine/planner/mod.ts 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #941      +/-   ##
==========================================
- Coverage   78.07%   78.04%   -0.04%     
==========================================
  Files         154      157       +3     
  Lines       19099    19283     +184     
  Branches     1936     1944       +8     
==========================================
+ Hits        14912    15049     +137     
- Misses       4164     4211      +47     
  Partials       23       23              

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

@Natoandro Natoandro requested a review from Yohe-Am January 16, 2025 12:34
michael-0acf4
michael-0acf4 previously approved these changes Jan 16, 2025
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 (2)
tools/consts.ts (2)

Line range hint 20-95: Consider making version replacement patterns more robust.

The sedLockLines patterns could benefit from more precise RegExp patterns to avoid unintended matches. Consider these improvements:

  1. Add word boundaries or more specific context where applicable
  2. Use non-capturing groups where possible
  3. Ensure consistent pattern structure for similar replacements

Example improvements:

- [/(\s*static\s*MT_VERSION:\s*&str\s*=\s*").+(";)/, CURRENT_VERSION],
+ [/(\s*static\s*MT_VERSION:\s*&str\s*=\s*")[\d\.-]+(";)/, CURRENT_VERSION],

- ['(version = ").+(")', CURRENT_VERSION],
+ ['(version\s*=\s*")[\d\.-]+(")', CURRENT_VERSION],

91-94: Make JSR import pattern more specific.

The current pattern for JSR imports might be too permissive. Consider making it more specific to version numbers to avoid unintended matches.

- /(import\s+.+\s+from "jsr:@typegraph\/sdk@)[^\/]+((?:\/.+)?";)/,
+ /(import\s+.+\s+from "jsr:@typegraph\/sdk@)[\d\.-]+((?:\/.+)?";)/,
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9427fb9 and b3e05db.

📒 Files selected for processing (2)
  • examples/templates/deno/api/example.ts (1 hunks)
  • tools/consts.ts (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/templates/deno/api/example.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • 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: test-website
  • GitHub Check: test-full
  • GitHub Check: pre-commit
🔇 Additional comments (1)
tools/consts.ts (1)

4-6: Verify version consistency across the codebase.

The version constants have been updated to reflect the progression from 0.4.10 to 0.5.0. Let's verify that these versions are consistently applied across the codebase.

Also applies to: 13-13

✅ Verification successful

Version constants are consistently applied across the codebase

The version progression from 0.4.10 to 0.5.0 is properly reflected in all relevant files, with appropriate version references in package manifests, SDK constants, and documentation. Previous version references are intentionally maintained in test files for compatibility testing.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify version consistency across the codebase

# Check for any remaining references to old version constants
echo "Checking for old version constant references..."
rg "METATYPE_VERSION|PUBLISHED_VERSION" -l

# Check for version inconsistencies
echo "Checking for version inconsistencies..."
rg "0\.4\.10|0\.5\.0-rc\.9|0\.5\.0" --type-not lock --type-not json

# Check TypeGraph version references
echo "Checking TypeGraph version references..."
rg "0\.0\.[34]" --type-not lock --type-not json

Length of output: 6434

@Natoandro Natoandro merged commit 30d8b1e into main Jan 16, 2025
11 of 13 checks passed
@Natoandro Natoandro deleted the met-774-typegraph-upgrade branch January 16, 2025 16:29
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.

5 participants