Skip to content

Migrate Fuel and SVM test scenarios into test suite - #1501

Closed
DZakh wants to merge 1 commit into
mainfrom
claude/fuel-svm-user-api-indexer-1ygy6x
Closed

Migrate Fuel and SVM test scenarios into test suite#1501
DZakh wants to merge 1 commit into
mainfrom
claude/fuel-svm-user-api-indexer-1ygy6x

Conversation

@DZakh

@DZakh DZakh commented Jul 28, 2026

Copy link
Copy Markdown
Member

Move the standalone fuel_test and svm_test scenario directories into the main test suite under packages/envio-tests/test/, consolidating test infrastructure and improving maintainability.

Summary

This refactors the test organization by:

  • Converting scenarios/fuel_test into packages/envio-tests/test/FuelIndexer_test.res and packages/envio-tests/test/FuelSwayTypes_test.res
  • Converting scenarios/svm_test into snapshot tests via packages/envio-tests/test/IndexerCode_test.res
  • Moving Fuel contract ABIs and sources to scenarios/fuel_contracts/ for shared fixture use
  • Removing standalone scenario project files (config.yaml, package.json, tsconfig.json, etc.)

Key Changes

  • Test consolidation: Fuel and SVM tests now use InternalTestIndexer.fromUserApi() to exercise the public indexer API within the test suite, eliminating duplicate test infrastructure
  • Fixture management: Added FuelAbiFixtures.allEvents fixture with comprehensive Sway type coverage (options, results, structs, arrays, enums)
  • Generated code snapshots: Added FuelIndexer.res snapshot under packages/envio-tests/test/generated/ to type-check ReScript codegen output alongside the test suite
  • API expansion: Extended fromUserApiOptions with withIndexerCode flag to capture generated src/Indexer.res for snapshot testing
  • Vitest integration: Added toMatchFileSnapshot binding to support snapshot assertions on generated code

Implementation Details

  • Fuel tests now validate both the public TypeScript handler API (FuelIndexer_test.res) and Sway type decoding (FuelSwayTypes_test.res)
  • SVM tests reduced to a single snapshot assertion on generated Indexer.res output
  • Removed all scenario-specific configuration files; tests now inline config as strings
  • CI workflow updated to remove fuel_test and svm_test scenario runs

https://claude.ai/code/session_01Bn64AnArY4CprWGbwk7V8f

Summary by CodeRabbit

  • New Features

    • Added an option to retrieve generated ReScript indexer code alongside generated type definitions.
    • Added snapshot support for generated indexer code across Fuel and SVM projects.
    • Expanded Fuel contract coverage, ABI fixtures, event decoding, and interaction examples.
  • Bug Fixes

    • Improved Fuel and EVM event-filter type separation.
    • Corrected default end-block handling and validated SVM slot resumption behavior.
  • Documentation

    • Added guidance for Fuel contract fixtures, ABI regeneration, and TypeScript interactions.

Both scenarios existed to exercise Fuel and SVM through a real project on
disk. `InternalTestIndexer.fromUserApi` now covers the same ground from a
config + handler/test source strings, so the coverage moves into
`packages/envio-tests` and the two scenarios go away.

- FuelIndexer_test: Greeter simulate run through the public
  `createTestIndexer`, proving Fuel `process({simulate})` works with no
  project on disk. Adds a ClearGreeting case the scenario never ran.
- FuelSwayTypes_test: every Sway log shape from the all-events ABI, pinned
  against the generated `event.params` types.
- FuelHandlersApi_test: the Fuel/EVM where-filter asymmetry guards that
  lived in the scenario's `_regression-check.ts`.
- FuelHyperSyncSource_test: moved verbatim; it never needed a project.
- SlotResume_test / TokenIndexer_test: absorb the remaining SVM chain-wiring
  asserts and the endBlock-defaults case (re-homed as EVM).

`from_user_api` gains `with_indexer_code`, returning the generated
`src/Indexer.res`. IndexerCode_test snapshots it for Fuel and SVM into
`test/generated/`, which is part of this package's ReScript sources — so
`pnpm rescript` type-checks the codegen output for both ecosystems, which
previously only happened inside the deleted scenarios.

The Sway contracts and ABIs behind the fixtures stay as
`scenarios/fuel_contracts`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bn64AnArY4CprWGbwk7V8f
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 488805e4-701c-4cf5-8c1e-4297c9eeb479

📥 Commits

Reviewing files that changed from the base of the PR and between 6284551 and d92b775.

⛔ Files ignored due to path filters (5)
  • packages/envio-tests/test/generated/FuelIndexer.res is excluded by !**/generated/**
  • packages/envio-tests/test/generated/SvmIndexer.res is excluded by !**/generated/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • scenarios/fuel_contracts/contracts/all-events/Forc.lock is excluded by !**/*.lock
  • scenarios/fuel_contracts/contracts/interaction-tools/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (63)
  • .github/workflows/build_and_verify.yml
  • package.json
  • packages/cli/src/hbs_templating/codegen_templates.rs
  • packages/cli/src/napi.rs
  • packages/envio-tests/test/FuelHandlersApi_test.res
  • packages/envio-tests/test/FuelHyperSyncSource_test.res
  • packages/envio-tests/test/FuelIndexer_test.res
  • packages/envio-tests/test/FuelSwayTypes_test.res
  • packages/envio-tests/test/IndexerCode_test.res
  • packages/envio-tests/test/SlotResume_test.res
  • packages/envio-tests/test/TokenIndexer_test.res
  • packages/envio-tests/test/helpers/FuelAbiFixtures.res
  • packages/envio-tests/test/helpers/InternalTestIndexer.res
  • packages/envio/src/Core.res
  • packages/envio/src/bindings/Vitest.res
  • scenarios/fuel_contracts/README.md
  • scenarios/fuel_contracts/abis/all-events-abi.json
  • scenarios/fuel_contracts/abis/greeter-abi.json
  • scenarios/fuel_contracts/contracts/all-events/.gitignore
  • scenarios/fuel_contracts/contracts/all-events/Forc.toml
  • scenarios/fuel_contracts/contracts/all-events/src/main.sw
  • scenarios/fuel_contracts/contracts/interaction-tools/.env.example
  • scenarios/fuel_contracts/contracts/interaction-tools/.gitignore
  • scenarios/fuel_contracts/contracts/interaction-tools/Cargo.toml
  • scenarios/fuel_contracts/contracts/interaction-tools/src/main.rs
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/.env.example
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/.gitignore
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/README.md
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/package.json
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/src/@types/env.d.ts
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.ts
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/tsconfig.json
  • scenarios/fuel_test/.env.example
  • scenarios/fuel_test/.envio/.gitignore
  • scenarios/fuel_test/.gitignore
  • scenarios/fuel_test/README.md
  • scenarios/fuel_test/config.yaml
  • scenarios/fuel_test/envio-env.d.ts
  • scenarios/fuel_test/package.json
  • scenarios/fuel_test/rescript.json
  • scenarios/fuel_test/schema.graphql
  • scenarios/fuel_test/src/AllEventsHandlers.ts
  • scenarios/fuel_test/src/GreeterHandlers.ts
  • scenarios/fuel_test/src/Indexer.res
  • scenarios/fuel_test/src/_regression-check.ts
  • scenarios/fuel_test/test/ConfigView.test.ts
  • scenarios/fuel_test/test/test.ts
  • scenarios/fuel_test/tsconfig.json
  • scenarios/fuel_test/vitest.config.ts
  • scenarios/svm_test/.envio/.gitignore
  • scenarios/svm_test/.gitignore
  • scenarios/svm_test/README.md
  • scenarios/svm_test/config.yaml
  • scenarios/svm_test/envio-env.d.ts
  • scenarios/svm_test/package.json
  • scenarios/svm_test/rescript.json
  • scenarios/svm_test/schema.graphql
  • scenarios/svm_test/src/handlers/SlotHandler.ts
  • scenarios/svm_test/test/ConfigView.test.ts
  • scenarios/svm_test/test/SlotHandler.test.ts
  • scenarios/svm_test/tsconfig.json
  • scenarios/svm_test/vitest.config.ts
  • scenarios/test_codegen/src/handlers/EventHandlers.ts
💤 Files with no reviewable changes (31)
  • scenarios/fuel_test/README.md
  • scenarios/svm_test/.envio/.gitignore
  • scenarios/svm_test/envio-env.d.ts
  • scenarios/svm_test/.gitignore
  • scenarios/svm_test/package.json
  • scenarios/svm_test/rescript.json
  • scenarios/fuel_test/package.json
  • scenarios/fuel_test/config.yaml
  • scenarios/svm_test/test/ConfigView.test.ts
  • scenarios/svm_test/test/SlotHandler.test.ts
  • scenarios/svm_test/README.md
  • scenarios/fuel_test/rescript.json
  • scenarios/fuel_test/test/test.ts
  • scenarios/fuel_test/.envio/.gitignore
  • scenarios/fuel_test/vitest.config.ts
  • scenarios/svm_test/src/handlers/SlotHandler.ts
  • scenarios/fuel_test/test/ConfigView.test.ts
  • scenarios/fuel_test/envio-env.d.ts
  • scenarios/fuel_test/src/_regression-check.ts
  • scenarios/svm_test/tsconfig.json
  • scenarios/svm_test/config.yaml
  • scenarios/svm_test/schema.graphql
  • .github/workflows/build_and_verify.yml
  • scenarios/svm_test/vitest.config.ts
  • scenarios/fuel_test/.env.example
  • scenarios/fuel_test/schema.graphql
  • scenarios/fuel_test/.gitignore
  • scenarios/fuel_test/src/GreeterHandlers.ts
  • scenarios/fuel_test/tsconfig.json
  • scenarios/fuel_test/src/Indexer.res
  • scenarios/fuel_test/src/AllEventsHandlers.ts

📝 Walkthrough

Walkthrough

The change adds optional generated Indexer.res output to the user API, introduces Fuel contract fixtures and interaction tools, moves Fuel and SVM regression coverage into centralized tests, and updates scenario test execution to use test_codegen.

Changes

Code generation API and snapshots

Layer / File(s) Summary
Expose generated indexer code
packages/cli/src/hbs_templating/codegen_templates.rs, packages/cli/src/napi.rs, packages/envio/src/Core.res, packages/envio-tests/test/helpers/InternalTestIndexer.res
The user API and test helper accept withIndexerCode and return generated Indexer.res contents alongside existing generated types.
Snapshot generated Indexer.res output
packages/envio-tests/test/IndexerCode_test.res, packages/envio/src/bindings/Vitest.res
Fuel and SVM code-generation tests compare generated output with file snapshots using toMatchFileSnapshot.

Fuel fixtures and regression coverage

Layer / File(s) Summary
Add Fuel contract fixtures and interaction tools
scenarios/fuel_contracts/**, packages/envio-tests/test/helpers/FuelAbiFixtures.res
Fuel ABI artifacts, Sway contracts, and Rust and TypeScript tools define and exercise Greeter, LiquidityPool, and AllEvents behavior.
Move and expand regression coverage
packages/envio-tests/test/Fuel*, packages/envio-tests/test/SlotResume_test.res, packages/envio-tests/test/TokenIndexer_test.res
Centralized tests cover Fuel event filter types, ABI decoding, Greeter state handling, HyperSync responses, slot resumption, and simulated block reporting.

Scenario test consolidation

Layer / File(s) Summary
Update scenario execution and references
.github/workflows/build_and_verify.yml, package.json, scenarios/test_codegen/src/handlers/EventHandlers.ts, scenarios/fuel_test/*, scenarios/svm_test/*
CI and package scripts run test_codegen instead of the removed standalone Fuel and SVM scenarios; obsolete scenario content is removed and comments reference centralized tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Test
  participant InternalTestIndexer
  participant Core
  participant ProjectTemplate
  Test->>InternalTestIndexer: request withIndexerCode
  InternalTestIndexer->>Core: call fromUserApi
  Core->>ProjectTemplate: generate project output
  ProjectTemplate-->>Core: return Indexer.res
  Core-->>InternalTestIndexer: return indexerCode
  InternalTestIndexer-->>Test: match file snapshot
Loading

Possibly related PRs

  • enviodev/hyperindex#1488: Updates the same InternalTestIndexer.fromUserApi helper with related signature and payload changes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: migrating Fuel and SVM scenario tests into the shared test suite.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
packages/envio-tests/test/FuelSwayTypes_test.res (1)

103-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove comments that only narrate code.

  • packages/envio-tests/test/FuelSwayTypes_test.res#L103-L103: remove the comment restating what assertParams does.
  • packages/envio-tests/test/FuelIndexer_test.res#L1-L2: remove the module-purpose comment.

As per coding guidelines, "**/*.res: Default to writing no comments" and "Don't write a comment that restates what the code already says — module purpose, what a function does."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/envio-tests/test/FuelSwayTypes_test.res` at line 103, Remove the
narrating comment near assertParams in
packages/envio-tests/test/FuelSwayTypes_test.res at lines 103-103. Also remove
the module-purpose comment in packages/envio-tests/test/FuelIndexer_test.res at
lines 1-2; no replacement comments are needed.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/envio-tests/test/FuelHyperSyncSource_test.res`:
- Around line 12-13: Update the helper using the external close symbol to await
server shutdown before returning. Wrap close in a promise and await it on both
success and error paths, ensuring listener handles are fully released before the
helper exits.

In `@packages/envio-tests/test/FuelIndexer_test.res`:
- Around line 97-109: The simulated greeting in the `simulate` array and its
corresponding `expected.latestGreeting` entry must be eight characters or fewer
to match the ABI’s `str[8]` event field. Replace “Oh hello again” consistently
in both locations with a suitable shorter greeting, preserving the expected
greeting count and ordering.

In `@scenarios/fuel_contracts/contracts/interaction-tools/.env.example`:
- Line 1: Correct the environment variable name in the .env.example entry from
MNENOMIC to MNEMONIC so it matches the key read by main.rs and allows
bootstrapped configurations to provide the mnemonic.

In `@scenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.ts`:
- Around line 11-18: Update the deployment entrypoint around the MNEMONIC and
PROVIDER_URL validation and its catch handler so validation and operational
failures use the same error path. Ensure the catch logs the failure and then
rethrows it or sets a non-zero process exit code, while preserving successful
deployment behavior.

---

Nitpick comments:
In `@packages/envio-tests/test/FuelSwayTypes_test.res`:
- Line 103: Remove the narrating comment near assertParams in
packages/envio-tests/test/FuelSwayTypes_test.res at lines 103-103. Also remove
the module-purpose comment in packages/envio-tests/test/FuelIndexer_test.res at
lines 1-2; no replacement comments are needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 488805e4-701c-4cf5-8c1e-4297c9eeb479

📥 Commits

Reviewing files that changed from the base of the PR and between 6284551 and d92b775.

⛔ Files ignored due to path filters (5)
  • packages/envio-tests/test/generated/FuelIndexer.res is excluded by !**/generated/**
  • packages/envio-tests/test/generated/SvmIndexer.res is excluded by !**/generated/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • scenarios/fuel_contracts/contracts/all-events/Forc.lock is excluded by !**/*.lock
  • scenarios/fuel_contracts/contracts/interaction-tools/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (63)
  • .github/workflows/build_and_verify.yml
  • package.json
  • packages/cli/src/hbs_templating/codegen_templates.rs
  • packages/cli/src/napi.rs
  • packages/envio-tests/test/FuelHandlersApi_test.res
  • packages/envio-tests/test/FuelHyperSyncSource_test.res
  • packages/envio-tests/test/FuelIndexer_test.res
  • packages/envio-tests/test/FuelSwayTypes_test.res
  • packages/envio-tests/test/IndexerCode_test.res
  • packages/envio-tests/test/SlotResume_test.res
  • packages/envio-tests/test/TokenIndexer_test.res
  • packages/envio-tests/test/helpers/FuelAbiFixtures.res
  • packages/envio-tests/test/helpers/InternalTestIndexer.res
  • packages/envio/src/Core.res
  • packages/envio/src/bindings/Vitest.res
  • scenarios/fuel_contracts/README.md
  • scenarios/fuel_contracts/abis/all-events-abi.json
  • scenarios/fuel_contracts/abis/greeter-abi.json
  • scenarios/fuel_contracts/contracts/all-events/.gitignore
  • scenarios/fuel_contracts/contracts/all-events/Forc.toml
  • scenarios/fuel_contracts/contracts/all-events/src/main.sw
  • scenarios/fuel_contracts/contracts/interaction-tools/.env.example
  • scenarios/fuel_contracts/contracts/interaction-tools/.gitignore
  • scenarios/fuel_contracts/contracts/interaction-tools/Cargo.toml
  • scenarios/fuel_contracts/contracts/interaction-tools/src/main.rs
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/.env.example
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/.gitignore
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/README.md
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/package.json
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/src/@types/env.d.ts
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.ts
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/tsconfig.json
  • scenarios/fuel_test/.env.example
  • scenarios/fuel_test/.envio/.gitignore
  • scenarios/fuel_test/.gitignore
  • scenarios/fuel_test/README.md
  • scenarios/fuel_test/config.yaml
  • scenarios/fuel_test/envio-env.d.ts
  • scenarios/fuel_test/package.json
  • scenarios/fuel_test/rescript.json
  • scenarios/fuel_test/schema.graphql
  • scenarios/fuel_test/src/AllEventsHandlers.ts
  • scenarios/fuel_test/src/GreeterHandlers.ts
  • scenarios/fuel_test/src/Indexer.res
  • scenarios/fuel_test/src/_regression-check.ts
  • scenarios/fuel_test/test/ConfigView.test.ts
  • scenarios/fuel_test/test/test.ts
  • scenarios/fuel_test/tsconfig.json
  • scenarios/fuel_test/vitest.config.ts
  • scenarios/svm_test/.envio/.gitignore
  • scenarios/svm_test/.gitignore
  • scenarios/svm_test/README.md
  • scenarios/svm_test/config.yaml
  • scenarios/svm_test/envio-env.d.ts
  • scenarios/svm_test/package.json
  • scenarios/svm_test/rescript.json
  • scenarios/svm_test/schema.graphql
  • scenarios/svm_test/src/handlers/SlotHandler.ts
  • scenarios/svm_test/test/ConfigView.test.ts
  • scenarios/svm_test/test/SlotHandler.test.ts
  • scenarios/svm_test/tsconfig.json
  • scenarios/svm_test/vitest.config.ts
  • scenarios/test_codegen/src/handlers/EventHandlers.ts
💤 Files with no reviewable changes (31)
  • scenarios/fuel_test/README.md
  • scenarios/svm_test/.envio/.gitignore
  • scenarios/svm_test/envio-env.d.ts
  • scenarios/svm_test/.gitignore
  • scenarios/svm_test/package.json
  • scenarios/svm_test/rescript.json
  • scenarios/fuel_test/package.json
  • scenarios/fuel_test/config.yaml
  • scenarios/svm_test/test/ConfigView.test.ts
  • scenarios/svm_test/test/SlotHandler.test.ts
  • scenarios/svm_test/README.md
  • scenarios/fuel_test/rescript.json
  • scenarios/fuel_test/test/test.ts
  • scenarios/fuel_test/.envio/.gitignore
  • scenarios/fuel_test/vitest.config.ts
  • scenarios/svm_test/src/handlers/SlotHandler.ts
  • scenarios/fuel_test/test/ConfigView.test.ts
  • scenarios/fuel_test/envio-env.d.ts
  • scenarios/fuel_test/src/_regression-check.ts
  • scenarios/svm_test/tsconfig.json
  • scenarios/svm_test/config.yaml
  • scenarios/svm_test/schema.graphql
  • .github/workflows/build_and_verify.yml
  • scenarios/svm_test/vitest.config.ts
  • scenarios/fuel_test/.env.example
  • scenarios/fuel_test/schema.graphql
  • scenarios/fuel_test/.gitignore
  • scenarios/fuel_test/src/GreeterHandlers.ts
  • scenarios/fuel_test/tsconfig.json
  • scenarios/fuel_test/src/Indexer.res
  • scenarios/fuel_test/src/AllEventsHandlers.ts

Comment on lines +97 to +109
simulate: [
newGreeting(user, "Hi there"),
newGreeting(user, "Oh hello again"),
],
},
},
});

const expected: User = {
id: user,
latestGreeting: "Oh hello again",
numberOfGreetings: 2,
greetings: ["Hi there", "Oh hello again"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep simulated greetings within the ABI’s str[8] bound.

Line 99 uses "Oh hello again" (14 characters), but scenarios/fuel_contracts/abis/greeter-abi.json declares the event field as str[8]. Use an eight-character-or-shorter value so this test represents an event the contract can emit.

Proposed fix
-            newGreeting(user, "Oh hello again"),
+            newGreeting(user, "Hi again"),
...
-      latestGreeting: "Oh hello again",
+      latestGreeting: "Hi again",
...
-      greetings: ["Hi there", "Oh hello again"],
+      greetings: ["Hi there", "Hi again"],
📝 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
simulate: [
newGreeting(user, "Hi there"),
newGreeting(user, "Oh hello again"),
],
},
},
});
const expected: User = {
id: user,
latestGreeting: "Oh hello again",
numberOfGreetings: 2,
greetings: ["Hi there", "Oh hello again"],
simulate: [
newGreeting(user, "Hi there"),
newGreeting(user, "Hi again"),
],
},
},
});
const expected: User = {
id: user,
latestGreeting: "Hi again",
numberOfGreetings: 2,
greetings: ["Hi there", "Hi again"],
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/envio-tests/test/FuelIndexer_test.res` around lines 97 - 109, The
simulated greeting in the `simulate` array and its corresponding
`expected.latestGreeting` entry must be eight characters or fewer to match the
ABI’s `str[8]` event field. Replace “Oh hello again” consistently in both
locations with a suitable shorter greeting, preserving the expected greeting
count and ordering.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

🧹 Nitpick comments (1)
packages/envio-tests/test/FuelSwayTypes_test.res (1)

103-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove comments that only narrate code.

  • packages/envio-tests/test/FuelSwayTypes_test.res#L103-L103: remove the comment restating what assertParams does.
  • packages/envio-tests/test/FuelIndexer_test.res#L1-L2: remove the module-purpose comment.

As per coding guidelines, "**/*.res: Default to writing no comments" and "Don't write a comment that restates what the code already says — module purpose, what a function does."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/envio-tests/test/FuelSwayTypes_test.res` at line 103, Remove the
narrating comment near assertParams in
packages/envio-tests/test/FuelSwayTypes_test.res at lines 103-103. Also remove
the module-purpose comment in packages/envio-tests/test/FuelIndexer_test.res at
lines 1-2; no replacement comments are needed.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/envio-tests/test/FuelHyperSyncSource_test.res`:
- Around line 12-13: Update the helper using the external close symbol to await
server shutdown before returning. Wrap close in a promise and await it on both
success and error paths, ensuring listener handles are fully released before the
helper exits.

In `@packages/envio-tests/test/FuelIndexer_test.res`:
- Around line 97-109: The simulated greeting in the `simulate` array and its
corresponding `expected.latestGreeting` entry must be eight characters or fewer
to match the ABI’s `str[8]` event field. Replace “Oh hello again” consistently
in both locations with a suitable shorter greeting, preserving the expected
greeting count and ordering.

In `@scenarios/fuel_contracts/contracts/interaction-tools/.env.example`:
- Line 1: Correct the environment variable name in the .env.example entry from
MNENOMIC to MNEMONIC so it matches the key read by main.rs and allows
bootstrapped configurations to provide the mnemonic.

In `@scenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.ts`:
- Around line 11-18: Update the deployment entrypoint around the MNEMONIC and
PROVIDER_URL validation and its catch handler so validation and operational
failures use the same error path. Ensure the catch logs the failure and then
rethrows it or sets a non-zero process exit code, while preserving successful
deployment behavior.

---

Nitpick comments:
In `@packages/envio-tests/test/FuelSwayTypes_test.res`:
- Line 103: Remove the narrating comment near assertParams in
packages/envio-tests/test/FuelSwayTypes_test.res at lines 103-103. Also remove
the module-purpose comment in packages/envio-tests/test/FuelIndexer_test.res at
lines 1-2; no replacement comments are needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 488805e4-701c-4cf5-8c1e-4297c9eeb479

📥 Commits

Reviewing files that changed from the base of the PR and between 6284551 and d92b775.

⛔ Files ignored due to path filters (5)
  • packages/envio-tests/test/generated/FuelIndexer.res is excluded by !**/generated/**
  • packages/envio-tests/test/generated/SvmIndexer.res is excluded by !**/generated/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • scenarios/fuel_contracts/contracts/all-events/Forc.lock is excluded by !**/*.lock
  • scenarios/fuel_contracts/contracts/interaction-tools/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (63)
  • .github/workflows/build_and_verify.yml
  • package.json
  • packages/cli/src/hbs_templating/codegen_templates.rs
  • packages/cli/src/napi.rs
  • packages/envio-tests/test/FuelHandlersApi_test.res
  • packages/envio-tests/test/FuelHyperSyncSource_test.res
  • packages/envio-tests/test/FuelIndexer_test.res
  • packages/envio-tests/test/FuelSwayTypes_test.res
  • packages/envio-tests/test/IndexerCode_test.res
  • packages/envio-tests/test/SlotResume_test.res
  • packages/envio-tests/test/TokenIndexer_test.res
  • packages/envio-tests/test/helpers/FuelAbiFixtures.res
  • packages/envio-tests/test/helpers/InternalTestIndexer.res
  • packages/envio/src/Core.res
  • packages/envio/src/bindings/Vitest.res
  • scenarios/fuel_contracts/README.md
  • scenarios/fuel_contracts/abis/all-events-abi.json
  • scenarios/fuel_contracts/abis/greeter-abi.json
  • scenarios/fuel_contracts/contracts/all-events/.gitignore
  • scenarios/fuel_contracts/contracts/all-events/Forc.toml
  • scenarios/fuel_contracts/contracts/all-events/src/main.sw
  • scenarios/fuel_contracts/contracts/interaction-tools/.env.example
  • scenarios/fuel_contracts/contracts/interaction-tools/.gitignore
  • scenarios/fuel_contracts/contracts/interaction-tools/Cargo.toml
  • scenarios/fuel_contracts/contracts/interaction-tools/src/main.rs
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/.env.example
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/.gitignore
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/README.md
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/package.json
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/src/@types/env.d.ts
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.ts
  • scenarios/fuel_contracts/contracts/ts-interaction-tools/tsconfig.json
  • scenarios/fuel_test/.env.example
  • scenarios/fuel_test/.envio/.gitignore
  • scenarios/fuel_test/.gitignore
  • scenarios/fuel_test/README.md
  • scenarios/fuel_test/config.yaml
  • scenarios/fuel_test/envio-env.d.ts
  • scenarios/fuel_test/package.json
  • scenarios/fuel_test/rescript.json
  • scenarios/fuel_test/schema.graphql
  • scenarios/fuel_test/src/AllEventsHandlers.ts
  • scenarios/fuel_test/src/GreeterHandlers.ts
  • scenarios/fuel_test/src/Indexer.res
  • scenarios/fuel_test/src/_regression-check.ts
  • scenarios/fuel_test/test/ConfigView.test.ts
  • scenarios/fuel_test/test/test.ts
  • scenarios/fuel_test/tsconfig.json
  • scenarios/fuel_test/vitest.config.ts
  • scenarios/svm_test/.envio/.gitignore
  • scenarios/svm_test/.gitignore
  • scenarios/svm_test/README.md
  • scenarios/svm_test/config.yaml
  • scenarios/svm_test/envio-env.d.ts
  • scenarios/svm_test/package.json
  • scenarios/svm_test/rescript.json
  • scenarios/svm_test/schema.graphql
  • scenarios/svm_test/src/handlers/SlotHandler.ts
  • scenarios/svm_test/test/ConfigView.test.ts
  • scenarios/svm_test/test/SlotHandler.test.ts
  • scenarios/svm_test/tsconfig.json
  • scenarios/svm_test/vitest.config.ts
  • scenarios/test_codegen/src/handlers/EventHandlers.ts
💤 Files with no reviewable changes (31)
  • scenarios/fuel_test/README.md
  • scenarios/svm_test/.envio/.gitignore
  • scenarios/svm_test/envio-env.d.ts
  • scenarios/svm_test/.gitignore
  • scenarios/svm_test/package.json
  • scenarios/svm_test/rescript.json
  • scenarios/fuel_test/package.json
  • scenarios/fuel_test/config.yaml
  • scenarios/svm_test/test/ConfigView.test.ts
  • scenarios/svm_test/test/SlotHandler.test.ts
  • scenarios/svm_test/README.md
  • scenarios/fuel_test/rescript.json
  • scenarios/fuel_test/test/test.ts
  • scenarios/fuel_test/.envio/.gitignore
  • scenarios/fuel_test/vitest.config.ts
  • scenarios/svm_test/src/handlers/SlotHandler.ts
  • scenarios/fuel_test/test/ConfigView.test.ts
  • scenarios/fuel_test/envio-env.d.ts
  • scenarios/fuel_test/src/_regression-check.ts
  • scenarios/svm_test/tsconfig.json
  • scenarios/svm_test/config.yaml
  • scenarios/svm_test/schema.graphql
  • .github/workflows/build_and_verify.yml
  • scenarios/svm_test/vitest.config.ts
  • scenarios/fuel_test/.env.example
  • scenarios/fuel_test/schema.graphql
  • scenarios/fuel_test/.gitignore
  • scenarios/fuel_test/src/GreeterHandlers.ts
  • scenarios/fuel_test/tsconfig.json
  • scenarios/fuel_test/src/Indexer.res
  • scenarios/fuel_test/src/AllEventsHandlers.ts
🛑 Comments failed to post (3)
packages/envio-tests/test/FuelHyperSyncSource_test.res (1)

12-13: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -eu

fd -HI -a '^(package\.json|\.nvmrc|\.node-version|\.tool-versions)$' . \
  -x sh -c 'echo "--- $1"; sed -n "1,160p" "$1"' sh {}

Repository: enviodev/hyperindex

Length of output: 7368


🏁 Script executed:

#!/usr/bin/env bash
set -eu

# Inspect the test file and nearby helper code.
file="packages/envio-tests/test/FuelHyperSyncSource_test.res"
wc -l "$file"
cat -n "$file" | sed -n '1,220p'

# Find the server helper and the `close` binding usage.
rg -n --no-heading '\bclose\b|\blisten\b|withServer|Assert|expect\(' packages/envio-tests/test packages/envio-tests/src

Repository: enviodev/hyperindex

Length of output: 35070


🌐 Web query:

Node.js http.Server.close callback completion signal asynchronous shutdown documentation

💡 Result:

In Node.js, the server.close([callback]) method initiates an asynchronous shutdown process [1][2]. Calling it stops the server from accepting new connections [3][4]. The server will not fully close, and the provided callback will not be executed, until all existing connections have been terminated [1][2]. The shutdown behavior regarding connections is as follows: - Active connections: The server waits for active connections (those currently sending a request or waiting for a response) to finish [3][4]. - Idle (keep-alive) connections: As of Node.js 19.0.0, the server automatically terminates idle connections when server.close() is invoked to facilitate shutdown [4][5]. The callback function is executed only after the 'close' event is emitted [1][2]. This event signals that the server has stopped and all associated connections have been closed [1]. If you need to force a shutdown before all active connections have completed, you can use server.closeAllConnections(), which forcefully closes all connections, including those that are currently active [6][7]. It is recommended to call this after server.close() to avoid potential race conditions where new connections might be established between calls [4][7]. Additionally, server.closeIdleConnections() exists to specifically close connections that are not currently active [3][4]. While it was previously common to call this alongside server.close(), it is generally redundant for handling keep-alive connections in modern Node.js versions (19.0.0+) [4][7].

Citations:


Await server->close before returning. The helper can exit while the listener is still shutting down, which can leak handles into the next test; wrap close in a promise and await it in both the success and error paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/envio-tests/test/FuelHyperSyncSource_test.res` around lines 12 - 13,
Update the helper using the external close symbol to await server shutdown
before returning. Wrap close in a promise and await it on both success and error
paths, ensuring listener handles are fully released before the helper exits.
scenarios/fuel_contracts/contracts/interaction-tools/.env.example (1)

1-1: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

MNENOMIC typo mismatches the MNEMONIC env var actually read by main.rs.

main.rs reads env::var("MNEMONIC"), but this .env.example defines MNENOMIC (letters transposed). Anyone bootstrapping their .env from this example will hit the "MNEMONIC must be set in .env" panic even after setting the mnemonic.

🐛 Proposed fix
-MNENOMIC=
+MNEMONIC=
📝 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.

MNEMONIC=
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scenarios/fuel_contracts/contracts/interaction-tools/.env.example` at line 1,
Correct the environment variable name in the .env.example entry from MNENOMIC to
MNEMONIC so it matches the key read by main.rs and allows bootstrapped
configurations to provide the mnemonic.
scenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.ts (1)

11-18: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Propagate deployment failures to the process.

Validation errors bypass the catch, while operational errors are swallowed by it. A failed deployment can therefore be reported as a successful command. Put validation in the same error path and rethrow (or set a non-zero exit code) after logging.

Also applies to: 67-72

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.ts` around
lines 11 - 18, Update the deployment entrypoint around the MNEMONIC and
PROVIDER_URL validation and its catch handler so validation and operational
failures use the same error path. Ensure the catch logs the failure and then
rethrows it or sets a non-zero process exit code, while preserving successful
deployment behavior.

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

Copy link
Copy Markdown

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.

Reviewed commit: d92b77547f

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

to: Addresses.defaultAddress,
value: 1n,
},
block: { number: 50 },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the inferred-end-block check on Fuel

This replacement for the removed Fuel regression exercises an EVM chain and block.number, so it will still pass if Fuel's block.height inference breaks. TestIndexer.getSimulateEndBlock selects the field through config.ecosystem.blockNumberName, making the Fuel and EVM paths observably distinct; retain this assertion in FuelIndexer_test.res with chain 0 and { height: 50 } before deleting the original Fuel scenario.

Useful? React with 👍 / 👎.

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.

2 participants