Skip to content

Conversation

@janb87
Copy link
Contributor

@janb87 janb87 commented Sep 10, 2025

Summary by Sourcery

Improve reliability of Hasura E2E and project setup tests by handling missing tables, ensuring a clean install, and preventing URL rewriting errors

Bug Fixes:

  • Accept "no-tables" as a valid result in Hasura table tracking and skip the dependent user query test when no tables are present

Enhancements:

  • Remove node_modules before linking SDK dependencies and run bun run db:push to apply database migrations prior to Hasura table tracking in standalone and SettleMint project setup tests
  • Exclude SETTLEMINT_HASURA_DATABASE_URL from access token URL injection logic to avoid incorrect URL rewriting

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 10, 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.

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 stability and reliability of the end-to-end test suite, particularly for functionalities involving Hasura and project setup. The changes ensure more consistent test outcomes by addressing environment setup, dependency linking, and database synchronization, making the tests more robust against varying initial states.

Highlights

  • Test Setup Improvement: Added a step to remove node_modules before linking local SDK dependencies in e2e tests, ensuring a clean and consistent test environment.
  • Hasura Test Reliability: Introduced bun run db:push before Hasura table tracking tests to ensure the database schema is up-to-date, preventing failures due to missing tables.
  • Robust Hasura E2E Tests: Modified the hasura.e2e.test.ts to gracefully handle scenarios where no tables are present for tracking, and conditionally execute queries only when tables have been successfully tracked.
  • Environment Variable Handling: Corrected the processing of SETTLEMINT_HASURA_DATABASE_URL in standalone project setup to prevent incorrect access token encoding.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 Sep 10, 2025
@github-actions
Copy link

github-actions bot commented Sep 10, 2025

To view in Slack, search for: 1757517720.672099

@github-actions github-actions bot added the status:ready-for-review Pull request is ready for review label Sep 10, 2025
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 - here's some feedback:

  • The hasTables flag and conditional skipping introduces test coupling based on execution order; consider using a dedicated setup (e.g. beforeAll) to ensure tables exist for all relevant tests.
  • Repeated cleanup (rm -rf node_modules) and bun run db:push commands across tests could be centralized into shared fixtures or before hooks to DRY up and speed up the test suite.
  • The inline URL token injection logic is duplicated in multiple tests—extract this into a shared helper function to improve maintainability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `hasTables` flag and conditional skipping introduces test coupling based on execution order; consider using a dedicated setup (e.g. beforeAll) to ensure tables exist for all relevant tests.
- Repeated cleanup (`rm -rf node_modules`) and `bun run db:push` commands across tests could be centralized into shared fixtures or before hooks to DRY up and speed up the test suite.
- The inline URL token injection logic is duplicated in multiple tests—extract this into a shared helper function to improve maintainability.

## Individual Comments

### Comment 1
<location> `test/hasura.e2e.test.ts:55` </location>
<code_context>
   });

   test("can query users", async () => {
+    if (!hasTables) {
+      // We can only execute this test if there are tables tracked
+      // Depends on the test order, test/create-new-standalone-project.e2e.test.ts and test/create-new-settlemint-project.e2e.test.ts will create the tables
+      return;
+    }
     const query = hasuraClient.graphql(`
</code_context>

<issue_to_address>
Test skipping based on state may hide failures; consider using test.skip or test.todo for clarity.

Using conditional returns in tests reduces visibility in CI and reporting. Prefer test.skip or test.todo to explicitly indicate skipped tests, enhancing clarity and maintainability.
</issue_to_address>

### Comment 2
<location> `test/create-new-standalone-project.e2e.test.ts:272` </location>
<code_context>
   });

   test("hasura - Track tables", async () => {
+    await $`bun run db:push`.cwd(dAppDir);
     const { output } = await runCommand(COMMAND_TEST_SCOPE, ["hasura", "track", "--accept-defaults"], {
       cwd: projectDir,
     }).result;
</code_context>

<issue_to_address>
No assertions on the result of 'bun run db:push'; consider verifying its success.

Consider adding assertions to confirm the migration succeeded, such as checking the command's output or exit code.
</issue_to_address>

### Comment 3
<location> `test/create-new-settlemint-project.e2e.test.ts:253` </location>
<code_context>
   });

   test("hasura - Track tables", async () => {
+    await $`bun run db:push`.cwd(dAppDir);
     const { output } = await runCommand(COMMAND_TEST_SCOPE, ["hasura", "track", "--accept-defaults"], {
       cwd: projectDir,
     }).result;
</code_context>

<issue_to_address>
No assertions on the result of 'bun run db:push'; consider verifying its success.

Add assertions to confirm the migration succeeded, such as checking the command's output or exit code.
</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.

@dosubot dosubot bot added fix Bug fix test Test additions or modifications labels Sep 10, 2025
@dosubot
Copy link

dosubot bot commented Sep 10, 2025

Related Documentation

Checked 1 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

@github-actions
Copy link

📦 Packages

Package NPM Docker
SDK Cli @settlemint/[email protected]
SDK The Graph @settlemint/[email protected]
SDK Portal @settlemint/[email protected]
SDK Hasura @settlemint/[email protected]
SDK JS @settlemint/[email protected]
SDK Utils @settlemint/[email protected]
SDK Next @settlemint/[email protected]
SDK Minio @settlemint/[email protected]
SDK IPFS @settlemint/[email protected]
SDK Blockscout @settlemint/[email protected]
SDK MCP @settlemint/[email protected]
SDK Viem @settlemint/[email protected]
SDK EAS @settlemint/[email protected]

@github-actions github-actions bot added qa:success QA workflow passed successfully and removed qa:running QA workflow is currently running labels Sep 10, 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 fixes an end-to-end test for Hasura. The changes include ensuring a clean dependency installation, pushing database schema changes before tracking tables, and making the tests more robust when no tables are present. My review focuses on improving the test design in test/hasura.e2e.test.ts. I've pointed out issues with shared state between tests and dependencies between test files, which can lead to fragility. I've suggested combining two tests into one to improve isolation and clarity, and also recommended a more robust long-term solution to make the test suite self-contained.

@janb87 janb87 merged commit d3ce337 into main Sep 10, 2025
20 checks passed
@janb87 janb87 deleted the jan/eng-3749-signer-meta-transactions-is-broken-for-btp branch September 10, 2025 15:24
@dosubot
Copy link

dosubot bot commented Sep 10, 2025

Documentation Updates

Checked 1 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

@github-actions github-actions bot added status:merged Pull request has been merged and removed status:ready-for-review Pull request is ready for review labels Sep 10, 2025
robbeverhelst pushed a commit that referenced this pull request Sep 18, 2025
## Summary by Sourcery

Improve reliability of Hasura E2E and project setup tests by handling
missing tables, ensuring a clean install, and preventing URL rewriting
errors

Bug Fixes:
- Accept "no-tables" as a valid result in Hasura table tracking and skip
the dependent user query test when no tables are present

Enhancements:
- Remove node_modules before linking SDK dependencies and run `bun run
db:push` to apply database migrations prior to Hasura table tracking in
standalone and SettleMint project setup tests
- Exclude SETTLEMINT_HASURA_DATABASE_URL from access token URL injection
logic to avoid incorrect URL rewriting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix qa:success QA workflow passed successfully size:S This PR changes 10-29 lines, ignoring generated files. status:merged Pull request has been merged test Test additions or modifications

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants