Skip to content

Conversation

@janb87
Copy link
Contributor

@janb87 janb87 commented Oct 28, 2025

Summary by Sourcery

Use dynamic node lookup and hoisted bun linker in e2e tests to fix broken tests

Bug Fixes:

  • Replace hardcoded node name with dynamic resolution in restart-resources test by adding a helper that fetches the blockchain node via the SDK
  • Update bun install commands in SettleMint and standalone project setup tests to include --linker=hoisted for correct dependency installation

@janb87 janb87 added the e2e label Oct 28, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @janb87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the reliability of end-to-end tests. It addresses dependency management by enforcing a hoisted linker strategy for bun install in project setup tests and improves the blockchain node restart test by integrating the SettleMint SDK to dynamically identify and target the correct node, thereby increasing test stability and accuracy.

Highlights

  • E2E Test Dependency Resolution: The bun install command in the project creation end-to-end tests has been updated to explicitly use the --linker=hoisted flag, ensuring consistent dependency resolution and preventing potential issues with unhoisted packages.
  • Robust Blockchain Node Restart Test: The restart-resources.e2e.test.ts file now dynamically retrieves the blockchain node's uniqueName using the SettleMint SDK before attempting a restart. This makes the test more resilient to changes in node naming conventions and ensures the correct node is targeted.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions bot added the qa:running QA workflow is currently running label Oct 28, 2025
});
const nodes = await settlemint.blockchainNode.list(env.SETTLEMINT_APPLICATION!);
return nodes.find((node) => node.name === blockchainNodeName);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect Access Token Usage in Tests

Local findBlockchainNodeByName function uses env.SETTLEMINT_ACCESS_TOKEN instead of the E2E-specific process.env.SETTLEMINT_ACCESS_TOKEN_E2E_TESTS that should be used (as defined in the existing utility function at test/utils/test-resources.ts). This will cause the function to use the wrong access token, potentially failing authentication or accessing the wrong environment. The existing utility function should be imported and used instead, as done in other test files like pause-resume-blockchain-node.e2e.test.ts.

Fix in Cursor Fix in Web

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

To view in Slack, search for: 1761641080.660299

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `test/create-new-standalone-project.e2e.test.ts:127` </location>
<code_context>
     await updatePackageJsonToUseLinkedDependencies(dAppDir);
     await updatePackageJsonToUseLinkedDependencies(contractsDir);
     await updatePackageJsonToUseLinkedDependencies(subgraphDir);
-    await $`bun install --no-cache`.cwd(projectDir).env(env);
+    await $`bun install --no-cache --linker=hoisted`.cwd(projectDir).env(env);
   });

</code_context>

<issue_to_address>
**suggestion (testing):** Consider adding assertions to verify successful installation after changing the linker.

Please add assertions to confirm that all dependencies are present and correctly installed after using the hoisted linker.

Suggested implementation:

```typescript
    await $`bun install --no-cache --linker=hoisted`.cwd(projectDir).env(env);

    // Assert that node_modules exists and key dependencies are installed
    const fs = require("fs");
    const path = require("path");

    const nodeModulesPath = path.join(projectDir, "node_modules");
    expect(fs.existsSync(nodeModulesPath)).toBe(true);

    // Check for a few expected dependencies (replace with actual dependencies as needed)
    const expectedDeps = ["bun", "typescript"];
    for (const dep of expectedDeps) {
      const depPath = path.join(nodeModulesPath, dep);
      expect(fs.existsSync(depPath)).toBe(true);
    }
  });

```

- You may need to adjust the `expectedDeps` array to match the actual dependencies your project installs.
- If your test environment uses ES modules, replace `require` with `import` statements.
- Ensure that the test runner has access to the `fs` and `path` modules.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions github-actions bot added the status:ready-for-review Pull request is ready for review label Oct 28, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to fix broken end-to-end tests. The changes include adding the --linker=hoisted flag to bun install commands, which is a reasonable fix for dependency issues. Another change involves correctly identifying a blockchain node by its unique name instead of a display name in the restart test. While this logic is correct, it introduces a duplicated helper function in test/restart-resources.e2e.test.ts. I've left comments suggesting how to resolve this duplication to improve code maintainability, along with a note on an unused import.

Comment on lines +41 to +49
async function findBlockchainNodeByName(blockchainNodeName: string) {
const env: Partial<DotEnv> = await loadEnv(false, false);
const settlemint = createSettleMintClient({
accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
instance: env.SETTLEMINT_INSTANCE!,
});
const nodes = await settlemint.blockchainNode.list(env.SETTLEMINT_APPLICATION!);
return nodes.find((node) => node.name === blockchainNodeName);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This findBlockchainNodeByName function is a duplicate of an existing utility in test/utils/test-resources.ts. While the implementation is slightly different regarding the access token, duplicating code increases maintenance overhead and can lead to inconsistencies. A better approach would be to refactor the shared utility to be more flexible. For now, please rename this function to avoid name collisions and confusion with the shared utility (e.g., findBlockchainNodeByNameWithDefaultToken). This will make the code's intent clearer.

import type { DotEnv } from "@settlemint/sdk-utils/validation";
import { NODE_NAME_3_WITHOUT_PK } from "./constants/test-resources";
import { forceExitAllCommands, runCommand } from "./utils/run-command";
import { setupSettleMintClient } from "./utils/test-resources";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The setupSettleMintClient function is imported but never used in this file. Unused imports should be removed to improve code readability and maintainability.

@github-actions
Copy link

📦 Packages

Package NPM Docker
SDK Cli @settlemint/sdk-cli@2.6.2-pr85c595b0
SDK The Graph @settlemint/sdk-thegraph@2.6.2-pr85c595b0
SDK Portal @settlemint/sdk-portal@2.6.2-pr85c595b0
SDK Hasura @settlemint/sdk-hasura@2.6.2-pr85c595b0
SDK JS @settlemint/sdk-js@2.6.2-pr85c595b0
SDK Utils @settlemint/sdk-utils@2.6.2-pr85c595b0
SDK Next @settlemint/sdk-next@2.6.2-pr85c595b0
SDK Minio @settlemint/sdk-minio@2.6.2-pr85c595b0
SDK IPFS @settlemint/sdk-ipfs@2.6.2-pr85c595b0
SDK Blockscout @settlemint/sdk-blockscout@2.6.2-pr85c595b0
SDK MCP @settlemint/sdk-mcp@2.6.2-pr85c595b0
SDK Viem @settlemint/sdk-viem@2.6.2-pr85c595b0
SDK EAS @settlemint/sdk-eas@2.6.2-pr85c595b0

@github-actions github-actions bot added qa:success QA workflow passed successfully fix Bug fix and removed qa:running QA workflow is currently running labels Oct 28, 2025
Comment on lines +41 to +49
async function findBlockchainNodeByName(blockchainNodeName: string) {
const env: Partial<DotEnv> = await loadEnv(false, false);
const settlemint = createSettleMintClient({
accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
instance: env.SETTLEMINT_INSTANCE!,
});
const nodes = await settlemint.blockchainNode.list(env.SETTLEMINT_APPLICATION!);
return nodes.find((node) => node.name === blockchainNodeName);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The findBlockchainNodeByName function uses the wrong environment variable for SettleMint client authentication in E2E tests.
Severity: HIGH | Confidence: 0.95

🔍 Detailed Analysis

The findBlockchainNodeByName function initializes the SettleMint client using env.SETTLEMINT_ACCESS_TOKEN! for authentication. This variable is incorrect for E2E tests, as the test runner populates process.env.SETTLEMINT_ACCESS_TOKEN_E2E_TESTS! with the necessary credentials. The loadEnv() function does not specifically populate SETTLEMINT_ACCESS_TOKEN with E2E test credentials, leading to an authentication failure when the client attempts to list blockchain nodes.

💡 Suggested Fix

Modify the findBlockchainNodeByName function to use process.env.SETTLEMINT_ACCESS_TOKEN_E2E_TESTS! for the accessToken when creating the SettleMint client, or reuse the existing setupSettleMintClient() utility.

🤖 Prompt for AI Agent
Fix this bug. In test/restart-resources.e2e.test.ts at lines 41-49: The
`findBlockchainNodeByName` function initializes the SettleMint client using
`env.SETTLEMINT_ACCESS_TOKEN!` for authentication. This variable is incorrect for E2E
tests, as the test runner populates `process.env.SETTLEMINT_ACCESS_TOKEN_E2E_TESTS!`
with the necessary credentials. The `loadEnv()` function does not specifically populate
`SETTLEMINT_ACCESS_TOKEN` with E2E test credentials, leading to an authentication
failure when the client attempts to list blockchain nodes.

Did we get this right? 👍 / 👎 to inform future reviews.

@coderabbitai
Copy link

coderabbitai bot commented Oct 28, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

The pull request modifies three end-to-end test files. In two test files (create-new-settlemint-project.e2e.test.ts and create-new-standalone-project.e2e.test.ts), the --linker=hoisted flag is added to the bun install command during the dependency installation and SDK linking test step. In restart-resources.e2e.test.ts, a new helper function retrieves a blockchain node by name before restart, and the restart command now uses the node's uniqueName instead of a constant value. Additional utility imports and error handling for missing nodes are also added.

Possibly related PRs

  • fix: e2e tests #1034: Modifies the same test/restart-resources.e2e.test.ts file to add post-restart HTTP health checks in the restart flow.

Suggested labels

fix

Suggested reviewers

  • roderik

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "fix: broken e2e tests" directly aligns with the changeset, which consists of bug fixes to three e2e test files. The changes address specific issues in the tests by adding the --linker=hoisted flag to bun install commands and implementing dynamic node lookup in the restart-resources test. The title is concise, clear, and uses standard commit convention formatting, making it easy for reviewers scanning history to understand the primary intent of the changes.
Description Check ✅ Passed The pull request description accurately describes the changes in the changeset. It specifically mentions the two main bug fixes: replacing hardcoded node names with dynamic resolution in the restart-resources test by adding a helper function, and updating bun install commands in both the SettleMint and standalone project setup tests to include the --linker=hoisted flag. These descriptions directly correspond to the actual changes shown in the raw_summary. The description is not vague or generic, as it identifies specific files and the nature of the modifications being made.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +41 to +45
async function findBlockchainNodeByName(blockchainNodeName: string) {
const env: Partial<DotEnv> = await loadEnv(false, false);
const settlemint = createSettleMintClient({
accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
instance: env.SETTLEMINT_INSTANCE!,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use E2E access token when fetching blockchain node

The new helper builds the SDK client with env.SETTLEMINT_ACCESS_TOKEN loaded from .env, even though the test suite relies on SETTLEMINT_ACCESS_TOKEN_E2E_TESTS for authentication (see test/utils/test-resources.ts and other e2e tests). In environments where only the E2E token is provided and no .env file exists with SETTLEMINT_ACCESS_TOKEN, the client will be created with undefined credentials and settlemint.blockchainNode.list will fail with 401, so the test will still break. Reuse setupSettleMintClient() or read process.env.SETTLEMINT_ACCESS_TOKEN_E2E_TESTS to ensure the call is authenticated.

Useful? React with 👍 / 👎.

Copy link

@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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 67425e9 and fe238e5.

📒 Files selected for processing (3)
  • test/create-new-settlemint-project.e2e.test.ts (1 hunks)
  • test/create-new-standalone-project.e2e.test.ts (1 hunks)
  • test/restart-resources.e2e.test.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Do not use default exports in TypeScript (except when a framework requires it)
Use import type for type-only imports in TypeScript
Prefer interfaces over type aliases for object shapes
Never use any; use unknown or proper types instead
Use discriminated unions for error handling
File names should be kebab-case
Use camelCase for variable and function names
Use PascalCase for types, interfaces, and classes
Use UPPER_SNAKE_CASE for constants
Prefer nullish coalescing (??) over logical OR (||)
Use early returns to reduce nesting
Extract complex logic into well-named functions
Keep functions small and focused
Use structured logging with proper context

**/*.{ts,tsx}: Inside generic functions, using any for concise type narrowing is acceptable; outside of generics, use any extremely sparingly
Avoid default exports unless explicitly required by the framework (e.g., Next.js pages)
Use discriminated unions to model variant data and avoid 'bag of optionals'
Handle discriminated unions with switch statements over the discriminant
Do not introduce new enums; prefer as const objects for enum-like behavior; retain existing enums
Use top-level import type when importing types instead of inline import { type ... }
Prefer interface extends over intersection types (&) for modeling inheritance; use & only when extends is not possible
Use JSDoc comments to annotate functions and types when behavior isn’t obvious; keep comments concise
Use JSDoc inline @link to reference related functions and types within the same file
File names should be kebab-case (e.g., my-component.ts)
Use camelCase for variables and function names
Use UpperCamelCase (PascalCase) for classes, types, and interfaces
Use ALL_CAPS for constants (and enum values where enums already exist)
Prefix generic type parameters with T (e.g., TKey, TValue)
Be mindful of noUncheckedIndexedAccess: treat indexed object/array access as possibly undefined
Use optional properties sparingly; prefer required prop...

Files:

  • test/create-new-settlemint-project.e2e.test.ts
  • test/create-new-standalone-project.e2e.test.ts
  • test/restart-resources.e2e.test.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{test,spec}.{ts,tsx}: Write unit tests using Vitest
Mock external API calls in tests
Test error scenarios explicitly

Files:

  • test/create-new-settlemint-project.e2e.test.ts
  • test/create-new-standalone-project.e2e.test.ts
  • test/restart-resources.e2e.test.ts
test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Create end-to-end tests for CLI commands

Files:

  • test/create-new-settlemint-project.e2e.test.ts
  • test/create-new-standalone-project.e2e.test.ts
  • test/restart-resources.e2e.test.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/bun.mdc)

Use Bun.File() for file reading and writing

Files:

  • test/create-new-settlemint-project.e2e.test.ts
  • test/create-new-standalone-project.e2e.test.ts
  • test/restart-resources.e2e.test.ts
🧬 Code graph analysis (1)
test/restart-resources.e2e.test.ts (3)
test/utils/test-resources.ts (1)
  • findBlockchainNodeByName (32-37)
sdk/utils/src/validation/dot-env.schema.ts (1)
  • DotEnv (112-112)
sdk/js/src/settlemint.ts (1)
  • createSettleMintClient (275-426)
🪛 Biome (2.1.2)
test/restart-resources.e2e.test.ts

[error] 8-8: This import is unused.

Unused imports might be the result of an incomplete refactoring.
Unsafe fix: Remove the unused imports.

(lint/correctness/noUnusedImports)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: QA
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: E2E
  • GitHub Check: Sourcery review
  • GitHub Check: QA
🔇 Additional comments (3)
test/create-new-settlemint-project.e2e.test.ts (1)

80-80: LGTM: Hoisted linker flag aligns with local SDK linking.

The --linker=hoisted flag ensures a flat dependency structure, which is appropriate when linking local SDK packages.

test/create-new-standalone-project.e2e.test.ts (1)

127-127: LGTM: Consistent hoisted linker flag.

This matches the change in test/create-new-settlemint-project.e2e.test.ts and ensures consistent behavior across test files.

test/restart-resources.e2e.test.ts (1)

20-28: Dynamic node lookup improves test reliability.

The change from a hardcoded constant to dynamically looking up the node by name and using its uniqueName makes the test more robust. The error handling for missing nodes is appropriate.

Comment on lines +2 to +8
import { createSettleMintClient } from "@settlemint/sdk-js";
import { loadEnv } from "@settlemint/sdk-utils/environment";
import { fetchWithRetry } from "@settlemint/sdk-utils/http";
import type { DotEnv } from "@settlemint/sdk-utils/validation";
import { NODE_NAME_3_WITHOUT_PK } from "./constants/test-resources";
import { forceExitAllCommands, runCommand } from "./utils/run-command";
import { setupSettleMintClient } from "./utils/test-resources";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove unused import and use existing helper instead.

The setupSettleMintClient import on line 8 is unused. Additionally, test/utils/test-resources.ts already exports a findBlockchainNodeByName function (lines 31-36) that uses setupSettleMintClient. Import and use that existing helper instead of redefining it locally.

Apply this diff to remove the unused import:

-import { setupSettleMintClient } from "./utils/test-resources";
+import { findBlockchainNodeByName } from "./utils/test-resources";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { createSettleMintClient } from "@settlemint/sdk-js";
import { loadEnv } from "@settlemint/sdk-utils/environment";
import { fetchWithRetry } from "@settlemint/sdk-utils/http";
import type { DotEnv } from "@settlemint/sdk-utils/validation";
import { NODE_NAME_3_WITHOUT_PK } from "./constants/test-resources";
import { forceExitAllCommands, runCommand } from "./utils/run-command";
import { setupSettleMintClient } from "./utils/test-resources";
import { createSettleMintClient } from "@settlemint/sdk-js";
import { loadEnv } from "@settlemint/sdk-utils/environment";
import { fetchWithRetry } from "@settlemint/sdk-utils/http";
import type { DotEnv } from "@settlemint/sdk-utils/validation";
import { NODE_NAME_3_WITHOUT_PK } from "./constants/test-resources";
import { forceExitAllCommands, runCommand } from "./utils/run-command";
import { findBlockchainNodeByName } from "./utils/test-resources";
🧰 Tools
🪛 Biome (2.1.2)

[error] 8-8: This import is unused.

Unused imports might be the result of an incomplete refactoring.
Unsafe fix: Remove the unused imports.

(lint/correctness/noUnusedImports)

🤖 Prompt for AI Agents
In test/restart-resources.e2e.test.ts around lines 2 to 8, remove the unused
import setupSettleMintClient and instead import findBlockchainNodeByName from
the existing test/utils/test-resources module; update the test to call
findBlockchainNodeByName where the local helper was being redefined or used so
the code reuses the shared implementation and eliminates the unused import.

Comment on lines +41 to +49
async function findBlockchainNodeByName(blockchainNodeName: string) {
const env: Partial<DotEnv> = await loadEnv(false, false);
const settlemint = createSettleMintClient({
accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
instance: env.SETTLEMINT_INSTANCE!,
});
const nodes = await settlemint.blockchainNode.list(env.SETTLEMINT_APPLICATION!);
return nodes.find((node) => node.name === blockchainNodeName);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove duplicate helper - reuse existing implementation.

This function duplicates findBlockchainNodeByName already defined in test/utils/test-resources.ts (lines 31-36). The existing implementation uses setupSettleMintClient(), which is the appropriate test utility wrapper.

Remove this local function definition and import the existing helper as suggested in the earlier comment (lines 2-8).

-
-async function findBlockchainNodeByName(blockchainNodeName: string) {
-  const env: Partial<DotEnv> = await loadEnv(false, false);
-  const settlemint = createSettleMintClient({
-    accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
-    instance: env.SETTLEMINT_INSTANCE!,
-  });
-  const nodes = await settlemint.blockchainNode.list(env.SETTLEMINT_APPLICATION!);
-  return nodes.find((node) => node.name === blockchainNodeName);
-}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In test/restart-resources.e2e.test.ts around lines 41 to 49, remove the local
duplicate findBlockchainNodeByName function and instead import and reuse the
existing helper from test/utils/test-resources.ts (the existing implementation
at lines 31-36 uses setupSettleMintClient()); delete the local function, add the
appropriate import at the top (per the earlier comment around lines 2-8), and
update any calls to use the imported helper so the test uses the shared utility.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="test/restart-resources.e2e.test.ts">

<violation number="1" location="test/restart-resources.e2e.test.ts:44">
Use the E2E-specific access token environment variable for authentication in tests to avoid targeting the wrong environment. Prefer reusing the shared client setup helper or switch this line to the E2E token.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

async function findBlockchainNodeByName(blockchainNodeName: string) {
const env: Partial<DotEnv> = await loadEnv(false, false);
const settlemint = createSettleMintClient({
accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
Copy link

@cubic-dev-ai cubic-dev-ai bot Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the E2E-specific access token environment variable for authentication in tests to avoid targeting the wrong environment. Prefer reusing the shared client setup helper or switch this line to the E2E token.

Prompt for AI agents
Address the following comment on test/restart-resources.e2e.test.ts at line 44:

<comment>Use the E2E-specific access token environment variable for authentication in tests to avoid targeting the wrong environment. Prefer reusing the shared client setup helper or switch this line to the E2E token.</comment>

<file context>
@@ -30,3 +37,13 @@ describe(&quot;Restart platform resources using the SDK&quot;, () =&gt; {
+async function findBlockchainNodeByName(blockchainNodeName: string) {
+  const env: Partial&lt;DotEnv&gt; = await loadEnv(false, false);
+  const settlemint = createSettleMintClient({
+    accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
+    instance: env.SETTLEMINT_INSTANCE!,
+  });
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e fix Bug fix qa:success QA workflow passed successfully status:ready-for-review Pull request is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants