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

Note

Switches Bun installs to the hoisted linker and resolves the blockchain node dynamically in e2e tests.

  • E2E Tests:
    • Dependency installation: Use bun install --no-cache --linker=hoisted in test/create-new-settlemint-project.e2e.test.ts and test/create-new-standalone-project.e2e.test.ts.
    • Resource restart: In test/restart-resources.e2e.test.ts, resolve blockchain node via findBlockchainNodeByName and pass blockchainNode.uniqueName to platform restart, with a not-found guard.

Written by Cursor Bugbot for commit 245d6fc. This will update automatically on new commits. Configure here.

@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
cursor[bot]

This comment was marked as outdated.

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

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

📦 Packages

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

@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
@coderabbitai
Copy link

coderabbitai bot commented Oct 28, 2025

Caution

Review failed

The pull request is closed.

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

Adds the Bun installer flag --linker=hoisted to two end-to-end tests that install dependencies and link the SDK (create-new-settlemint-project.e2e.test.ts, create-new-standalone-project.e2e.test.ts). In restart-resources.e2e.test.ts the test now looks up a blockchain node at runtime via findBlockchainNodeByName, throws if not found, and uses the node's uniqueName when issuing the restart command; related import was added. No public API declarations were changed.

Possibly related PRs

  • settlemint/sdk PR 1034: Modifies the same test/restart-resources.e2e.test.ts file to add post-restart HTTP health checks in the restart flow.
  • settlemint/sdk PR 1391: Applies the same edits across the e2e tests — adding --linker=hoisted to Bun install commands and introducing dynamic blockchain node lookup in restart-resources.e2e.test.ts.

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.

📜 Recent 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 fe238e5 and 245d6fc.

📒 Files selected for processing (1)
  • test/restart-resources.e2e.test.ts (2 hunks)

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

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.

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.

@janb87 janb87 merged commit fa1c272 into main Nov 3, 2025
9 of 10 checks passed
@janb87 janb87 deleted the jan/e2e-test-bun13 branch November 3, 2025 13:29
@github-actions github-actions bot added qa:running QA workflow is currently running status:merged Pull request has been merged and removed qa:success QA workflow passed successfully status:ready-for-review Pull request is ready for review labels Nov 3, 2025
"restart",
"blockchain-node",
NODE_NAME_3_WITHOUT_PK,
blockchainNode.uniqueName,
Copy link

Choose a reason for hiding this comment

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

Bug: Name Mismatch in Restart Command Output

The restart command now uses blockchainNode.uniqueName, but the test's output assertion still expects the hardcoded NODE_NAME_3_WITHOUT_PK. If these names differ, the test will fail because the output message will contain the uniqueName.

Fix in Cursor Fix in Web

@github-actions github-actions bot added qa:success QA workflow passed successfully status:ready-for-review Pull request is ready for review and removed qa:running QA workflow is currently running status:merged Pull request has been merged labels Nov 3, 2025
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