Migrate Fuel and SVM test scenarios into test suite - #1501
Conversation
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
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (63)
💤 Files with no reviewable changes (31)
📝 WalkthroughWalkthroughThe change adds optional generated ChangesCode generation API and snapshots
Fuel fixtures and regression coverage
Scenario test consolidation
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
packages/envio-tests/test/FuelSwayTypes_test.res (1)
103-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove comments that only narrate code.
packages/envio-tests/test/FuelSwayTypes_test.res#L103-L103: remove the comment restating whatassertParamsdoes.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
⛔ Files ignored due to path filters (5)
packages/envio-tests/test/generated/FuelIndexer.resis excluded by!**/generated/**packages/envio-tests/test/generated/SvmIndexer.resis excluded by!**/generated/**pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlscenarios/fuel_contracts/contracts/all-events/Forc.lockis excluded by!**/*.lockscenarios/fuel_contracts/contracts/interaction-tools/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (63)
.github/workflows/build_and_verify.ymlpackage.jsonpackages/cli/src/hbs_templating/codegen_templates.rspackages/cli/src/napi.rspackages/envio-tests/test/FuelHandlersApi_test.respackages/envio-tests/test/FuelHyperSyncSource_test.respackages/envio-tests/test/FuelIndexer_test.respackages/envio-tests/test/FuelSwayTypes_test.respackages/envio-tests/test/IndexerCode_test.respackages/envio-tests/test/SlotResume_test.respackages/envio-tests/test/TokenIndexer_test.respackages/envio-tests/test/helpers/FuelAbiFixtures.respackages/envio-tests/test/helpers/InternalTestIndexer.respackages/envio/src/Core.respackages/envio/src/bindings/Vitest.resscenarios/fuel_contracts/README.mdscenarios/fuel_contracts/abis/all-events-abi.jsonscenarios/fuel_contracts/abis/greeter-abi.jsonscenarios/fuel_contracts/contracts/all-events/.gitignorescenarios/fuel_contracts/contracts/all-events/Forc.tomlscenarios/fuel_contracts/contracts/all-events/src/main.swscenarios/fuel_contracts/contracts/interaction-tools/.env.examplescenarios/fuel_contracts/contracts/interaction-tools/.gitignorescenarios/fuel_contracts/contracts/interaction-tools/Cargo.tomlscenarios/fuel_contracts/contracts/interaction-tools/src/main.rsscenarios/fuel_contracts/contracts/ts-interaction-tools/.env.examplescenarios/fuel_contracts/contracts/ts-interaction-tools/.gitignorescenarios/fuel_contracts/contracts/ts-interaction-tools/README.mdscenarios/fuel_contracts/contracts/ts-interaction-tools/package.jsonscenarios/fuel_contracts/contracts/ts-interaction-tools/src/@types/env.d.tsscenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.tsscenarios/fuel_contracts/contracts/ts-interaction-tools/tsconfig.jsonscenarios/fuel_test/.env.examplescenarios/fuel_test/.envio/.gitignorescenarios/fuel_test/.gitignorescenarios/fuel_test/README.mdscenarios/fuel_test/config.yamlscenarios/fuel_test/envio-env.d.tsscenarios/fuel_test/package.jsonscenarios/fuel_test/rescript.jsonscenarios/fuel_test/schema.graphqlscenarios/fuel_test/src/AllEventsHandlers.tsscenarios/fuel_test/src/GreeterHandlers.tsscenarios/fuel_test/src/Indexer.resscenarios/fuel_test/src/_regression-check.tsscenarios/fuel_test/test/ConfigView.test.tsscenarios/fuel_test/test/test.tsscenarios/fuel_test/tsconfig.jsonscenarios/fuel_test/vitest.config.tsscenarios/svm_test/.envio/.gitignorescenarios/svm_test/.gitignorescenarios/svm_test/README.mdscenarios/svm_test/config.yamlscenarios/svm_test/envio-env.d.tsscenarios/svm_test/package.jsonscenarios/svm_test/rescript.jsonscenarios/svm_test/schema.graphqlscenarios/svm_test/src/handlers/SlotHandler.tsscenarios/svm_test/test/ConfigView.test.tsscenarios/svm_test/test/SlotHandler.test.tsscenarios/svm_test/tsconfig.jsonscenarios/svm_test/vitest.config.tsscenarios/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
| 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"], |
There was a problem hiding this comment.
🎯 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.
| 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.
There was a problem hiding this comment.
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 winRemove comments that only narrate code.
packages/envio-tests/test/FuelSwayTypes_test.res#L103-L103: remove the comment restating whatassertParamsdoes.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
⛔ Files ignored due to path filters (5)
packages/envio-tests/test/generated/FuelIndexer.resis excluded by!**/generated/**packages/envio-tests/test/generated/SvmIndexer.resis excluded by!**/generated/**pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlscenarios/fuel_contracts/contracts/all-events/Forc.lockis excluded by!**/*.lockscenarios/fuel_contracts/contracts/interaction-tools/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (63)
.github/workflows/build_and_verify.ymlpackage.jsonpackages/cli/src/hbs_templating/codegen_templates.rspackages/cli/src/napi.rspackages/envio-tests/test/FuelHandlersApi_test.respackages/envio-tests/test/FuelHyperSyncSource_test.respackages/envio-tests/test/FuelIndexer_test.respackages/envio-tests/test/FuelSwayTypes_test.respackages/envio-tests/test/IndexerCode_test.respackages/envio-tests/test/SlotResume_test.respackages/envio-tests/test/TokenIndexer_test.respackages/envio-tests/test/helpers/FuelAbiFixtures.respackages/envio-tests/test/helpers/InternalTestIndexer.respackages/envio/src/Core.respackages/envio/src/bindings/Vitest.resscenarios/fuel_contracts/README.mdscenarios/fuel_contracts/abis/all-events-abi.jsonscenarios/fuel_contracts/abis/greeter-abi.jsonscenarios/fuel_contracts/contracts/all-events/.gitignorescenarios/fuel_contracts/contracts/all-events/Forc.tomlscenarios/fuel_contracts/contracts/all-events/src/main.swscenarios/fuel_contracts/contracts/interaction-tools/.env.examplescenarios/fuel_contracts/contracts/interaction-tools/.gitignorescenarios/fuel_contracts/contracts/interaction-tools/Cargo.tomlscenarios/fuel_contracts/contracts/interaction-tools/src/main.rsscenarios/fuel_contracts/contracts/ts-interaction-tools/.env.examplescenarios/fuel_contracts/contracts/ts-interaction-tools/.gitignorescenarios/fuel_contracts/contracts/ts-interaction-tools/README.mdscenarios/fuel_contracts/contracts/ts-interaction-tools/package.jsonscenarios/fuel_contracts/contracts/ts-interaction-tools/src/@types/env.d.tsscenarios/fuel_contracts/contracts/ts-interaction-tools/src/deploy.tsscenarios/fuel_contracts/contracts/ts-interaction-tools/tsconfig.jsonscenarios/fuel_test/.env.examplescenarios/fuel_test/.envio/.gitignorescenarios/fuel_test/.gitignorescenarios/fuel_test/README.mdscenarios/fuel_test/config.yamlscenarios/fuel_test/envio-env.d.tsscenarios/fuel_test/package.jsonscenarios/fuel_test/rescript.jsonscenarios/fuel_test/schema.graphqlscenarios/fuel_test/src/AllEventsHandlers.tsscenarios/fuel_test/src/GreeterHandlers.tsscenarios/fuel_test/src/Indexer.resscenarios/fuel_test/src/_regression-check.tsscenarios/fuel_test/test/ConfigView.test.tsscenarios/fuel_test/test/test.tsscenarios/fuel_test/tsconfig.jsonscenarios/fuel_test/vitest.config.tsscenarios/svm_test/.envio/.gitignorescenarios/svm_test/.gitignorescenarios/svm_test/README.mdscenarios/svm_test/config.yamlscenarios/svm_test/envio-env.d.tsscenarios/svm_test/package.jsonscenarios/svm_test/rescript.jsonscenarios/svm_test/schema.graphqlscenarios/svm_test/src/handlers/SlotHandler.tsscenarios/svm_test/test/ConfigView.test.tsscenarios/svm_test/test/SlotHandler.test.tsscenarios/svm_test/tsconfig.jsonscenarios/svm_test/vitest.config.tsscenarios/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/srcRepository: 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 providedcallbackwill 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 whenserver.close()is invoked to facilitate shutdown [4][5]. Thecallbackfunction 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 useserver.closeAllConnections(), which forcefully closes all connections, including those that are currently active [6][7]. It is recommended to call this afterserver.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 alongsideserver.close(), it is generally redundant for handling keep-alive connections in modern Node.js versions (19.0.0+) [4][7].Citations:
- 1: https://nodejs.org/dist/latest/docs/api/net.html
- 2: https://nodejs.org/dist/latest-v18.x/docs/api/net.html
- 3: https://nodejs.org/api/http.html
- 4: https://github.com/nodejs/node/blob/master/doc/api/http.md
- 5: nodejs/node#53939
- 6: nodejs/node#42812
- 7: nodejs/node@086626f9b1
Await
server->closebefore returning. The helper can exit while the listener is still shutting down, which can leak handles into the next test; wrapclosein 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
MNENOMICtypo mismatches theMNEMONICenv var actually read bymain.rs.
main.rsreadsenv::var("MNEMONIC"), but this.env.exampledefinesMNENOMIC(letters transposed). Anyone bootstrapping their.envfrom 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.
There was a problem hiding this comment.
💡 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 }, |
There was a problem hiding this comment.
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 👍 / 👎.
Move the standalone
fuel_testandsvm_testscenario directories into the main test suite underpackages/envio-tests/test/, consolidating test infrastructure and improving maintainability.Summary
This refactors the test organization by:
scenarios/fuel_testintopackages/envio-tests/test/FuelIndexer_test.resandpackages/envio-tests/test/FuelSwayTypes_test.resscenarios/svm_testinto snapshot tests viapackages/envio-tests/test/IndexerCode_test.resscenarios/fuel_contracts/for shared fixture useKey Changes
InternalTestIndexer.fromUserApi()to exercise the public indexer API within the test suite, eliminating duplicate test infrastructureFuelAbiFixtures.allEventsfixture with comprehensive Sway type coverage (options, results, structs, arrays, enums)FuelIndexer.ressnapshot underpackages/envio-tests/test/generated/to type-check ReScript codegen output alongside the test suitefromUserApiOptionswithwithIndexerCodeflag to capture generatedsrc/Indexer.resfor snapshot testingtoMatchFileSnapshotbinding to support snapshot assertions on generated codeImplementation Details
FuelIndexer_test.res) and Sway type decoding (FuelSwayTypes_test.res)Indexer.resoutputfuel_testandsvm_testscenario runshttps://claude.ai/code/session_01Bn64AnArY4CprWGbwk7V8f
Summary by CodeRabbit
New Features
Bug Fixes
Documentation