Conversation
WalkthroughConvert many packages and templates from CommonJS to ES modules, update ReScript/TypeScript build/import paths for ESM, add async/dynamic handler import and registration hooks (EventRegister.isPendingRegistration + async register flows), add temporary TS .d.mts shims, and remove Hardhat contracts/artifacts and related scripts. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant Envio as Envio CLI
participant Generated as Generated Module
participant Utils as Utils.importPathWithJson
participant EventReg as EventRegister
User->>Envio: start indexer
Envio->>Generated: registerAllHandlers()
Generated->>EventReg: isPendingRegistration()
alt pending
EventReg-->>Generated: true
Generated->>EventReg: finishRegistration()
else not pending
EventReg-->>Generated: false
Generated->>EventReg: startRegistration()
loop handler files (async)
Generated->>Utils: importPath(handlerFile)
Utils-->>Generated: handlerModule
Generated->>EventReg: registerHandler(handlerModule)
end
Generated->>EventReg: finishRegistration()
end
EventReg-->>Envio: handlers registered
Envio-->>User: indexer ready
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)codegenerator/cli/templates/dynamic/**/*.hbs📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Files:
🧠 Learnings (18)📓 Common learnings📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:40:49.622ZApplied to files:
📚 Learning: 2025-11-25T12:40:49.622ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
📚 Learning: 2025-11-25T12:40:49.622ZApplied to files:
📚 Learning: 2025-11-25T12:41:23.343ZApplied to files:
⏰ 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). (1)
🔇 Additional comments (5)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
codegenerator/cli/npm/envio/index.js (1)
13-42: S export properly migrated to ESM, but index.d.ts has a mismatch:unknownproperty declared but not exported.The ESM syntax conversion is correct and imports are clean (lines 5-7, 19, 37). However,
index.d.tsline 161 declaresexport const unknown: typeof Sury.unknown;which is not present in theindex.jsS object. This violates the "should match" requirement stated in both files' comments. Either addunknownto the S export inindex.jsline 41, or remove it fromindex.d.tsline 161 to maintain alignment.
♻️ Duplicate comments (1)
codegenerator/cli/npm/envio/package.json.tmpl (1)
4-4: Generated CLI packages become ESM‑only as well – align with support expectationsAdding
"type": "module"here means all generatedenvioCLI packages will be pure ES modules; that’s fine if you’re officially dropping CommonJS support, but if not, you may want a dual‑mode setup similar to the main package note.
🧹 Nitpick comments (2)
codegenerator/cli/npm/envio/src/Utils.res (1)
3-4: Dynamicimportvia@valis risky under ESM; prefer a wrapper
@val external importPath ... = "import"assumesimportcan be treated as a normal value. In ESM,importis special syntax, and if the compiler emits something like a binding toimport, the generated.mjsmay not even parse.A safer pattern is to wrap
import()in a tiny%rawfunction:-@val external importPath: string => promise<unknown> = "import" +let importPath: string => promise<unknown> = + %raw(`(path) => import(path)`)Please also run
pnpm rescriptto inspect the generated.mjsandpnpm mochato catch any runtime issues once the compiler output looks OK, based on learnings.scenarios/test_codegen/test/topic-hashing-test.ts (1)
1-5: Updated .mjs imports match ReScript ESM outputPointing to
Types.res.mjsandRpc.res.mjsis in line with the new.res.mjssuffix and ESM build. As you further standardize on Node16/ESM in this scenario, consider eventually replacingconst hre = require("hardhat");with an ESM import to avoid CJS/ESM mixing in the same file.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
scenarios/test_codegen/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (58)
codegenerator/cli/npm/envio/bin.js(2 hunks)codegenerator/cli/npm/envio/index.js(2 hunks)codegenerator/cli/npm/envio/package.json(1 hunks)codegenerator/cli/npm/envio/package.json.tmpl(1 hunks)codegenerator/cli/npm/envio/rescript.json(1 hunks)codegenerator/cli/npm/envio/src/Envio.gen.ts(1 hunks)codegenerator/cli/npm/envio/src/Internal.gen.ts(1 hunks)codegenerator/cli/npm/envio/src/Utils.res(1 hunks)codegenerator/cli/npm/envio/src/bindings/BigDecimal.gen.ts(1 hunks)codegenerator/cli/npm/envio/src/bindings/BigDecimal.res(1 hunks)codegenerator/cli/npm/envio/src/bindings/BigInt.gen.ts(1 hunks)codegenerator/cli/npm/envio/src/bindings/Ethers.gen.ts(1 hunks)codegenerator/cli/npm/envio/src/bindings/NodeJs.res(1 hunks)codegenerator/cli/npm/envio/src/bindings/Pino.res(3 hunks)codegenerator/cli/npm/envio/src/bindings/Postgres.res(1 hunks)codegenerator/cli/npm/envio/src/bindings/vendored-lodash-fns.js(2 hunks)codegenerator/cli/npm/envio/src/db/InternalTable.gen.ts(1 hunks)codegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.ts(1 hunks)codegenerator/cli/npm/envio/src/sources/vendored-fuel-abi-coder.js(3 hunks)codegenerator/cli/src/cli_args/init_config.rs(2 hunks)codegenerator/cli/templates/dynamic/codegen/package.json.hbs(1 hunks)codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs(4 hunks)codegenerator/cli/templates/static/blank_template/rescript/rescript.json(1 hunks)codegenerator/cli/templates/static/blank_template/typescript/tsconfig.json(1 hunks)codegenerator/cli/templates/static/codegen/index.js(1 hunks)codegenerator/cli/templates/static/codegen/rescript.json(1 hunks)codegenerator/cli/templates/static/codegen/src/Index.bs.js(1 hunks)codegenerator/cli/templates/static/codegen/src/Index.res(1 hunks)codegenerator/cli/templates/static/codegen/src/bindings/Yargs.res(1 hunks)codegenerator/cli/templates/static/erc20_template/typescript/tsconfig.json(1 hunks)codegenerator/cli/templates/static/factory_template/typescript/tsconfig.json(1 hunks)codegenerator/cli/templates/static/greeter_template/typescript/tsconfig.json(1 hunks)codegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.json(1 hunks)codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.json(1 hunks)codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.json(1 hunks)codegenerator/integration_tests/tests/test_indexers/test_exits/package.json(1 hunks)codegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.json(1 hunks)codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json(2 hunks)codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.json(1 hunks)scenarios/erc20_multichain_factory/config.yaml(1 hunks)scenarios/erc20_multichain_factory/package.json(1 hunks)scenarios/erc20_multichain_factory/rescript.json(1 hunks)scenarios/fuel_test/contracts/ts-interaction-tools/tsconfig.json(1 hunks)scenarios/fuel_test/package.json(2 hunks)scenarios/fuel_test/rescript.json(1 hunks)scenarios/fuel_test/tsconfig.json(1 hunks)scenarios/helpers/README.md(1 hunks)scenarios/helpers/package.json(1 hunks)scenarios/helpers/rescript.json(1 hunks)scenarios/test_codegen/.mocharc.json(1 hunks)scenarios/test_codegen/config.yaml(2 hunks)scenarios/test_codegen/package.json(3 hunks)scenarios/test_codegen/rescript.json(1 hunks)scenarios/test_codegen/test/Integration_ts_helpers.gen.ts(1 hunks)scenarios/test_codegen/test/helpers/utils.ts(1 hunks)scenarios/test_codegen/test/manual/README.md(1 hunks)scenarios/test_codegen/test/topic-hashing-test.ts(1 hunks)scenarios/test_codegen/tsconfig.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{res,resi}
📄 CodeRabbit inference engine (.cursor/rules/rescript.mdc)
**/*.{res,resi}: Always use ReScript 11 documentation
Never suggest ReasonML syntax
Never use[| item |]to create an array. Use[ item ]instead
Must always use=for setting value to a field. Use:=only for ref values created usingreffunction
Use records when working with structured data, and objects to conveniently pass payload data between functions
Never use %raw to access object fields if you know the type
Files:
codegenerator/cli/npm/envio/src/bindings/Postgres.rescodegenerator/cli/npm/envio/src/bindings/NodeJs.rescodegenerator/cli/npm/envio/src/bindings/BigDecimal.rescodegenerator/cli/templates/static/codegen/src/bindings/Yargs.rescodegenerator/cli/templates/static/codegen/src/Index.rescodegenerator/cli/npm/envio/src/bindings/Pino.rescodegenerator/cli/npm/envio/src/Utils.res
codegenerator/cli/templates/dynamic/**/*.hbs
📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Handlebars templates must be placed in
codegenerator/cli/templates/dynamic/
Files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
codegenerator/cli/templates/static/**/*.res
📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Static ReScript files must be placed in
codegenerator/cli/templates/static/
Files:
codegenerator/cli/templates/static/codegen/src/bindings/Yargs.rescodegenerator/cli/templates/static/codegen/src/Index.res
🧠 Learnings (52)
📓 Common learnings
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.{res,resi} : Always use ReScript 11 documentation
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runner
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jsscenarios/test_codegen/test/Integration_ts_helpers.gen.tsscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/bin.jsscenarios/test_codegen/config.yamlcodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tscodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/npm/envio/src/sources/vendored-fuel-abi-coder.jscodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/codegen/src/Index.rescodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use async/await for all context.Entity.get() and context.effect() calls; context.Entity.set() does not need await
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jscodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsonscenarios/test_codegen/test/Integration_ts_helpers.gen.tsscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tsscenarios/test_codegen/tsconfig.jsoncodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/codegen/src/Index.rescodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Create handler skeleton files with exact filenames matching the original subgraph structure during file refactoring
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jsscenarios/fuel_test/contracts/ts-interaction-tools/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsonscenarios/test_codegen/test/Integration_ts_helpers.gen.tscodegenerator/cli/templates/static/blank_template/rescript/rescript.jsonscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsonscenarios/test_codegen/config.yamlcodegenerator/cli/npm/envio/rescript.jsoncodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tsscenarios/test_codegen/tsconfig.jsoncodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsonscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/templates/static/codegen/rescript.jsoncodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/codegen/src/Index.rescodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Import entity types from 'generated/src/db/Entities.gen' not 'generated' for type definitions
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsoncodegenerator/cli/npm/envio/package.json.tmplcodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsonscenarios/test_codegen/test/Integration_ts_helpers.gen.tsscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/rescript.jsoncodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tscodegenerator/integration_tests/tests/test_indexers/test_exits/package.jsoncodegenerator/cli/npm/envio/src/bindings/BigInt.gen.tscodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tscodegenerator/cli/npm/envio/index.jscodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsonscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/npm/envio/src/bindings/BigDecimal.gen.tscodegenerator/cli/templates/static/codegen/rescript.jsoncodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/codegen/src/Index.rescodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jsscenarios/fuel_test/contracts/ts-interaction-tools/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsonscenarios/test_codegen/test/Integration_ts_helpers.gen.tsscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/config.yamlcodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tsscenarios/test_codegen/tsconfig.jsoncodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tsscenarios/erc20_multichain_factory/config.yamlcodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/npm/envio/index.jsscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/templates/static/codegen/rescript.jsoncodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/codegen/src/Index.rescodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.jsoncodegenerator/cli/src/cli_args/init_config.rsscenarios/erc20_multichain_factory/rescript.jsoncodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Run pnpm codegen, pnpm tsc --noEmit, and TUI_OFF=true pnpm dev after every code change to catch runtime errors
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jsscenarios/fuel_test/contracts/ts-interaction-tools/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsonscenarios/fuel_test/package.jsonscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.jsonscenarios/fuel_test/tsconfig.jsonscenarios/test_codegen/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsoncodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correct
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jsscenarios/test_codegen/test/helpers/utils.tsscenarios/test_codegen/config.yamlscenarios/test_codegen/tsconfig.jsonscenarios/erc20_multichain_factory/config.yamlcodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsonscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/*.ts : After any change to TypeScript files, run `pnpm tsc --noEmit` to ensure successful compilation
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jsscenarios/fuel_test/contracts/ts-interaction-tools/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsonscenarios/fuel_test/package.jsoncodegenerator/cli/npm/envio/package.json.tmplcodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsonscenarios/test_codegen/.mocharc.jsonscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.jsonscenarios/fuel_test/tsconfig.jsoncodegenerator/cli/npm/envio/rescript.jsoncodegenerator/integration_tests/tests/test_indexers/test_exits/package.jsonscenarios/test_codegen/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tscodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsoncodegenerator/cli/templates/static/codegen/rescript.jsoncodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Reference original subgraph logic files in TODO comments when creating skeleton handlers (e.g., 'Reference: original-subgraph/src/mappings/contract.ts')
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jsscenarios/fuel_test/contracts/ts-interaction-tools/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsonscenarios/test_codegen/test/Integration_ts_helpers.gen.tsscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tsscenarios/test_codegen/config.yamlcodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tsscenarios/test_codegen/tsconfig.jsoncodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tsscenarios/erc20_multichain_factory/config.yamlcodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsonscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Prefix all entity IDs with chainId in multichain indexing: ${event.chainId}-${originalId}
Applied to files:
codegenerator/cli/templates/static/codegen/src/Index.bs.jsscenarios/erc20_multichain_factory/config.yamlscenarios/test_codegen/test/topic-hashing-test.tsscenarios/erc20_multichain_factory/rescript.json
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Use `string | undefined` for optional string fields in TypeScript types, not `string | null`, as generated types are strict about null vs undefined
Applied to files:
scenarios/fuel_test/contracts/ts-interaction-tools/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsoncodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsoncodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Ensure entity type annotations use the _t suffix (e.g., Pair_t, Token_t) when defining entity objects
Applied to files:
scenarios/fuel_test/contracts/ts-interaction-tools/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsoncodegenerator/cli/npm/envio/package.json.tmplcodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsonscenarios/test_codegen/test/Integration_ts_helpers.gen.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/rescript.jsonscenarios/test_codegen/rescript.jsoncodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tsscenarios/test_codegen/tsconfig.jsoncodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tscodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsonscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/templates/static/codegen/rescript.jsoncodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runner
Applied to files:
scenarios/helpers/README.mdscenarios/helpers/rescript.jsonscenarios/fuel_test/package.jsonscenarios/test_codegen/test/manual/README.mdscenarios/test_codegen/.mocharc.jsonscenarios/fuel_test/rescript.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/erc20_multichain_factory/package.jsonscenarios/test_codegen/package.jsoncodegenerator/cli/npm/envio/rescript.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Use `_only` to specify which tests to run in ReScript Mocha tests
Applied to files:
scenarios/helpers/README.mdscenarios/helpers/rescript.jsonscenarios/test_codegen/test/manual/README.mdscenarios/test_codegen/.mocharc.jsoncodegenerator/cli/templates/static/blank_template/rescript/rescript.jsonscenarios/fuel_test/rescript.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.jsoncodegenerator/cli/npm/envio/rescript.jsonscenarios/test_codegen/rescript.jsoncodegenerator/cli/templates/static/codegen/rescript.jsonscenarios/erc20_multichain_factory/rescript.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use entity field names with _id suffix for entity relationships (e.g., token0_id, token1_id) matching generated schema
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsonscenarios/test_codegen/test/Integration_ts_helpers.gen.tsscenarios/test_codegen/test/helpers/utils.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/rescript.jsoncodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tsscenarios/test_codegen/tsconfig.jsoncodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tscodegenerator/cli/templates/static/codegen/rescript.jsoncodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Verify that entity field types in code match exactly with GraphQL schema property types (Int!, BigInt!, BigDecimal!, String!, Bytes!, Boolean!)
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsonscenarios/test_codegen/test/Integration_ts_helpers.gen.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/tsconfig.jsoncodegenerator/cli/npm/envio/src/bindings/BigInt.gen.tscodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.jsoncodegenerator/cli/npm/envio/src/bindings/BigDecimal.gen.tscodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use ZERO_BD and ZERO_BI constants for entity field initialization instead of hardcoded 0 values
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/tsconfig.jsoncodegenerator/cli/templates/static/greeter_template/typescript/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsoncodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/static/erc20_template/typescript/tsconfig.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/src/bindings/BigInt.gen.tscodegenerator/cli/npm/envio/src/bindings/BigDecimal.gen.tscodegenerator/cli/templates/static/factory_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/blank_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.{res,resi} : Always use ReScript 11 documentation
Applied to files:
scenarios/helpers/rescript.jsoncodegenerator/cli/templates/static/blank_template/rescript/rescript.jsonscenarios/fuel_test/rescript.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.jsoncodegenerator/cli/npm/envio/rescript.jsonscenarios/test_codegen/rescript.jsoncodegenerator/cli/npm/envio/index.jscodegenerator/cli/templates/static/codegen/rescript.jsonscenarios/erc20_multichain_factory/rescript.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
Applied to files:
scenarios/helpers/rescript.jsonscenarios/test_codegen/.mocharc.jsoncodegenerator/cli/templates/static/blank_template/rescript/rescript.jsonscenarios/fuel_test/rescript.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.jsoncodegenerator/cli/npm/envio/rescript.jsonscenarios/test_codegen/rescript.jsonscenarios/test_codegen/test/topic-hashing-test.tscodegenerator/cli/templates/static/codegen/rescript.jsonscenarios/erc20_multichain_factory/rescript.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to codegenerator/cli/templates/static/**/*.res : Static ReScript files must be placed in `codegenerator/cli/templates/static/`
Applied to files:
scenarios/helpers/rescript.jsonscenarios/fuel_test/package.jsoncodegenerator/cli/templates/static/blank_template/rescript/rescript.jsonscenarios/fuel_test/rescript.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.jsoncodegenerator/cli/npm/envio/rescript.jsonscenarios/test_codegen/rescript.jsoncodegenerator/cli/templates/static/codegen/rescript.jsonscenarios/erc20_multichain_factory/rescript.json
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.{res,resi} : Never suggest ReasonML syntax
Applied to files:
scenarios/helpers/rescript.jsoncodegenerator/cli/templates/static/blank_template/rescript/rescript.jsonscenarios/fuel_test/rescript.jsoncodegenerator/cli/npm/envio/rescript.jsonscenarios/test_codegen/rescript.jsoncodegenerator/cli/templates/static/codegen/rescript.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Config.res : Generated config module must be named `Config.res` and convert environment variables to typed config, setting up persistence
Applied to files:
scenarios/helpers/rescript.jsoncodegenerator/cli/templates/static/blank_template/rescript/rescript.jsonscenarios/fuel_test/rescript.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/rescript.jsonscenarios/test_codegen/rescript.jsoncodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/static/codegen/rescript.jsonscenarios/erc20_multichain_factory/rescript.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Whitelist and use the commands: pnpm codegen, pnpm tsc --noEmit, TUI_OFF=true pnpm dev during development
Applied to files:
scenarios/fuel_test/package.jsonscenarios/test_codegen/package.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Index.res : Generated runtime entry module must be named `Index.res` and must start HTTP server, load `Config.res`, call `RegisterHandlers.res`, and spin up `GlobalStateManager.res`
Applied to files:
scenarios/fuel_test/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.jsoncodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/static/codegen/src/Index.rescodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Whitelist the following commands for execution: `pnpm codegen` and `pnpm tsc --noEmit`
Applied to files:
scenarios/fuel_test/package.jsonscenarios/test_codegen/package.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Rust CLI entry point is at `codegenerator/cli/src/lib.rs`
Applied to files:
scenarios/fuel_test/package.jsonscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : In Envio, use `entity_id` fields (e.g., `token_id: string`) instead of direct object references for entity relationships
Applied to files:
codegenerator/cli/npm/envio/package.json.tmplscenarios/test_codegen/test/Integration_ts_helpers.gen.tscodegenerator/cli/npm/envio/src/db/InternalTable.gen.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/rescript.jsoncodegenerator/cli/npm/envio/src/bindings/Ethers.gen.tscodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tscodegenerator/cli/npm/envio/index.jscodegenerator/cli/npm/envio/src/sources/HyperSyncClient.gen.tscodegenerator/cli/templates/static/greeteronfuel_template/typescript/tsconfig.jsoncodegenerator/cli/templates/static/factory_template/typescript/tsconfig.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Register dynamic contracts created by factory events using contractRegister above the handler (e.g., context.addPair(event.params.pair))
Applied to files:
codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/tsconfig.jsoncodegenerator/cli/npm/envio/src/db/InternalTable.gen.tsscenarios/test_codegen/config.yamlscenarios/erc20_multichain_factory/config.yamlcodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/test/topic-hashing-test.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Never hardcode chainId = 1; always use event.chainId for chain-specific operations
Applied to files:
scenarios/test_codegen/test/Integration_ts_helpers.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.tsscenarios/test_codegen/test/topic-hashing-test.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use chain-specific Bundle IDs in format ${chainId}-1 for accurate pricing per network
Applied to files:
scenarios/test_codegen/test/Integration_ts_helpers.gen.ts
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.test.{res,resi} : Never use `Js.Console.log` in test files. Use `Assert` module for all verifications
Applied to files:
scenarios/test_codegen/test/manual/README.mdscenarios/test_codegen/.mocharc.jsonscenarios/test_codegen/test/topic-hashing-test.ts
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.test.{res,resi} : Tests should be silent unless they fail - rely on assertions rather than logging
Applied to files:
scenarios/test_codegen/test/manual/README.md
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/effects/**/*.ts : Create Effect API functions in src/effects/ folder with proper schema definition using createEffect from 'envio'
Applied to files:
codegenerator/cli/npm/envio/bin.jscodegenerator/cli/npm/envio/src/Envio.gen.tscodegenerator/cli/npm/envio/index.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/config.yaml : Update config.yaml to point handler field to contract-specific files instead of single EventHandlers.ts file
Applied to files:
scenarios/test_codegen/config.yamlscenarios/erc20_multichain_factory/config.yamlcodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/src/cli_args/init_config.rscodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/EventHandlers.ts : Clear all boilerplate logic from EventHandlers.ts and replace with empty handlers containing TODO comments
Applied to files:
scenarios/test_codegen/config.yamlscenarios/erc20_multichain_factory/config.yamlcodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/config.yaml : Check that global contract definitions in config.yaml do not repeat handler, events, or configuration in network-specific sections
Applied to files:
scenarios/test_codegen/config.yamlscenarios/erc20_multichain_factory/config.yaml
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When updating existing entities in TypeScript handlers, always use the spread operator since returned objects are read-only and immutable
Applied to files:
scenarios/test_codegen/config.yamlscenarios/erc20_multichain_factory/config.yaml
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Define Effect schemas using the `S` module from 'envio' with required properties: name, input schema, output schema, rateLimit, and cache
Applied to files:
codegenerator/cli/npm/envio/rescript.jsoncodegenerator/cli/npm/envio/src/Envio.gen.tscodegenerator/cli/npm/envio/index.jscodegenerator/cli/npm/envio/src/sources/vendored-fuel-abi-coder.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Never use .bind() pattern for contract state access; use Effect API with viem transport for RPC calls instead
Applied to files:
codegenerator/cli/npm/envio/src/bindings/Ethers.gen.tsscenarios/erc20_multichain_factory/config.yaml
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Use Node.js v20 only (no higher or lower versions)
Applied to files:
scenarios/test_codegen/tsconfig.jsoncodegenerator/integration_tests/tests/test_indexers/test_exits/tsconfig.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Maintain BigDecimal precision for financial calculations; never simplify to JavaScript number types
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigInt.gen.tscodegenerator/cli/npm/envio/src/sources/vendored-fuel-abi-coder.jscodegenerator/cli/npm/envio/src/bindings/BigDecimal.rescodegenerator/cli/npm/envio/src/bindings/BigDecimal.gen.tscodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Return BigDecimal from helper functions for financial calculations instead of number type
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigInt.gen.tscodegenerator/cli/npm/envio/src/sources/vendored-fuel-abi-coder.jscodegenerator/cli/npm/envio/src/bindings/BigDecimal.rescodegenerator/cli/npm/envio/src/bindings/BigDecimal.gen.tscodegenerator/cli/templates/static/codegen/index.js
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : Always cast timestamps to BigInt (e.g., `BigInt(event.block.timestamp)`) instead of using raw timestamps
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigInt.gen.tscodegenerator/cli/npm/envio/src/Internal.gen.tscodegenerator/cli/npm/envio/src/Envio.gen.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/config.yaml : Remove address field from config.yaml for dynamically created contracts; only include addresses for factory contracts
Applied to files:
scenarios/erc20_multichain_factory/config.yaml
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When making external calls in handlers with preload optimisations enabled, MUST use the Effect API from 'envio' instead of direct fetch/external calls
Applied to files:
scenarios/erc20_multichain_factory/config.yamlcodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/test/topic-hashing-test.ts
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : ALWAYS normalize amounts when adding tokens with different decimal places; create helper functions to convert all amounts to a standard decimal (e.g., 18 decimals)
Applied to files:
scenarios/erc20_multichain_factory/config.yaml
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Implement complex handlers one at a time and run quality checks after each handler completion before proceeding to next
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use Effect API for all external calls (RPC calls, API calls) via context.effect() with preload_handlers: true enabled
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Do not use !context.isPreload check logic during the main implementation phase; use it only after all handlers are complete
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : Use `!context.isPreload` checks in handlers to prevent logic from running during preload when using preload optimisations
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/schema.graphql : Migrate schema by converting entity(immutable: true) decorators to plain entities and Bytes! to String!, removing immutable declarations
Applied to files:
codegenerator/cli/npm/envio/index.js
🧬 Code graph analysis (1)
codegenerator/cli/src/cli_args/init_config.rs (1)
codegenerator/cli/src/utils/unique_hashmap.rs (1)
try_insert(4-17)
⏰ 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). (1)
- GitHub Check: build_and_test
| import * as Sury from "rescript-schema"; | ||
| import { schema as bigintSchema } from "./src/bindings/BigInt.res.mjs"; | ||
| import { schema as bigDecimalSchema } from "./src/bindings/BigDecimal.res.mjs"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify ReScript config and imported .mjs files
echo "=== Looking for ReScript configuration files ==="
fd -e json "bsconfig|rescript" --maxdepth 3 | head -20
echo -e "\n=== Checking codegenerator/cli/npm/envio directory structure ==="
find codegenerator/cli/npm/envio -type f -name "*.json" | head -10
echo -e "\n=== Verifying imported .mjs files exist ==="
test -f "codegenerator/cli/npm/envio/src/bindings/BigInt.res.mjs" && echo "✓ BigInt.res.mjs exists" || echo "✗ BigInt.res.mjs NOT found"
test -f "codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.mjs" && echo "✓ BigDecimal.res.mjs exists" || echo "✗ BigDecimal.res.mjs NOT found"
echo -e "\n=== Checking for source .res files ==="
fd "^(BigInt|BigDecimal)\.res$" codegenerator/cli/npm/envio/
echo -e "\n=== ReScript config in root or codegenerator ==="
cat bsconfig.json 2>/dev/null || echo "No bsconfig.json in root"
echo "---"
find codegenerator -name "bsconfig.json" -o -name "rescript.json" 2>/dev/nullRepository: enviodev/hyperindex
Length of output: 2276
🏁 Script executed:
#!/bin/bash
# Check ReScript configuration and actual imports
echo "=== ReScript configuration ==="
cat codegenerator/cli/npm/envio/rescript.json
echo -e "\n=== Actual imports in index.js ==="
head -20 codegenerator/cli/npm/envio/index.js
echo -e "\n=== Package.json build scripts ==="
grep -A 10 '"scripts"' codegenerator/cli/npm/envio/package.json
echo -e "\n=== Check compiled output directory ==="
find codegenerator/cli/npm/envio/src/bindings -type f | head -20Repository: enviodev/hyperindex
Length of output: 2676
🏁 Script executed:
#!/bin/bash
# Check if .res.mjs files are in .gitignore
echo "=== Checking .gitignore for .res.mjs exclusion ==="
grep -r "\.mjs\|\.res\.mjs" .gitignore 2>/dev/null || echo "No .mjs patterns found in .gitignore"
echo -e "\n=== Looking for any .gitignore in codegenerator or envio directories ==="
find codegenerator/cli/npm/envio -name ".gitignore" -exec cat {} \;
echo -e "\n=== Check if .res.mjs files are in git ==="
git ls-files codegenerator/cli/npm/envio/src/bindings/*.res.mjs 2>/dev/null | wc -l
echo -e "\n=== Verify Envio.res.mjs (also imported) ==="
test -f "codegenerator/cli/npm/envio/src/Envio.res.mjs" && echo "✓ Envio.res.mjs exists" || echo "✗ Envio.res.mjs NOT found"
git ls-files "codegenerator/cli/npm/envio/src/Envio.res.mjs" 2>/dev/null && echo " - In git" || echo " - Not in git"Repository: enviodev/hyperindex
Length of output: 2444
🏁 Script executed:
#!/bin/bash
# Verify package entry points and build workflow
echo "=== Package.json main and exports ==="
cat codegenerator/cli/npm/envio/package.json | grep -A 20 '"main"\|"exports"' | head -30
echo -e "\n=== Check if there's a prepare or prebuild script ==="
cat codegenerator/cli/npm/envio/package.json | grep -A 5 '"scripts"'
echo -e "\n=== Look for build output configuration ==="
ls -la codegenerator/cli/npm/envio/ | grep -E "dist|build|lib"Repository: enviodev/hyperindex
Length of output: 875
The imports reference non-existent compiled files that are excluded from the repository.
The .res.mjs files are deliberately excluded from git (via .gitignore), but index.js (the package entry point per package.json main field) imports from them directly. Without these compiled artifacts, the imports will fail at runtime:
- Line 6:
import { schema as bigintSchema } from "./src/bindings/BigInt.res.mjs"→ file missing - Line 7:
import { schema as bigDecimalSchema } from "./src/bindings/BigDecimal.res.mjs"→ file missing - Line 11:
export * from "./src/Envio.res.mjs"→ file missing
The ReScript configuration is correct (specifies ESM output with in-source compilation), but the compiled output isn't present in the repository. The package requires a build step (pnpm rescript per learnings) to be run before index.js is functional. This should either be:
- Enforced via a
preparescript in package.json, or - Documented as a required pre-import build step
🤖 Prompt for AI Agents
In codegenerator/cli/npm/envio/index.js around lines 5 to 7, the file imports
compiled ReScript artifacts (.res.mjs) that are intentionally excluded from the
repo so runtime imports will fail; add a prepare script to package.json that
runs the ReScript build (e.g., "prepare": "pnpm rescript build" or the project’s
existing build command) so the compiled .res.mjs outputs are produced prior to
publishing/installation, and/or update README to document that consumers must
run the ReScript build (or run the package’s prepare script) before importing
this module; ensure package.json main field remains correct and that CI/publish
steps run the build to include artifacts where necessary.
| "print-benchmark-summary": "node -e 'import(\"./src/Benchmark.res.mjs\").then(m => m.Summary.printSummary())'", | ||
| {{!-- We need this to always have cwd at the root of the project --}} | ||
| "start": "cd {{relative_path_to_root_from_generated}} && ts-node {{relative_path_to_generated_from_root}}/src/Index.res.js" | ||
| "start": "cd {{relative_path_to_root_from_generated}} && node --loader {{relative_path_to_generated_from_root}}/node_modules/ts-node/esm.mjs --experimental-specifier-resolution=node {{relative_path_to_generated_from_root}}/src/Index.res.mjs" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if the template file exists and read its contents
if [ -f "codegenerator/cli/templates/dynamic/codegen/package.json.hbs" ]; then
echo "=== File found, reading contents ==="
cat -n "codegenerator/cli/templates/dynamic/codegen/package.json.hbs" | head -30
else
echo "File not found at specified path"
fd "package.json.hbs" codegenerator/
fiRepository: enviodev/hyperindex
Length of output: 1545
🏁 Script executed:
#!/bin/bash
# Check for ts-node in dependencies
echo "=== Searching for ts-node in package.json files ==="
rg -A 5 -B 5 '"ts-node"' --type json codegenerator/cli/templates/
echo ""
echo "=== Looking for dependencies section in the template ==="
sed -n '28,80p' codegenerator/cli/templates/dynamic/codegen/package.json.hbsRepository: enviodev/hyperindex
Length of output: 989
🏁 Script executed:
#!/bin/bash
# Search for Index.res or Index files in the codebase
echo "=== Looking for Index.res or Index files ==="
fd "Index\.(res|ts|mjs)" codegenerator/
echo ""
echo "=== Looking for any comments about ts-node or ESM loader ==="
rg -C 3 "ts-node|esm\.mjs" codegenerator/ --type hbs
echo ""
echo "=== Checking if there are any TypeScript files in src/ ==="
fd "\.(ts|tsx)$" codegenerator/cli/templates/dynamic/codegen/src/ 2>/dev/null | head -20Repository: enviodev/hyperindex
Length of output: 1916
🏁 Script executed:
#!/bin/bash
# Check if Index.res has any special characteristics
echo "=== Reading Index.res from static template ==="
cat -n codegenerator/cli/templates/static/codegen/src/Index.res | head -30
echo ""
echo "=== Search for git history or comments about Index.res ==="
git log --oneline -n 20 -- codegenerator/cli/templates/dynamic/codegen/package.json.hbs 2>/dev/null | head -10
echo ""
echo "=== Check for any index-related configuration or special handling ==="
rg -i "index\.res" codegenerator/ -A 2 -B 2 --type hbs --type res | head -40Repository: enviodev/hyperindex
Length of output: 1299
🏁 Script executed:
#!/bin/bash
# Search for TODOs or comments about start script
echo "=== Search for TODOs or FIXME related to start script ==="
rg "TODO|FIXME" codegenerator/cli/templates/dynamic/codegen/ -A 2 -B 2
echo ""
echo "=== Search for documentation about running the start script ==="
fd "README|DOCS|docs" codegenerator/cli/templates/dynamic/codegen/
echo ""
echo "=== Look for any ESM or ts-node related documentation ==="
rg -i "esm|commonjs" codegenerator/cli/templates/dynamic/ --type hbs --type json -l
echo ""
echo "=== Check the recent commit that mentions ESM migration ==="
git show 556b8dcc --stat 2>/dev/null | head -30Repository: enviodev/hyperindex
Length of output: 3574
🌐 Web query:
ts-node ESM loader support for .mjs files Node.js compatibility
💡 Result:
Short answer
- ts-node supports running TypeScript as native ESM via its loader/CLI (ts-node --esm / ts-node-esm / node --loader ts-node/esm), but that support depends on Node’s experimental loader hooks and has known compatibility and stability issues across Node releases. [1][2][3]
Key points (what you need to know)
- Node treats .mjs as ESM; any loader used must implement Node’s ESM loader hooks. ts-node exposes an ESM loader (ts-node/esm) to do this. Use the ts-node CLI flag --esm or node --loader ts-node/esm. [1][3]
- The Node ESM loader API has changed and some flags (e.g. --loader behavior and related warnings) are experimental/deprecated in recent Node versions (Node 20+), so ts-node’s loader can break between Node releases and is not recommended for production. Expect to need Node-specific workarounds (NODE_OPTIONS or spawn-child behavior) and to upgrade/adjust when Node changes its loader hooks. [2][3][9]
- .mjs files are handled as ESM by Node; if you want to author TypeScript and run it as .mjs, prefer using .mts (TS ESM extension) or set "type":"module" and keep .ts/.mts—ts-node’s ESM path is intended for .ts/.mts ESM workflows rather than forcing .mjs. If you have pre-built .mjs JS files, they run normally under Node; ts-node’s loader is for on-the-fly TypeScript → ESM handling. [2][3][8]
Practical options/recommendations
- For development (fast, flexible): use ts-node’s ESM support but pin Node version and test when upgrading Node. Run via:
- npx ts-node-esm ./src/main.ts
- or node --loader ts-node/esm ./src/main.ts
(set "type":"module" and "module":"ESNext" in package.json/tsconfig as documented). [1][3]
- If you need more stable cross-Node support: use a modern loader based on esbuild (esbuild-kit/esm-loader) or use tsx which implements robust ESM+TS loading and is less tied to Node loader instability. These handle .mjs/.mts and Node resolution quirks more resiliently. [0][1]
- For production or to avoid loader breakage: compile with tsc (emit .mjs/.js as needed) and run plain node. [2]
Sources
- ts-node (TypeStrong) README & ESM notes. [1]
- Node.js ECMAScript modules docs / loader behavior. [2]
- esbuild-kit esm-loader (alternative loader that supports .mjs/.mts). [0]
- Practical notes / troubleshooting about ts-node --esm and Node loader warnings. [9]
If you want, tell me: (a) your Node version and (b) whether you want on-the-fly execution (dev) or production builds — I’ll give exact commands/config for your case.
🏁 Script executed:
#!/bin/bash
# Check for any test files or test documentation about the start script
echo "=== Search for test files mentioning start script or Index ==="
fd "test|spec" codegenerator/cli/templates/dynamic/codegen/ -type f 2>/dev/null | head -10
echo ""
echo "=== Look for any .mjs or .cjs references in recent commits ==="
git log --oneline --all -- "*.mjs" "*.cjs" 2>/dev/null | head -20
echo ""
echo "=== Check if there's a way to run the start script without ts-node ==="
rg "Index\.res\.mjs|start.*script" codegenerator/ -B 3 -A 3 --type hbsRepository: enviodev/hyperindex
Length of output: 2408
Based on my verification, I've identified a significant issue with the start script configuration:
Remove ts-node/esm.mjs loader; use direct node import like other scripts in the file.
The start script unnecessarily uses the ts-node ESM loader on a pre-built .mjs file (compiled ReScript). This is problematic because:
-
ts-node is for TypeScript, not pre-compiled JavaScript. Index.res.mjs is pure compiled ReScript → JavaScript, not TypeScript source.
-
Inconsistent with other scripts: Lines 13-16 successfully use plain
nodewithimport()for other.res.mjsfiles (Migrations, Benchmark) without ts-node. -
Adds experimental/unstable hooks: The
--loader ts-node/esm.mjsuses Node's experimental ESM loader hooks, which have known stability issues across Node versions (especially Node 20+). The project targets Node 22.x which has documented loader instability. -
Git history shows instability: Commits like "Downgrade ink and convert geneated back to cjs" and this recent "CommonJs -> ESM WIP" indicate ongoing ESM migration issues.
Suggested fix: Use the same pattern as other scripts:
"start": "cd {{relative_path_to_root_from_generated}} && node -e 'import(\"{{relative_path_to_generated_from_root}}/src/Index.res.mjs\").then(m => m.main())'"Or if Index.res.mjs is an executable entry point, simply:
"start": "cd {{relative_path_to_root_from_generated}} && node {{relative_path_to_generated_from_root}}/src/Index.res.mjs"There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs (1)
27-27: Fix typo in comment."Relatvie" should be "Relative".
- // Relatvie to cwd (project root) + // Relative to cwd (project root)codegenerator/cli/templates/dynamic/codegen/package.json.hbs (1)
18-18: Avoid ts-node ESM loader for compiled Index.res.mjs (agree with prior review)I agree with the earlier review: using
--loader ts-node/esm.mjsand--experimental-specifier-resolution=nodeto run a compiledIndex.res.mjsis unnecessary and brittle, especially on Node 22.x, and inconsistent with the other scripts that just usenode+ ESM imports.Since
Index.res.mjsis already JS, you can drop the ts-node loader and let Node run the file directly:- "start": "cd {{relative_path_to_root_from_generated}} && node --no-warnings --loader {{relative_path_to_generated_from_root}}/node_modules/ts-node/esm.mjs --experimental-specifier-resolution=node {{relative_path_to_generated_from_root}}/src/Index.res.mjs" + "start": "cd {{relative_path_to_root_from_generated}} && node --no-warnings {{relative_path_to_generated_from_root}}/src/Index.res.mjs"This removes experimental loader hooks and avoids coupling the generated runtime to ts-node’s ESM implementation while keeping the same entrypoint.
Does ts-node 10.9.1 officially support Node 22.x ESM loader usage (via `--loader ts-node/esm.mjs`) for production, or is it recommended to run already-compiled `.mjs` files with plain `node` instead?
🧹 Nitpick comments (1)
codegenerator/cli/templates/dynamic/codegen/package.json.hbs (1)
13-16: Dynamic ESM imports for migrations/benchmark are correctly structured; Windows portability is a valid concernThe
runUpMigrations,runDownMigrations, andSummary.printSummaryfunctions are properly exported from their respective ReScript source files and will be available in the compiled.mjsoutputs.However, the
node -e 'import("...").then(...)'pattern does have a portability limitation:cmd.exeon Windows does not interpret single-quoted strings the same way as POSIX shells, which will breaknpm run db-up/db-down/db-setup/print-benchmark-summaryon Windows. If cross-platform npm script support is a priority, consider extracting this code into a small.mjsCLI file committed to the template and updating the scripts to invoke it directly (e.g.,node ./scripts/db.mjs up), which preserves ESM semantics while avoiding shell-quoting issues.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
scenarios/test_codegen/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (8)
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mts(1 hunks)codegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts(1 hunks)codegenerator/cli/templates/dynamic/codegen/package.json.hbs(2 hunks)codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs(4 hunks)codegenerator/cli/templates/static/codegen/src/ink/bindings/Ink.res(2 hunks)codegenerator/integration_tests/tests/test_indexers/test_exits/package.json(1 hunks)codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json(2 hunks)scenarios/fuel_test/package.json(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- scenarios/fuel_test/package.json
- codegenerator/integration_tests/tests/test_indexers/test_exits/package.json
- codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
🧰 Additional context used
📓 Path-based instructions (3)
codegenerator/cli/templates/static/**/*.res
📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Static ReScript files must be placed in
codegenerator/cli/templates/static/
Files:
codegenerator/cli/templates/static/codegen/src/ink/bindings/Ink.res
**/*.{res,resi}
📄 CodeRabbit inference engine (.cursor/rules/rescript.mdc)
**/*.{res,resi}: Always use ReScript 11 documentation
Never suggest ReasonML syntax
Never use[| item |]to create an array. Use[ item ]instead
Must always use=for setting value to a field. Use:=only for ref values created usingreffunction
Use records when working with structured data, and objects to conveniently pass payload data between functions
Never use %raw to access object fields if you know the type
Files:
codegenerator/cli/templates/static/codegen/src/ink/bindings/Ink.res
codegenerator/cli/templates/dynamic/**/*.hbs
📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Handlebars templates must be placed in
codegenerator/cli/templates/dynamic/
Files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
🧠 Learnings (35)
📓 Common learnings
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use async/await for all context.Entity.get() and context.effect() calls; context.Entity.set() does not need await
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Maintain BigDecimal precision for financial calculations; never simplify to JavaScript number types
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Return BigDecimal from helper functions for financial calculations instead of number type
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Verify that entity field types in code match exactly with GraphQL schema property types (Int!, BigInt!, BigDecimal!, String!, Bytes!, Boolean!)
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use ZERO_BD and ZERO_BI constants for entity field initialization instead of hardcoded 0 values
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Ensure entity type annotations use the _t suffix (e.g., Pair_t, Token_t) when defining entity objects
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Define Effect schemas using the `S` module from 'envio' with required properties: name, input schema, output schema, rateLimit, and cache
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Import entity types from 'generated/src/db/Entities.gen' not 'generated' for type definitions
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mtscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/*.ts : After any change to TypeScript files, run `pnpm tsc --noEmit` to ensure successful compilation
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mtscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Use `string | undefined` for optional string fields in TypeScript types, not `string | null`, as generated types are strict about null vs undefined
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Create handler skeleton files with exact filenames matching the original subgraph structure during file refactoring
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mtscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Run pnpm codegen, pnpm tsc --noEmit, and TUI_OFF=true pnpm dev after every code change to catch runtime errors
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mtscodegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mtscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : Always cast timestamps to BigInt (e.g., `BigInt(event.block.timestamp)`) instead of using raw timestamps
Applied to files:
codegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Index.res : Generated runtime entry module must be named `Index.res` and must start HTTP server, load `Config.res`, call `RegisterHandlers.res`, and spin up `GlobalStateManager.res`
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to codegenerator/cli/templates/static/**/*.res : Static ReScript files must be placed in `codegenerator/cli/templates/static/`
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correct
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Reference original subgraph logic files in TODO comments when creating skeleton handlers (e.g., 'Reference: original-subgraph/src/mappings/contract.ts')
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Do not use !context.isPreload check logic during the main implementation phase; use it only after all handlers are complete
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.{res,resi} : Always use ReScript 11 documentation
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runner
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Config.res : Generated config module must be named `Config.res` and convert environment variables to typed config, setting up persistence
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Use `_only` to specify which tests to run in ReScript Mocha tests
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use async/await for all context.Entity.get() and context.effect() calls; context.Entity.set() does not need await
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Register dynamic contracts created by factory events using contractRegister above the handler (e.g., context.addPair(event.params.pair))
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Include proper error handling for Effect API calls with try/catch and fallback values
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use Effect API for all external calls (RPC calls, API calls) via context.effect() with preload_handlers: true enabled
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/config.yaml : Update config.yaml to point handler field to contract-specific files instead of single EventHandlers.ts file
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use context.log.error() for error logging in handlers and effects instead of console.log()
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Implement complex handlers one at a time and run quality checks after each handler completion before proceeding to next
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : Use `!context.isPreload` checks in handlers to prevent logic from running during preload when using preload optimisations
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When making external calls in handlers with preload optimisations enabled, MUST use the Effect API from 'envio' instead of direct fetch/external calls
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/EventHandlers.ts : Clear all boilerplate logic from EventHandlers.ts and replace with empty handlers containing TODO comments
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
🧬 Code graph analysis (2)
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mts (1)
codegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts (1)
schema(5-5)
codegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts (1)
codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mts (1)
schema(5-5)
⏰ 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). (1)
- GitHub Check: build_and_test
🔇 Additional comments (9)
codegenerator/cli/npm/envio/src/bindings/BigInt.res.d.mts (1)
1-5: ESM stub and tsc workaround comment look goodThe explanatory comment clearly documents why this stub exists and when it can be removed, and keeping
export const schema: any;as a permissive placeholder is appropriate for a GenType-generated binding shim in this migration.codegenerator/cli/npm/envio/src/bindings/BigDecimal.res.d.mts (1)
1-5: Consistent BigDecimal binding stub with BigIntThis mirrors the BigInt stub pattern and documents the tsc --noEmit workaround clearly; using
export const schema: any;as a temporary ambient placeholder is reasonable for the ES module migration.codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs (5)
1-7: LGTM!The
displayImportErrorhelper provides a good approach for formatting import exceptions, especially handling ts-node errors that can't automatically convert to strings. Usinginspectwithdepth: 5is appropriate for nested error objects.
9-22: LGTM!The async migration for
registerContractHandlersis well-structured with proper error handling that includes contract name and handler path context.
24-54: LGTM on ESM auto-loading implementation.Good improvements for ESM migration:
globIteratorbinding tonode:fs/promisesglob (Node.js 22+)- Pattern extended to include
.mjsfiles for ESM support- Parallel loading via
Promise.allwith per-file error handling
130-151: LGTM on parallel handler registration.Using
Promise.allfor contract handler registration improves loading performance compared to sequential loading. The flow correctly awaits all handlers before callingfinishRegistration().
141-148: The code at line 145 is correct as written.Path.relativePathToRootFromGeneratedis a valid ReScript value generated by thePath.res.hbstemplate that produces a module with this constant. The pattern of using ReScript string interpolation${Path.relativePathToRootFromGenerated}in backtick strings is intentional and allows runtime reference to a compile-time-generated constant.Likely an incorrect or invalid review comment.
codegenerator/cli/templates/static/codegen/src/ink/bindings/Ink.res (1)
221-263: BigText binding is correctly implemented and consistent with SpinnerThe binding uses
@module("ink-big-text") @react.component external make ... = "default", which is the correct pattern for binding CommonJS packages in this ESM-configured project (seerescript.json:"module": "esmodule","moduleResolution": "node16"). Bothink-big-textandink-spinnerare CommonJS packages; using= "default"enables proper CommonJS-to-ESM interop. The binding is consistent with the existingSpinnermodule and follows standard ReScript practice. No changes needed.codegenerator/cli/templates/dynamic/codegen/package.json.hbs (1)
7-7: ESM flag on generated package looks consistent with .mjs usageAdding
"type": "module"here is aligned with the move to.res.mjsentrypoints and keeps the generated package clearly ESM; no issues from the template side. As per coding guidelines, this Handlebars template is also correctly placed undercodegenerator/cli/templates/dynamic/.
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (2)
codegenerator/cli/templates/dynamic/codegen/package.json.hbs (2)
18-18: Remove ts-node/esm.mjs loader; use direct node import like other scripts in the file.This issue was already flagged in previous review comments. The start script unnecessarily uses the ts-node ESM loader on a pre-built
.mjsfile, which is problematic because:
- ts-node is for TypeScript, not pre-compiled JavaScript (Index.res.mjs is compiled ReScript)
- Inconsistent with lines 13-16 which successfully use plain
nodewithimport()for other.res.mjsfiles- Adds experimental/unstable Node loader hooks
Use the same pattern as the other scripts in this file, or if Index.res.mjs is an executable entry point, use plain
node.
38-53: Major dependency version bumps need explicit compatibility verification.This issue was already flagged in previous review comments. Multiple major version bumps are introduced:
react→19.2.0: Major version with breaking changes@rescript/react→0.14.0: Requires React 19, removes legacy JSX v3, mandates ReScript 11.0+ink→6.5.1: Major version bumpink-big-text→2.0.0: Major versionink-spinner→5.0.0: Major versionThe template requires confirming the generated code still compiles and runs with these versions, particularly the ReScript/React integration (JSX v4 migration, uncurried bindings) and Ink-based TUI components.
🧹 Nitpick comments (2)
scenarios/test_codegen/test/CustomSelection_test.ts (1)
77-77: Remove debug console.log statement.This debug output should be removed before merging.
Apply this diff:
- console.log(updatedMockDb.entities.CustomSelectionTestPass.get(hash)); - assert.notEqual(codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs (1)
1-7: Consider makingdisplayImportErrorprivate if not used elsewhere.The function is currently exported as a public top-level binding but appears to only be used internally within this generated file. If it's not intended to be part of the public API, consider making it private using
%%private().
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
scenarios/test_codegen/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (40)
codegenerator/cli/npm/envio/package.json(2 hunks)codegenerator/cli/npm/envio/package.json.tmpl(2 hunks)codegenerator/cli/templates/dynamic/codegen/package.json.hbs(2 hunks)codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs(4 hunks)codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs(2 hunks)codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.json(2 hunks)codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json(1 hunks)scenarios/erc20_multichain_factory/.mocharc.json(1 hunks)scenarios/erc20_multichain_factory/package.json(1 hunks)scenarios/fuel_test/package.json(2 hunks)scenarios/helpers/package.json(2 hunks)scenarios/test_codegen/.mocharc.json(0 hunks)scenarios/test_codegen/contracts/.gitignore(0 hunks)scenarios/test_codegen/contracts/README.md(0 hunks)scenarios/test_codegen/contracts/artifacts/contracts/GravatarRegistry.sol/GravatarRegistry.json(0 hunks)scenarios/test_codegen/contracts/artifacts/contracts/NftFactory.sol/NftFactory.json(0 hunks)scenarios/test_codegen/contracts/artifacts/contracts/SimpleNft.sol/SimpleNft.json(0 hunks)scenarios/test_codegen/contracts/contracts/GravatarRegistry.sol(0 hunks)scenarios/test_codegen/contracts/contracts/NftFactory.sol(0 hunks)scenarios/test_codegen/contracts/contracts/SimpleNft.sol(0 hunks)scenarios/test_codegen/contracts/deploy/deploy.js(0 hunks)scenarios/test_codegen/contracts/package.json(0 hunks)scenarios/test_codegen/contracts/secretsManager.example.ts(0 hunks)scenarios/test_codegen/contracts/tasks/index.js(0 hunks)scenarios/test_codegen/contracts/tasks/newGravatarTask.js(0 hunks)scenarios/test_codegen/contracts/tasks/updateGravatarImageTask.js(0 hunks)scenarios/test_codegen/contracts/tasks/updateGravatarNameTask.js(0 hunks)scenarios/test_codegen/hardhat.config.ts(0 hunks)scenarios/test_codegen/package.json(3 hunks)scenarios/test_codegen/src/EventHandlers.ts(3 hunks)scenarios/test_codegen/test/CustomSelection_test.ts(2 hunks)scenarios/test_codegen/test/E2EEthNode_test.res(0 hunks)scenarios/test_codegen/test/EventHandler_test.ts(1 hunks)scenarios/test_codegen/test/helpers/LiveGravatarTask.res(0 hunks)scenarios/test_codegen/test/helpers/SetupRpcNode.res(0 hunks)scenarios/test_codegen/test/helpers/contracts/GravatarRegistry.sol(0 hunks)scenarios/test_codegen/test/helpers/node-and-contracts.ts(0 hunks)scenarios/test_codegen/test/helpers/setupNodeAndContracts.js(0 hunks)scenarios/test_codegen/test/helpers/taskLiveGravatarTxs.js(0 hunks)scenarios/test_codegen/test/topic-hashing-test.ts(1 hunks)
💤 Files with no reviewable changes (24)
- scenarios/test_codegen/.mocharc.json
- scenarios/test_codegen/test/helpers/LiveGravatarTask.res
- scenarios/test_codegen/contracts/tasks/newGravatarTask.js
- scenarios/test_codegen/contracts/tasks/updateGravatarImageTask.js
- scenarios/test_codegen/contracts/deploy/deploy.js
- scenarios/test_codegen/contracts/tasks/updateGravatarNameTask.js
- scenarios/test_codegen/test/helpers/contracts/GravatarRegistry.sol
- scenarios/test_codegen/contracts/artifacts/contracts/NftFactory.sol/NftFactory.json
- scenarios/test_codegen/test/helpers/taskLiveGravatarTxs.js
- scenarios/test_codegen/contracts/artifacts/contracts/SimpleNft.sol/SimpleNft.json
- scenarios/test_codegen/test/helpers/node-and-contracts.ts
- scenarios/test_codegen/test/helpers/setupNodeAndContracts.js
- scenarios/test_codegen/contracts/README.md
- scenarios/test_codegen/contracts/artifacts/contracts/GravatarRegistry.sol/GravatarRegistry.json
- scenarios/test_codegen/test/E2EEthNode_test.res
- scenarios/test_codegen/test/helpers/SetupRpcNode.res
- scenarios/test_codegen/contracts/secretsManager.example.ts
- scenarios/test_codegen/contracts/.gitignore
- scenarios/test_codegen/contracts/contracts/GravatarRegistry.sol
- scenarios/test_codegen/contracts/contracts/SimpleNft.sol
- scenarios/test_codegen/contracts/tasks/index.js
- scenarios/test_codegen/contracts/contracts/NftFactory.sol
- scenarios/test_codegen/contracts/package.json
- scenarios/test_codegen/hardhat.config.ts
✅ Files skipped from review due to trivial changes (1)
- scenarios/test_codegen/test/EventHandler_test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- codegenerator/cli/npm/envio/package.json
- codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.json
- scenarios/fuel_test/package.json
- scenarios/erc20_multichain_factory/package.json
- scenarios/test_codegen/test/topic-hashing-test.ts
- scenarios/helpers/package.json
🧰 Additional context used
📓 Path-based instructions (1)
codegenerator/cli/templates/dynamic/**/*.hbs
📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Handlebars templates must be placed in
codegenerator/cli/templates/dynamic/
Files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
🧠 Learnings (40)
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Register dynamic contracts created by factory events using contractRegister above the handler (e.g., context.addPair(event.params.pair))
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Include proper error handling for Effect API calls with try/catch and fallback values
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/config.yaml : Update config.yaml to point handler field to contract-specific files instead of single EventHandlers.ts file
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Reference original subgraph logic files in TODO comments when creating skeleton handlers (e.g., 'Reference: original-subgraph/src/mappings/contract.ts')
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use context.log.error() for error logging in handlers and effects instead of console.log()
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use async/await for all context.Entity.get() and context.effect() calls; context.Entity.set() does not need await
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use Effect API for all external calls (RPC calls, API calls) via context.effect() with preload_handlers: true enabled
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Implement complex handlers one at a time and run quality checks after each handler completion before proceeding to next
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Create handler skeleton files with exact filenames matching the original subgraph structure during file refactoring
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Do not use !context.isPreload check logic during the main implementation phase; use it only after all handlers are complete
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Config.res : Generated config module must be named `Config.res` and convert environment variables to typed config, setting up persistence
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Index.res : Generated runtime entry module must be named `Index.res` and must start HTTP server, load `Config.res`, call `RegisterHandlers.res`, and spin up `GlobalStateManager.res`
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correct
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/EventHandlers.ts : Clear all boilerplate logic from EventHandlers.ts and replace with empty handlers containing TODO comments
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When making external calls in handlers with preload optimisations enabled, MUST use the Effect API from 'envio' instead of direct fetch/external calls
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbsscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : Use `!context.isPreload` checks in handlers to prevent logic from running during preload when using preload optimisations
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Use `_only` to specify which tests to run in ReScript Mocha tests
Applied to files:
scenarios/test_codegen/test/CustomSelection_test.tscodegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbsscenarios/erc20_multichain_factory/.mocharc.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-05-27T17:07:12.878Z
Learnt from: JonoPrest
Repo: enviodev/hyperindex PR: 555
File: scenarios/test_codegen/test/lib_tests/EntityHistory_test.res:631-659
Timestamp: 2025-05-27T17:07:12.878Z
Learning: In isolated tests for EntityHistory rollbacks with controlled mock data setup, the ordering of getRollbackDiff results is deterministic and doesn't require sorting before comparison with deepStrictEqual.
Applied to files:
scenarios/test_codegen/test/CustomSelection_test.ts
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/*.ts : After any change to TypeScript files, run `pnpm tsc --noEmit` to ensure successful compilation
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/package.json.tmpl
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Use `string | undefined` for optional string fields in TypeScript types, not `string | null`, as generated types are strict about null vs undefined
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Run pnpm codegen, pnpm tsc --noEmit, and TUI_OFF=true pnpm dev after every code change to catch runtime errors
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/package.json.tmplscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runner
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbsscenarios/erc20_multichain_factory/.mocharc.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/package.json.tmplscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbsscenarios/erc20_multichain_factory/.mocharc.jsonscenarios/test_codegen/src/EventHandlers.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Prefix all entity IDs with chainId in multichain indexing: ${event.chainId}-${originalId}
Applied to files:
scenarios/erc20_multichain_factory/.mocharc.json
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.test.{res,resi} : Use try/catch as expressions instead of refs for tracking success/failure in tests
Applied to files:
scenarios/erc20_multichain_factory/.mocharc.json
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.test.{res,resi} : Never use `Js.Console.log` in test files. Use `Assert` module for all verifications
Applied to files:
scenarios/erc20_multichain_factory/.mocharc.jsonscenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.test.{res,resi} : When testing with multiple iterations, collect results in data structures and assert on them
Applied to files:
scenarios/erc20_multichain_factory/.mocharc.json
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.test.{res,resi} : Tests should be silent unless they fail - rely on assertions rather than logging
Applied to files:
scenarios/erc20_multichain_factory/.mocharc.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Test the indexer with TUI_OFF=true pnpm dev for ~30 seconds after every code change to catch runtime errors
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When updating existing entities in TypeScript handlers, always use the spread operator since returned objects are read-only and immutable
Applied to files:
scenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/effects/**/*.ts : Create Effect API functions in src/effects/ folder with proper schema definition using createEffect from 'envio'
Applied to files:
scenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Define Effect schemas using the `S` module from 'envio' with required properties: name, input schema, output schema, rateLimit, and cache
Applied to files:
scenarios/test_codegen/src/EventHandlers.tscodegenerator/cli/npm/envio/package.json.tmpl
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use batch Promise.all() for multiple Effect API calls to improve performance
Applied to files:
scenarios/test_codegen/src/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Verify that entity field types in code match exactly with GraphQL schema property types (Int!, BigInt!, BigDecimal!, String!, Bytes!, Boolean!)
Applied to files:
scenarios/test_codegen/src/EventHandlers.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/package.json.tmpl
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Import entity types from 'generated/src/db/Entities.gen' not 'generated' for type definitions
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/package.json.tmpl
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to codegenerator/cli/templates/static/**/*.res : Static ReScript files must be placed in `codegenerator/cli/templates/static/`
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbscodegenerator/cli/npm/envio/package.json.tmplscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.{res,resi} : Always use ReScript 11 documentation
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Ensure entity type annotations use the _t suffix (e.g., Pair_t, Token_t) when defining entity objects
Applied to files:
codegenerator/cli/npm/envio/package.json.tmpl
🔇 Additional comments (20)
scenarios/erc20_multichain_factory/.mocharc.json (1)
2-2: Configuration correctly aligns with ESM migration.The glob pattern update from
test/**/*.res.jstotest/**/*.{ts,res.mjs}is correct and properly configured. ReScript's build configuration (rescript.json) outputs.res.mjsfiles, no stale.res.jsfiles remain, and the pattern accommodates both compiled ReScript tests and TypeScript tests.Verify the migration is complete by running
pnpm rescript && pnpm mochato ensure all tests compile and execute properly.codegenerator/cli/templates/dynamic/codegen/package.json.hbs (2)
7-7: LGTM! Correct ESM package type declaration.The addition of
"type": "module"correctly enables ESM mode for the generated package, which is essential for the CommonJS → ESM migration.
13-16: LGTM! Proper ESM dynamic import pattern for database and benchmark scripts.The migration to
node -e 'import(...).then(m => m.function())'is the correct approach for invoking functions from ESM modules. The pattern is consistent across all four scripts.codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json (1)
4-4: ESM configuration is properly set up, but the mocha test script references non-existent test files.The tsconfig.json is correctly configured with
"module": "Node16"and"moduleResolution": "Node16"to align with"type": "module"in package.json. However, the mocha script in package.json runstest/**/*.{ts}but there are no test files or test directory in this package—only src/, config files, and schema definitions. Either remove the mocha script if this package doesn't require tests, or add actual test files if tests are intended.⛔ Skipped due to learnings
Learnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/navigation.mdc:0-0 Timestamp: 2025-11-25T12:40:19.463Z Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runnerLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/navigation.mdc:0-0 Timestamp: 2025-11-25T12:40:19.463Z Learning: Applies to **/*.{test.res,spec.res} : Use `_only` to specify which tests to run in ReScript Mocha testsLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correctscenarios/test_codegen/package.json (5)
4-4: ESM module type correctly declared.The addition of
"type": "module"aligns with the PR's CommonJS→ESM migration objective.
40-40: Dependency updates align with ESM migration.The additions of
ts-node@10.9.2andsinon@^15.0.4, plus the patch bump ofrescript-schemato9.3.4, all appear compatible with the ESM migration and modern testing practices.Also applies to: 44-44, 45-45
52-52: TypeScript version pinning to5.9.3is consistent across the entire repository and represents the intended dependency strategy—not an anomaly specific to this file. No action needed.
16-16: ReScript test files will not be discovered by mocha — pattern mismatch requires file renaming.The mocha script searches for
test/**/*.{ts,res.mjs}, but all 41 ReScript test files in the directory have the.resextension, not.res.mjs. The mocha command will only discover TypeScript tests (.tsfiles) and will silently skip all ReScript tests, resulting in incomplete test coverage. Rename all.restest files to.res.mjsto match the expected pattern.⛔ Skipped due to learnings
Learnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/navigation.mdc:0-0 Timestamp: 2025-11-25T12:40:19.463Z Learning: Applies to **/*.{test.res,spec.res} : Use `_only` to specify which tests to run in ReScript Mocha testsLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/navigation.mdc:0-0 Timestamp: 2025-11-25T12:40:19.463Z Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScriptLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/navigation.mdc:0-0 Timestamp: 2025-11-25T12:40:19.463Z Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runnerLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/navigation.mdc:0-0 Timestamp: 2025-11-25T12:40:19.463Z Learning: Applies to codegenerator/cli/templates/static/**/*.res : Static ReScript files must be placed in `codegenerator/cli/templates/static/`Learnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/rescript.mdc:0-0 Timestamp: 2025-11-25T12:40:26.435Z Learning: Applies to **/*.{res,resi} : Always use ReScript 11 documentationLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/rescript.mdc:0-0 Timestamp: 2025-11-25T12:40:26.435Z Learning: Applies to **/*.test.{res,resi} : Use try/catch as expressions instead of refs for tracking success/failure in testsLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/rescript.mdc:0-0 Timestamp: 2025-11-25T12:40:26.435Z Learning: Applies to **/*.test.{res,resi} : Never use `Js.Console.log` in test files. Use `Assert` module for all verificationsLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/rescript.mdc:0-0 Timestamp: 2025-11-25T12:40:26.435Z Learning: Applies to **/*.{res,resi} : Never suggest ReasonML syntaxLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Run pnpm codegen, pnpm tsc --noEmit, and TUI_OFF=true pnpm dev after every code change to catch runtime errors
24-24:envio startis the appropriate command for this test scenario.The change from
ts-node ./generated/src/Index.res.jstoenvio startcorrectly uses the envio CLI to start the indexer. The config.yaml is properly configured for envio, and this pattern is consistently applied across other test scenarios in the codebase.scenarios/test_codegen/src/EventHandlers.ts (2)
2-8: LGTM! Type-only imports correctly applied.The migration to type-only imports for
Effect,Logger,EffectCaller,NftCollection,User,eventLog,NftFactory_SimpleNftCreated_eventArgs,NftFactory_SimpleNftCreated_event, andTypeEqualis correct. These identifiers are only used in type positions throughout the file, which makes this change appropriate for the ESM migration.Also applies to: 17-21, 24-24
310-310: Non-null assertion is justified here.
TestHelpers.Addresses.mockAddressesis a statically initialized array with 20 hardcoded addresses defined incodegenerator/cli/npm/envio/src/bindings/Ethers.res. Array access to[0]is guaranteed to succeed at runtime, making the non-null assertion safe and appropriate.codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs (5)
9-22: LGTM! Async conversion for ESM imports is correct.The function has been properly converted to async to support dynamic ESM imports via
Utils.importPath. The error handling is appropriate and provides clear context including contract name and handler path.
27-27: Typo fixed as requested.The comment now correctly reads "Relative to cwd (project root)" - the previous typo has been addressed.
41-53: LGTM! Async auto-loading with proper error handling.The conversion to asynchronous imports is well-implemented:
- Each handler file is imported in parallel using
Promise.all- Per-file error handling provides clear context about which file failed to load
- Fail-fast behavior ensures that if any handler fails to load, the entire operation fails
- Comments clearly explain the relative path logic
28-28:.mjsinclusion in handler glob pattern is necessary for ESM support.ReScript is configured to output ESM modules with
.res.mjssuffix (seerescript.jsonconfigurations throughout the templates and scenarios). The generated.mjsfiles are actively imported in package.json scripts and referenced in configuration files. Adding.mjsto the glob pattern ensures the handler auto-loader can discover both.jsand.mjsfiles, which is essential for the ESM-based handler loading mechanism.
141-148: Good change to parallel handler registration.Using
Promise.allensures all contract handlers are fully registered before proceeding toEventRegister.finishRegistration(). This improves performance through parallel loading, which is safe since each contract handler registration is independent—eachregisterContractHandlerscall only imports a single handler file with no cross-contract dependencies or side effects.codegenerator/cli/npm/envio/package.json.tmpl (1)
4-4: Good addition of ESM package type.The addition of
"type": "module"correctly marks this package as ESM, aligning with the PR's CommonJS to ESM migration. Both entry point files (bin.js and index.js) are using ESM syntax (import/export statements), and all src files are in ESM format (.mjs). The rescript-schema dependency version 9.3.4 exists and is available.codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs (3)
4-4: LGTM! ESM enablement is correct.Adding
"type": "module"is the standard approach to enable ESM for this package.
20-20: LGTM! Test script structure is correct.The conditional build step for ReScript projects followed by mocha execution is consistent with the dev and start scripts.
31-31: Correct TypeScript version to 5.9.2.TypeScript version 5.9.3 does not exist; the latest stable release is v5.9.2 (July 31, 2025). Update line 31 to
"typescript": "5.9.2".While the upgrade from 5.2.2 includes breaking changes across lib.d.ts updates, type checking strictness, and module resolution, these are typical for such a version jump and should be manageable for generated templates. However, the immediate issue is the non-existent version reference.
⛔ Skipped due to learnings
Learnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0 Timestamp: 2025-11-25T12:40:49.622Z Learning: Applies to codegenerator/cli/templates/static/shared/**/*.ts : After any change to TypeScript files, run `pnpm tsc --noEmit` to ensure successful compilationLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correctLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0 Timestamp: 2025-11-25T12:40:49.622Z Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Use `string | undefined` for optional string fields in TypeScript types, not `string | null`, as generated types are strict about null vs undefinedLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Verify that entity field types in code match exactly with GraphQL schema property types (Int!, BigInt!, BigDecimal!, String!, Bytes!, Boolean!)Learnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Reference original subgraph logic files in TODO comments when creating skeleton handlers (e.g., 'Reference: original-subgraph/src/mappings/contract.ts')
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scenarios/test_codegen/src/handlers/EventHandlers.ts (1)
137-137: Consider using context.log for consistent observability.While these debug logs work, using
context.log.info()orcontext.log.debug()would provide better observability and align with the framework's logging patterns.Apply this diff:
- console.log("AAAA", event.transaction.hash); + context.log.info("AAAA", event.transaction.hash);- console.log("event.transaction.hash", event.transaction.hash); + context.log.info("event.transaction.hash", event.transaction.hash);Based on learnings, handlers should use the context logger for all logging to maintain consistent observability patterns.
Also applies to: 196-196
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
codegenerator/cli/npm/envio/src/EventRegister.res(1 hunks)codegenerator/cli/npm/envio/src/EventRegister.resi(1 hunks)codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbs(2 hunks)scenarios/test_codegen/config.yaml(0 hunks)scenarios/test_codegen/src/handlers/EventHandlers.ts(5 hunks)
💤 Files with no reviewable changes (1)
- scenarios/test_codegen/config.yaml
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{res,resi}
📄 CodeRabbit inference engine (.cursor/rules/rescript.mdc)
**/*.{res,resi}: Always use ReScript 11 documentation
Never suggest ReasonML syntax
Never use[| item |]to create an array. Use[ item ]instead
Must always use=for setting value to a field. Use:=only for ref values created usingreffunction
Use records when working with structured data, and objects to conveniently pass payload data between functions
Never use %raw to access object fields if you know the type
Files:
codegenerator/cli/npm/envio/src/EventRegister.rescodegenerator/cli/npm/envio/src/EventRegister.resi
codegenerator/cli/templates/dynamic/**/*.hbs
📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Handlebars templates must be placed in
codegenerator/cli/templates/dynamic/
Files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbs
🧠 Learnings (20)
📓 Common learnings
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runner
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbsscenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/EventHandlers.ts : Clear all boilerplate logic from EventHandlers.ts and replace with empty handlers containing TODO comments
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbsscenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Register dynamic contracts created by factory events using contractRegister above the handler (e.g., context.addPair(event.params.pair))
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/config.yaml : Update config.yaml to point handler field to contract-specific files instead of single EventHandlers.ts file
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When updating existing entities in TypeScript handlers, always use the spread operator since returned objects are read-only and immutable
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbsscenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correct
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Reference original subgraph logic files in TODO comments when creating skeleton handlers (e.g., 'Reference: original-subgraph/src/mappings/contract.ts')
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When making external calls in handlers with preload optimisations enabled, MUST use the Effect API from 'envio' instead of direct fetch/external calls
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbsscenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/effects/**/*.ts : Create Effect API functions in src/effects/ folder with proper schema definition using createEffect from 'envio'
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Include proper error handling for Effect API calls with try/catch and fallback values
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use Effect API for all external calls (RPC calls, API calls) via context.effect() with preload_handlers: true enabled
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Define Effect schemas using the `S` module from 'envio' with required properties: name, input schema, output schema, rateLimit, and cache
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use batch Promise.all() for multiple Effect API calls to improve performance
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use async/await for all context.Entity.get() and context.effect() calls; context.Entity.set() does not need await
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.test.{res,resi} : Never use `Js.Console.log` in test files. Use `Assert` module for all verifications
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use context.log.error() for error logging in handlers and effects instead of console.log()
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Verify that entity field types in code match exactly with GraphQL schema property types (Int!, BigInt!, BigDecimal!, String!, Bytes!, Boolean!)
Applied to files:
scenarios/test_codegen/src/handlers/EventHandlers.ts
🔇 Additional comments (8)
scenarios/test_codegen/src/handlers/EventHandlers.ts (3)
2-8: LGTM! Type-only imports correctly applied for ESM migration.The conversion of
Effect,Logger, andEffectCallerto type-only imports is correct. These types are used exclusively in type annotations throughout the file and will be properly erased at runtime in ESM.
17-21: LGTM! Entity and event types correctly converted to type-only imports.The distinction between type-only imports (
NftCollection,User,eventLog, event types) and value imports (BigDecimal,onBlock) is correctly applied. All type-only imports are used exclusively in type annotations.
24-24: LGTM! TypeEqual correctly imported as type-only.Proper separation between the type (
TypeEqual) and the runtime function (expectType).codegenerator/cli/npm/envio/src/EventRegister.resi (1)
11-11: LGTM: Clean API extension.The new
isPendingRegistrationsignature is well-placed and provides a useful query method for checking registration state.codegenerator/cli/npm/envio/src/EventRegister.res (1)
71-76: LGTM: Correct implementation.The function properly checks the
activeRegistrationref and returns whether there's an unfinished registration in progress. The logic handles bothSomeandNonecases correctly.codegenerator/cli/templates/dynamic/codegen/src/TestHelpers_MockDb.res.hbs (3)
321-325: LGTM: Flexible registration flow for test scenarios.The conditional logic appropriately handles cases where handlers may have already started registration (via
preRegisteredarray) versus cases where registration hasn't begun. The mixed sync/async branches should compile correctly in ReScript's async context.
338-338: LGTM: Improved clarity.Explicit type annotation makes the code more readable and provides better IDE support.
346-349: LGTM: Good defensive check.The runtime validation ensures that events have either a handler or contract register before processing, preventing silent failures. The error message clearly identifies the problematic event configuration.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs (1)
20-22: Typo fix confirmed.The spelling correction from "Relatvie" to "Relative" has been addressed.
codegenerator/cli/templates/dynamic/codegen/package.json.hbs (1)
38-50: Major dependency version bumps require coordinated verification.This has been flagged in a previous review. The React 19, @rescript/react 0.14.0, and ink 6.x upgrades are interdependent and require:
- JSX v4 migration for ReScript
- Uncurried bindings
- Updated Ink component APIs
Ensure the generated code and TUI components are tested with these versions.
🧹 Nitpick comments (3)
codegenerator/cli/npm/envio/src/bindings/Ethers.res.d.mts (1)
1-5: Shim looks fine; consider making the cleanup more trackableThe minimal
Addresses: anyshim is a reasonable way to unblocktsc --noEmitwith ESM/genType in the interim, and the ESM-style export is correct for a.d.mtsfile.You might make the future removal easier to track by turning the comment into an explicit TODO (e.g.,
// TODO: remove after GenType includes @ts-ignore for this import) or referencing an issue. Optionally, once the underlying ReScript/JS shape is stable, tightening the type away fromanywould restore type-safety for consumers.codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs (1)
27-35: Consider movingtsxinto the TypeScript conditional block.
tsxis placed unconditionally (line 34), but it's primarily needed for TypeScript test file execution. For pure ReScript projects that only have.res.mjstest files, tsx may be unnecessary overhead.However, if the design intent is that all projects may have TypeScript test files regardless of the main language choice, this placement is acceptable.
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json (1)
9-9: Minor: Simplify redundant glob pattern brace expansion.The glob pattern
test/**/*.{ts}uses brace expansion{ts}which expands to just.ts—equivalent totest/**/*.ts. While functionally correct, simplifying totest/**/*.tsimproves clarity.- "mocha": "tsc --noEmit && NODE_OPTIONS='--no-warnings --import tsx' mocha test/**/*.{ts}", + "mocha": "tsc --noEmit && NODE_OPTIONS='--no-warnings --import tsx' mocha test/**/*.ts",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
scenarios/erc20_multichain_factory/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlscenarios/fuel_test/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlscenarios/test_codegen/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (15)
codegenerator/cli/npm/envio/src/bindings/Ethers.res.d.mts(1 hunks)codegenerator/cli/templates/dynamic/codegen/package.json.hbs(2 hunks)codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs(3 hunks)codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs(2 hunks)codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.json(2 hunks)codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json(1 hunks)scenarios/erc20_multichain_factory/package.json(1 hunks)scenarios/fuel_test/contracts/ts-interaction-tools/package.json(1 hunks)scenarios/fuel_test/package.json(2 hunks)scenarios/fuel_test/src/AllEventsHandlers.ts(1 hunks)scenarios/fuel_test/src/GreeterHandlers.ts(1 hunks)scenarios/fuel_test/test/test.ts(1 hunks)scenarios/fuel_test/tsconfig.json(1 hunks)scenarios/test_codegen/package.json(3 hunks)scenarios/test_codegen/test/Utils_test.res(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- scenarios/fuel_test/contracts/ts-interaction-tools/package.json
- scenarios/fuel_test/tsconfig.json
- scenarios/erc20_multichain_factory/package.json
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{res,resi}
📄 CodeRabbit inference engine (.cursor/rules/rescript.mdc)
**/*.{res,resi}: Always use ReScript 11 documentation
Never suggest ReasonML syntax
Never use[| item |]to create an array. Use[ item ]instead
Must always use=for setting value to a field. Use:=only for ref values created usingreffunction
Use records when working with structured data, and objects to conveniently pass payload data between functions
Never use %raw to access object fields if you know the type
Files:
scenarios/test_codegen/test/Utils_test.res
codegenerator/cli/templates/dynamic/**/*.hbs
📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Handlebars templates must be placed in
codegenerator/cli/templates/dynamic/
Files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
🧠 Learnings (36)
📓 Common learnings
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Create handler skeleton files with exact filenames matching the original subgraph structure during file refactoring
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Ensure entity type annotations use the _t suffix (e.g., Pair_t, Token_t) when defining entity objects
Applied to files:
codegenerator/cli/npm/envio/src/bindings/Ethers.res.d.mtsscenarios/fuel_test/src/AllEventsHandlers.tscodegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Reference original subgraph logic files in TODO comments when creating skeleton handlers (e.g., 'Reference: original-subgraph/src/mappings/contract.ts')
Applied to files:
codegenerator/cli/npm/envio/src/bindings/Ethers.res.d.mtscodegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Import entity types from 'generated/src/db/Entities.gen' not 'generated' for type definitions
Applied to files:
codegenerator/cli/npm/envio/src/bindings/Ethers.res.d.mtsscenarios/fuel_test/src/AllEventsHandlers.tscodegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbsscenarios/fuel_test/test/test.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When updating existing entities in TypeScript handlers, always use the spread operator since returned objects are read-only and immutable
Applied to files:
scenarios/fuel_test/src/AllEventsHandlers.tsscenarios/fuel_test/src/GreeterHandlers.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
Applied to files:
scenarios/fuel_test/src/AllEventsHandlers.tsscenarios/fuel_test/src/GreeterHandlers.tscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/EventHandlers.ts : Clear all boilerplate logic from EventHandlers.ts and replace with empty handlers containing TODO comments
Applied to files:
scenarios/fuel_test/src/AllEventsHandlers.tscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Applied to files:
scenarios/fuel_test/src/AllEventsHandlers.tsscenarios/fuel_test/src/GreeterHandlers.tsscenarios/fuel_test/test/test.tscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Define Effect schemas using the `S` module from 'envio' with required properties: name, input schema, output schema, rateLimit, and cache
Applied to files:
scenarios/fuel_test/src/AllEventsHandlers.tscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/*.ts : After any change to TypeScript files, run `pnpm tsc --noEmit` to ensure successful compilation
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.jsonscenarios/fuel_test/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Use `string | undefined` for optional string fields in TypeScript types, not `string | null`, as generated types are strict about null vs undefined
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Run pnpm codegen, pnpm tsc --noEmit, and TUI_OFF=true pnpm dev after every code change to catch runtime errors
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.jsonscenarios/fuel_test/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Create handler skeleton files with exact filenames matching the original subgraph structure during file refactoring
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Verify that entity field types in code match exactly with GraphQL schema property types (Int!, BigInt!, BigDecimal!, String!, Bytes!, Boolean!)
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Use Node.js v20 only (no higher or lower versions)
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Use Node.js v20 only; do not use higher or lower versions for development environment
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Use `_only` to specify which tests to run in ReScript Mocha tests
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbsscenarios/fuel_test/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correct
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to codegenerator/cli/templates/static/**/*.res : Static ReScript files must be placed in `codegenerator/cli/templates/static/`
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbsscenarios/fuel_test/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Implement complex handlers one at a time and run quality checks after each handler completion before proceeding to next
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Do not use !context.isPreload check logic during the main implementation phase; use it only after all handlers are complete
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runner
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsonscenarios/fuel_test/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
Applied to files:
codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbsscenarios/fuel_test/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Register dynamic contracts created by factory events using contractRegister above the handler (e.g., context.addPair(event.params.pair))
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use async/await for all context.Entity.get() and context.effect() calls; context.Entity.set() does not need await
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/config.yaml : Update config.yaml to point handler field to contract-specific files instead of single EventHandlers.ts file
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use Effect API for all external calls (RPC calls, API calls) via context.effect() with preload_handlers: true enabled
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use context.log.error() for error logging in handlers and effects instead of console.log()
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Index.res : Generated runtime entry module must be named `Index.res` and must start HTTP server, load `Config.res`, call `RegisterHandlers.res`, and spin up `GlobalStateManager.res`
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Config.res : Generated config module must be named `Config.res` and convert environment variables to typed config, setting up persistence
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : When making external calls in handlers with preload optimisations enabled, MUST use the Effect API from 'envio' instead of direct fetch/external calls
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/EventHandlers.ts : Use `!context.isPreload` checks in handlers to prevent logic from running during preload when using preload optimisations
Applied to files:
codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Test the indexer with TUI_OFF=true pnpm dev for ~30 seconds after every code change to catch runtime errors
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.{res,resi} : Always use ReScript 11 documentation
Applied to files:
scenarios/fuel_test/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Whitelist and use the commands: pnpm codegen, pnpm tsc --noEmit, TUI_OFF=true pnpm dev during development
Applied to files:
scenarios/fuel_test/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use entity field names with _id suffix for entity relationships (e.g., token0_id, token1_id) matching generated schema
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
🔇 Additional comments (16)
scenarios/test_codegen/test/Utils_test.res (1)
133-135: Function hash expectation string looks correctThe updated expectation from a
function () {}‑style representation tofunction() {}matches the new literal used in%rawand keeps the test aligned with the currentUtils.Hash.makeOrThrowbehavior while still going through the publicUtils.HashAPI in tests, which is consistent with prior learnings.scenarios/fuel_test/src/AllEventsHandlers.ts (1)
6-6: LGTM! Correct type-only import.The
TypeEqualimport is correctly marked as type-only since it's exclusively used in type positions (theAssertSchemaTypetype alias andexpectTypecalls). This optimization is consistent with ESM migration best practices and helps with tree-shaking.scenarios/fuel_test/test/test.ts (1)
2-2: LGTM! Correct type-only import.The
Userimport is correctly marked as type-only since it's only used as a type annotation at line 27. This aligns with the ESM migration and follows TypeScript best practices.scenarios/fuel_test/src/GreeterHandlers.ts (1)
1-1: LGTM! Correct type-only import.The
Userimport is correctly marked as type-only since it's exclusively used as a type annotation at line 20. This change properly supports the ESM migration while maintaining type safety.codegenerator/cli/templates/dynamic/codegen/src/Generated.res.hbs (3)
2-16: LGTM!The async handler registration pattern is well-structured. The error handling correctly logs the exception with context before re-throwing, which aids debugging.
38-48: Async loading pattern looks correct.The
Promise.allwith per-file error handling provides good error context while maintaining fail-fast behavior. When any handler fails to load, the entire operation will fail with a descriptive error message.
136-143: Good use of parallel handler registration.Collecting all handler registrations and awaiting them with
Promise.allis more efficient than sequential registration. The handlers are independent, making parallel execution safe.codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.json (2)
4-13: ESM migration changes look good.The addition of
"type": "module", tsx-based test execution with--import tsx, and the newstartscript align well with the broader CommonJS-to-ESM migration. The approach of usingtsc --noEmitbefore mocha ensures type-checking without emitting files.
19-20: > Likely an incorrect or invalid review comment.scenarios/fuel_test/package.json (1)
4-17: ESM migration changes are consistent.The updates to
"type": "module", the mocha script using tsx, and the simplified"start": "envio start"align with the broader migration pattern. The mocha script correctly includes both.tsand.res.mjstest file patterns for this ReScript-enabled scenario.codegenerator/cli/templates/dynamic/codegen/package.json.hbs (1)
13-16: Dynamic import scripts are well-structured.The ESM dynamic import pattern
import("./path.res.mjs").then(m => m.fn())is the correct approach for invoking compiled ReScript modules in an ESM context without needing additional loaders.scenarios/test_codegen/package.json (4)
4-4: ESM migration marker added correctly.The
"type": "module"declaration correctly marks the package as ESM-first, enabling all.jsand.tsfiles to be treated as ES modules by default.
16-16: mocha script updated for ESM TypeScript support.The mocha invocation now uses
NODE_OPTIONS='--no-warnings --import tsx'to load tsx as an ESM loader, which transpiles TypeScript on-the-fly. The test file pattern includes.res.mjs, indicating ReScript compilation targets ESM. This setup is appropriate for the migration.
24-24: Verify the "start" script change.The start script has been updated to
"envio start". Confirm this command:
- Correctly replaces the previous hardhat-based test setup (Hardhat packages removed per PR summary).
- Works as expected in the test scenario context.
envioat line 55 is available and configured properly.
40-40: All dependency versions are valid and compatible—no action required.The packages verified successfully. TypeScript 5.9.3 is a patch release (not a major jump) specifically designed to address ESM/interop compatibility. tsx 4.21.0 works with Mocha + ESM via import loader setup (documented approach). sinon 15.0.4 has no ESM-related breaking changes. rescript-schema 9.3.4 appears to be a patch update with no identified breaking changes.
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json (1)
4-4: The mocha script glob patterntest/**/*.{ts}will match zero test files in this template.This is a template indexer directory with no
test/folder. The mocha script should either be removed if this indexer template doesn't require tests, or test files should be added to atest/directory. As currently configured,pnpm testwill execute mocha with no test files to run.⛔ Skipped due to learnings
Learnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0 Timestamp: 2025-11-25T12:40:49.622Z Learning: Applies to codegenerator/cli/templates/static/shared/**/*.ts : After any change to TypeScript files, run `pnpm tsc --noEmit` to ensure successful compilationLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/navigation.mdc:0-0 Timestamp: 2025-11-25T12:40:19.463Z Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runnerLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Run pnpm codegen, pnpm tsc --noEmit, and TUI_OFF=true pnpm dev after every code change to catch runtime errorsLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Test the indexer with TUI_OFF=true pnpm dev for ~30 seconds after every code change to catch runtime errorsLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correctLearnt from: CR Repo: enviodev/hyperindex PR: 0 File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0 Timestamp: 2025-11-25T12:41:23.343Z Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Verify that entity field types in code match exactly with GraphQL schema property types (Int!, BigInt!, BigDecimal!, String!, Bytes!, Boolean!)Learnt from: CR Repo: enviodev/hyperindex PR: 0 File: .cursor/rules/navigation.mdc:0-0 Timestamp: 2025-11-25T12:40:19.463Z Learning: Applies to **/*.{test.res,spec.res} : Use `_only` to specify which tests to run in ReScript Mocha tests
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
codegenerator/cli/templates/dynamic/codegen/package.json.hbs (1)
37-53: Major dependency version bumps noted—prior review concerns still apply.A previous review comment thoroughly documented the breaking changes in these major version bumps (React 19.2.0, @rescript/react 0.14.0, Ink 6.5.1, etc.) and requested compatibility verification. Those concerns remain valid for this WIP PR. Ensure:
- ReScript 11 + JSX v4 + uncurried bindings are tested
- React 19 breaking changes (JSX transform, ReactDOM APIs) are verified
- Ink TUI components work with the new versions
Based on learnings, run
pnpm rescriptandpnpm mochato verify tests pass after these updates.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
scenarios/erc20_multichain_factory/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlscenarios/fuel_test/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlscenarios/test_codegen/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
codegenerator/cli/npm/envio/package.json(2 hunks)codegenerator/cli/npm/envio/package.json.tmpl(3 hunks)codegenerator/cli/templates/dynamic/codegen/package.json.hbs(2 hunks)codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs(3 hunks)codegenerator/cli/templates/static/erc20_template/typescript/test/test.ts(2 hunks)codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.json(2 hunks)codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json(1 hunks)scenarios/erc20_multichain_factory/.mocharc.json(0 hunks)scenarios/erc20_multichain_factory/package.json(1 hunks)scenarios/fuel_test/package.json(2 hunks)scenarios/helpers/package.json(2 hunks)scenarios/test_codegen/package.json(4 hunks)
💤 Files with no reviewable changes (1)
- scenarios/erc20_multichain_factory/.mocharc.json
🚧 Files skipped from review as they are similar to previous changes (6)
- scenarios/helpers/package.json
- scenarios/fuel_test/package.json
- codegenerator/integration_tests/tests/test_indexers/dynamic_contracts/package.json
- codegenerator/cli/npm/envio/package.json
- codegenerator/cli/templates/dynamic/init_templates/shared/package.json.hbs
- codegenerator/cli/npm/envio/package.json.tmpl
🧰 Additional context used
📓 Path-based instructions (1)
codegenerator/cli/templates/dynamic/**/*.hbs
📄 CodeRabbit inference engine (.cursor/rules/navigation.mdc)
Handlebars templates must be placed in
codegenerator/cli/templates/dynamic/
Files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
🧠 Learnings (26)
📓 Common learnings
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/config.yaml : Update config.yaml to point handler field to contract-specific files instead of single EventHandlers.ts file
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Import entity types from 'generated/src/db/Entities.gen' not 'generated' for type definitions
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Move entity creation from EventHandlers.ts to contract-specific handler files matching original subgraph organization
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/utils/**/*.ts : Implement helper functions with no entity/handler dependencies immediately during migration phase 5a
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.ts
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Ensure entity type annotations use the _t suffix (e.g., Pair_t, Token_t) when defining entity objects
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Reference original subgraph logic files in TODO comments when creating skeleton handlers (e.g., 'Reference: original-subgraph/src/mappings/contract.ts')
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.tscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Systematically review each handler logic against original subgraph multiple times until logic is completely correct
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.tscodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Verify that entity field types in code match exactly with GraphQL schema property types (Int!, BigInt!, BigDecimal!, String!, Bytes!, Boolean!)
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Create handler skeleton files with exact filenames matching the original subgraph structure during file refactoring
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Use `string | undefined` for optional string fields in TypeScript types, not `string | null`, as generated types are strict about null vs undefined
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.tscodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Use entity field names with _id suffix for entity relationships (e.g., token0_id, token1_id) matching generated schema
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.ts
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.test.{res,resi} : Never use `Js.Console.log` in test files. Use `Assert` module for all verifications
Applied to files:
codegenerator/cli/templates/static/erc20_template/typescript/test/test.ts
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Verify tests pass by running `pnpm rescript` compiler and `pnpm mocha` test runner
Applied to files:
scenarios/erc20_multichain_factory/package.jsoncodegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Prefer public module APIs for testing in ReScript
Applied to files:
scenarios/erc20_multichain_factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/*.ts : After any change to TypeScript files, run `pnpm tsc --noEmit` to ensure successful compilation
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Run pnpm codegen, pnpm tsc --noEmit, and TUI_OFF=true pnpm dev after every code change to catch runtime errors
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.jsoncodegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Test the indexer with TUI_OFF=true pnpm dev for ~30 seconds after every code change to catch runtime errors
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Applies to codegenerator/cli/templates/static/shared/**/src/**/*.ts : Define Effect schemas using the `S` module from 'envio' with required properties: name, input schema, output schema, rateLimit, and cache
Applied to files:
codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Index.res : Generated runtime entry module must be named `Index.res` and must start HTTP server, load `Config.res`, call `RegisterHandlers.res`, and spin up `GlobalStateManager.res`
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to codegenerator/cli/templates/static/**/*.res : Static ReScript files must be placed in `codegenerator/cli/templates/static/`
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Applies to codegenerator/cli/templates/static/shared/src/**/*.ts : Do not use !context.isPreload check logic during the main implementation phase; use it only after all handlers are complete
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:26.435Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/rescript.mdc:0-0
Timestamp: 2025-11-25T12:40:26.435Z
Learning: Applies to **/*.{res,resi} : Always use ReScript 11 documentation
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/generated/src/Config.res : Generated config module must be named `Config.res` and convert environment variables to typed config, setting up persistence
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbs
📚 Learning: 2025-11-25T12:40:19.463Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: .cursor/rules/navigation.mdc:0-0
Timestamp: 2025-11-25T12:40:19.463Z
Learning: Applies to **/*.{test.res,spec.res} : Use `_only` to specify which tests to run in ReScript Mocha tests
Applied to files:
codegenerator/cli/templates/dynamic/codegen/package.json.hbsscenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:40:49.622Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/hyperindex.mdc:0-0
Timestamp: 2025-11-25T12:40:49.622Z
Learning: Use Node.js v20 only (no higher or lower versions)
Applied to files:
scenarios/test_codegen/package.json
📚 Learning: 2025-11-25T12:41:23.343Z
Learnt from: CR
Repo: enviodev/hyperindex PR: 0
File: codegenerator/cli/templates/static/shared/.cursor/rules/subgraph-migration.mdc:0-0
Timestamp: 2025-11-25T12:41:23.343Z
Learning: Use Node.js v20 only; do not use higher or lower versions for development environment
Applied to files:
scenarios/test_codegen/package.json
⏰ 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). (1)
- GitHub Check: build_and_test
🔇 Additional comments (17)
scenarios/test_codegen/package.json (6)
4-4: ESM enablement is correct.Adding
"type": "module"aligns the package with the CommonJS-to-ESM migration objective.
61-61: Verify Node version constraint against learnings.The engines field specifies
"node": ">=22.0.0"(unbounded upper), but the retrieved learnings state "Use Node.js v20 only." This appears to be a deliberate change from the previous constraint">=22.0.0 <=22.10.0", but please confirm this aligns with the project's intended runtime environment and CI/CD constraints.
16-16: Mocha script with tsx import is the correct ESM pattern.The
NODE_OPTIONS='--import tsx'approach correctly enables TypeScript support in ESM context for Mocha test execution.
24-24: Verify "start" script delegation.The "start" script now delegates to an external
envio startCLI rather than executing a local entry point. Confirm that this external CLI is available in the runtime environment and correctly replaces the previousts-node ./generated/src/Index.res.jsbehavior.
40-40: Verify dependency versions for ESM compatibility.Dependencies
tsx(4.21.0) andtypescript(5.9.3) are pinned to exact versions (no caret). Confirm:
tsx@4.21.0is compatible with Node 22 and the mocha test suite.typescript@5.9.3does not introduce breaking changes for the project's codebase.- Consider whether exact pinning is necessary or if a bounded caret (
^5.9.3,^4.21.0) would be more maintainable.Also applies to: 52-52
44-44: Verify updated and added devDependencies.
rescript-schemaupdated to 9.3.4 — confirm compatibility with the ReScript build pipeline.sinonadded as^15.0.4— confirm compatibility with mocha and existing test suite.Also applies to: 45-45
codegenerator/cli/templates/static/erc20_template/typescript/test/test.ts (2)
2-2: LGTM! Clean ESM import consolidation.The consolidated import with the
typekeyword for Account follows TypeScript best practices and aligns with the ESM migration objectives.
12-13: Verify that mock addresses are guaranteed to be populated.The non-null assertions assume that
Addresses.mockAddressescontains at least two elements. While this is likely safe for controlled test fixtures, consider adding a brief comment or defensive check to make the assumption explicit for template users.Optional: Add a comment for clarity:
//Get mock addresses from helpers +// Test helpers guarantee at least 2 mock addresses are available const userAddress1 = Addresses.mockAddresses[0]!; const userAddress2 = Addresses.mockAddresses[1]!;codegenerator/integration_tests/tests/test_indexers/wildcard-uni-factory/package.json (4)
4-4: LGTM! ESM migration correctly configured.The
"type": "module"field enables ES module semantics for this package, consistent with the broader PR's CommonJS-to-ESM migration.
9-9: Good practice: Type-check before running tests.The mocha script now runs
tsc --noEmitbefore executing tests, catching type errors early. The use of tsx withNODE_OPTIONScorrectly handles ES module TypeScript execution.
13-13: LGTM! Start script correctly delegates to envio CLI.The change from
ts-node generated/src/Index.res.jstoenvio startaddresses the previous review concern about ESM loader support and properly delegates execution to the envio CLI.
19-21: Dependency updates align with ESM migration.The updates are consistent with the migration:
- TypeScript 5.9.3 has better ES module support
- tsx replaces ts-node/ts-mocha for ESM-native TypeScript execution
codegenerator/cli/templates/dynamic/codegen/package.json.hbs (3)
7-7: LGTM! ES module type declaration.The
"type": "module"field correctly configures the generated package for ES module semantics, consistent with the PR's migration goals.
13-16: LGTM! Database scripts use correct ESM dynamic import pattern.The migration scripts correctly use
node -e 'import(...).then(...)'to dynamically load ES modules. The pattern is clean and appropriate for running compiled ReScript (.res.mjs) files.
24-24: Node engine constraint loosened—verify compatibility.The upper bound has been removed (previously
<=22.10.0), now allowing any Node.js 22.x version. Ensure this aligns with the compatibility matrix for the updated dependencies (React 19, ReScript 11.1.3, etc.).scenarios/erc20_multichain_factory/package.json (2)
9-9: The mocha pattern is correct; clarify the relationship betweenenvio devandenvio startcommands.The mocha pattern correctly references
.mjsfiles (line 9), which ReScript outputs perrescript.jsonconfiguration. However,envio startis not a replacement forenvio dev—they are complementary commands with different purposes:envio devincludes automatic codegen for changed files, whileenvio startstarts the indexer without automatic codegen. Both scripts should coexist (line 12-13), so no CI/CD updates are required for existingenvio devworkflows.Likely an incorrect or invalid review comment.
21-21: Verify rescript-schema 9.3.4 includes ESM/CJS interoperability fixes.The patch bump from 9.3.0 to 9.3.4 addresses ESM-forward packaging issues in the 9.3.0 release, which caused runtime and module resolution problems when mixing "type":"module" with ReScript outputs. Confirm that 9.3.4 resolves the specific entrypoint and module format issues relevant to your build setup.
Summary by CodeRabbit
Refactor
Dependencies
New Features
Removed
✏️ Tip: You can customize this high-level summary in your review settings.