Support custom configs in MockIndexer and add envio package tests - #1445
Conversation
- Add packages/envio/test as a ReScript source dir with its own vitest setup; npm artifact excludes it (build-artifact strips the test source entry from the published rescript.json and never copies the dir). - Move MockIndexerConfig and scenario-unrelated tests (ConfigYaml, ColumnNameFormat, Utils, ReorgDetection, HyperSync, etc.) from scenarios/test_codegen to packages/envio/test. - MockIndexer.Indexer.make accepts ~config parsed through the real user YAML pipeline; handler-file autoload is skipped for supplied configs and the mock source registration derives its contract from the config instead of hardcoding Gravatar. The module-level pg client is now lazy. - Add YamlConfigIndexer_test: YAML + schema strings drive a full mock indexer run into Postgres. - CI runs the envio package tests (NODE_PATH points require() at the prebuilt NAPI addon artifact). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR adds Envio package test execution, Vitest configuration, publish-time test-source cleanup, broad runtime and configuration coverage, HyperSync/SVM tests, and YAML-driven MockIndexer support for scenario tests. ChangesEnvio test and publish wiring
Configuration and schema contracts
Runtime behavior and storage coverage
HyperSync and ecosystem source coverage
YAML-driven MockIndexer scenarios
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🧹 Nitpick comments (6)
packages/envio/test/ConfigYaml_test.res (1)
33-64: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCollapse each test to one whole-value assertion.
Build a tuple or record containing the relevant config, chain, source, contract, and event values, then compare it with one
toEqualcall.As per coding guidelines, “Always use single assert to check the whole value instead of multiple asserts for every field.”
Also applies to: 66-98, 807-831, 881-895
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/ConfigYaml_test.res` around lines 33 - 64, Update the affected tests, including the case around MockIndexerConfig.parseYaml and the ranges noted in the review, to gather all relevant config, chain, source, contract, and event fields into one tuple or record and verify them with a single toEqual assertion. Remove the individual field-level expect calls while preserving the existing expected values and test coverage.Source: Coding guidelines
packages/envio/test/OnBlockSchema_test.res (1)
3-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove comments that narrate test purpose, callers, or refactor history. Retain only concise explanations of non-obvious invariants or surprising behavior.
packages/envio/test/OnBlockSchema_test.res#L3-L13: retain only the subtle two-stage validation invariant.packages/envio/test/OnBlockSchema_test.res#L61-L62: remove theextractRangeimplementation pointer.packages/envio/test/OnBlockSchema_test.res#L78-L83: keep theSome(undefined)rejection behavior, but remove old-behavior history.packages/envio/test/ClientAddressFilter_test.res#L3-L5: remove the module-purpose summary.packages/envio/test/ClientAddressFilter_test.res#L27-L29: remove the handler-reference narration.packages/envio/test/helpers/MockIndexerConfig.res#L6-L6: remove the function-purpose summary.As per coding guidelines, comments should explain only non-obvious constraints, subtle invariants, specific workarounds, or surprising behavior.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/OnBlockSchema_test.res` around lines 3 - 13, Trim comments at packages/envio/test/OnBlockSchema_test.res lines 3-13, 61-62, and 78-83, packages/envio/test/ClientAddressFilter_test.res lines 3-5 and 27-29, and packages/envio/test/helpers/MockIndexerConfig.res line 6: retain only the concise two-stage validation invariant in OnBlockSchema_test and the Some(undefined) rejection behavior, while removing purpose summaries, caller/handler references, extractRange pointers, and historical narration.Source: Coding guidelines
packages/envio/test/Config_test.res (1)
229-270: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd explicit types to every
Utils.magiccast.Annotate each cast itself with its concrete input type and
Internal.eventParamsoutput type rather than relying on the destination variable annotation.As per coding guidelines, “When using
Utils.magicfor type casting in ReScript, always add explicit type annotations:value->(Utils.magic: inputType => outputType).”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/Config_test.res` around lines 229 - 270, Update every Utils.magic cast in the affected tests to use explicit input and output type annotations in the cast expression, following the inputType => outputType form. For each testParams assignment, annotate the concrete object, tuple, or unit input type and Internal.eventParams as the output, including the casts in the existing event parameter tests.Source: Coding guidelines
packages/envio/test/lib_tests/ChainState_materialize_test.res (1)
3-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove comments that describe code structure or refactor history.
packages/envio/test/lib_tests/ChainState_materialize_test.res#L3-L7: remove the helper-purpose/caller narration, or retain only a subtle invariant required by the unsafe representation.packages/envio/test/lib_tests/ChainState_materialize_test.res#L111-L113: remove the migration and former-caller history.packages/envio/test/lib_tests/ChainState_materialize_test.res#L188-L190: remove the migration and replacement history.packages/envio/test/lib_tests/EffectCache_test.res#L3-L4: remove the module-purpose summary already conveyed by thedescribename.As per coding guidelines, “Don't write a comment that restates what the code already says” and “Never narrate the refactor itself.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/lib_tests/ChainState_materialize_test.res` around lines 3 - 7, Remove the structural and refactor-history comments at packages/envio/test/lib_tests/ChainState_materialize_test.res lines 3-7, 111-113, and 188-190, retaining only an essential unsafe-representation invariant if needed; remove the module-purpose summary at packages/envio/test/lib_tests/EffectCache_test.res lines 3-4 because the describe name already conveys it.Source: Coding guidelines
packages/envio/test/Encoders_schema_test.res (1)
22-24: 🎯 Functional Correctness | 🔵 TrivialResolve the nullable encoding contract before locking it into the test.
The test says
Noneencodes asnull, but expects{}. Decide whether the wire format is{"optNumber":null}or omission, then align the title and expectation and remove the TODO. Would you like me to prepare either version?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/Encoders_schema_test.res` around lines 22 - 24, Resolve the nullable encoding contract in the “encodes None as null” test and make the assertion match the intended wire format: either include optNumber as null or omit the field entirely. Update the test title to describe that behavior, adjust the expected mock3raw value accordingly, and remove the TODO comment.packages/envio/test/lib_tests/Rpc_Test.res (1)
4-5: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the commented-out alternative endpoint.
This stale assignment does not document a constraint; endpoint alternatives belong in configuration or commit history.
- // let rpcUrl = "https://eth.rpc.hypersync.xyz" let rpcUrl = "https://eth.llamarpc.com"As per coding guidelines, comments must not narrate prior alternatives or pointers to where values were defined.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/lib_tests/Rpc_Test.res` around lines 4 - 5, Remove the commented-out alternative endpoint directly above the active rpcUrl assignment in Rpc_Test; keep the active endpoint assignment unchanged and do not replace the removed comment with another explanatory comment.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/envio/test/AddressLowercase_test.res`:
- Around line 14-17: Update the test “fromAddressLowercaseOrThrow returns
lowercase” to construct the address with a genuinely mixed-case hexadecimal
string, while keeping the expected output fully lowercase. This ensures
Address.Evm.fromAddressLowercaseOrThrow is verified to normalize casing rather
than merely return an already-lowercase input.
In `@packages/envio/test/Config_test.res`:
- Around line 151-176: Update the tests for evmBlockFieldSchema and
evmTransactionFieldSchema to collect the mapped values from each parsed field
and compare the resulting arrays directly with [1, 2, …, 27] and [1, 2, …, 32].
Replace the triangular-sum-only assertions while preserving the existing
iteration and parsing logic.
In `@packages/envio/test/HyperSync_test.res`:
- Line 46: Replace the Console.log call in the HyperSync test with a single
whole-value regression assertion that verifies the expected response shape or
normalized query result. Keep the assertion focused on the successful query
outcome and remove the logging entirely.
In `@packages/envio/test/HyperSyncClient_test.res`:
- Around line 3-6: Isolate live-test credential loading in both test modules: in
packages/envio/test/HyperSyncClient_test.res lines 3-6, gate the live suites
behind an explicit opt-in command or flag and resolve ENVIO_API_TOKEN only
inside that path; in packages/envio/test/HyperSync_test.res lines 3-6, move
token resolution into the skipped async test body so module import remains
credential-free.
In `@packages/envio/test/lib_tests/ChainState_materialize_test.res`:
- Around line 93-107: Update the materializePageItems no-op test to construct
`a` with existing inline transaction and block payloads, while keeping both
stores as `None`. Capture those payload identities before the call and assert
afterward that `rawTx(a)` and `rawBlock(a)` still contain the same values,
proving the no-op path preserves inline data.
In `@packages/envio/test/lib_tests/ColumnNameFormat_test.res`:
- Around line 245-291: Update the test block after creating the Postgres client
and storage in the Async.it callback to register guaranteed cleanup for both
resources. Ensure the schema is dropped and storage.close() executes when setup,
writes, reads, or assertions reject, and preserve cleanup ordering so
storage.close() still runs if the DROP SCHEMA operation fails.
In `@packages/envio/test/lib_tests/PackageJson_test.res`:
- Around line 5-6: In the package metadata test, remove the redundant untyped
Utils.EnvioPackage.value->Utils.magic truthiness assertion and retain the
version assertion as the single check. If Utils.magic is still required for the
version access, replace it with an explicitly typed cast rather than an untyped
assertion.
In `@packages/envio/test/RateLimit_test.res`:
- Around line 93-105: Strengthen the elapsed-time assertion in the parallel
getBlockHashes test to require both rate-limit windows, using an approximately
1000ms lower bound rather than 400ms. Keep the existing upper-bound tolerance
relative to elapsed and the deduplicated wall-clock behavior intact.
---
Nitpick comments:
In `@packages/envio/test/Config_test.res`:
- Around line 229-270: Update every Utils.magic cast in the affected tests to
use explicit input and output type annotations in the cast expression, following
the inputType => outputType form. For each testParams assignment, annotate the
concrete object, tuple, or unit input type and Internal.eventParams as the
output, including the casts in the existing event parameter tests.
In `@packages/envio/test/ConfigYaml_test.res`:
- Around line 33-64: Update the affected tests, including the case around
MockIndexerConfig.parseYaml and the ranges noted in the review, to gather all
relevant config, chain, source, contract, and event fields into one tuple or
record and verify them with a single toEqual assertion. Remove the individual
field-level expect calls while preserving the existing expected values and test
coverage.
In `@packages/envio/test/Encoders_schema_test.res`:
- Around line 22-24: Resolve the nullable encoding contract in the “encodes None
as null” test and make the assertion match the intended wire format: either
include optNumber as null or omit the field entirely. Update the test title to
describe that behavior, adjust the expected mock3raw value accordingly, and
remove the TODO comment.
In `@packages/envio/test/lib_tests/ChainState_materialize_test.res`:
- Around line 3-7: Remove the structural and refactor-history comments at
packages/envio/test/lib_tests/ChainState_materialize_test.res lines 3-7,
111-113, and 188-190, retaining only an essential unsafe-representation
invariant if needed; remove the module-purpose summary at
packages/envio/test/lib_tests/EffectCache_test.res lines 3-4 because the
describe name already conveys it.
In `@packages/envio/test/lib_tests/Rpc_Test.res`:
- Around line 4-5: Remove the commented-out alternative endpoint directly above
the active rpcUrl assignment in Rpc_Test; keep the active endpoint assignment
unchanged and do not replace the removed comment with another explanatory
comment.
In `@packages/envio/test/OnBlockSchema_test.res`:
- Around line 3-13: Trim comments at packages/envio/test/OnBlockSchema_test.res
lines 3-13, 61-62, and 78-83, packages/envio/test/ClientAddressFilter_test.res
lines 3-5 and 27-29, and packages/envio/test/helpers/MockIndexerConfig.res line
6: retain only the concise two-stage validation invariant in OnBlockSchema_test
and the Some(undefined) rejection behavior, while removing purpose summaries,
caller/handler references, extractRange pointers, and historical narration.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 23429f6c-fe35-42f0-bec5-854280136099
📒 Files selected for processing (37)
.github/workflows/build_and_verify.ymlpackage.jsonpackages/build-envio/src/build-artifact.tspackages/envio/package.jsonpackages/envio/rescript.jsonpackages/envio/test/AddressLowercase_test.respackages/envio/test/BlockStore_test.respackages/envio/test/ClientAddressFilter_test.respackages/envio/test/ConfigYaml_test.respackages/envio/test/Config_test.respackages/envio/test/Encoders_schema_test.respackages/envio/test/EntityFilter_test.respackages/envio/test/EventRouter_svm_test.respackages/envio/test/HyperSyncClient_test.respackages/envio/test/HyperSync_test.respackages/envio/test/OnBlockSchema_test.respackages/envio/test/RateLimit_test.respackages/envio/test/ReorgDetection_test.respackages/envio/test/SvmHyperSyncClient_test.respackages/envio/test/SvmHyperSyncSource_test.respackages/envio/test/TransactionStore_test.respackages/envio/test/Utils_test.respackages/envio/test/helpers/MockIndexerConfig.respackages/envio/test/lib_tests/ChainState_materialize_test.respackages/envio/test/lib_tests/ColumnNameFormat_test.respackages/envio/test/lib_tests/ConfigEnvioInfo_test.respackages/envio/test/lib_tests/EffectCache_test.respackages/envio/test/lib_tests/Metrics_test.respackages/envio/test/lib_tests/PackageJson_test.respackages/envio/test/lib_tests/Rpc_Test.respackages/envio/test/lib_tests/Throttler_test.respackages/envio/test/setup.tspackages/envio/vitest.config.tsscenarios/test_codegen/test/IndexerState_test.resscenarios/test_codegen/test/YamlConfigIndexer_test.resscenarios/test_codegen/test/helpers/MockIndexer.resscenarios/test_codegen/test/lib_tests/IndexerLoop_test.res
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 8
🧹 Nitpick comments (6)
packages/envio/test/ConfigYaml_test.res (1)
33-64: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCollapse each test to one whole-value assertion.
Build a tuple or record containing the relevant config, chain, source, contract, and event values, then compare it with one
toEqualcall.As per coding guidelines, “Always use single assert to check the whole value instead of multiple asserts for every field.”
Also applies to: 66-98, 807-831, 881-895
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/ConfigYaml_test.res` around lines 33 - 64, Update the affected tests, including the case around MockIndexerConfig.parseYaml and the ranges noted in the review, to gather all relevant config, chain, source, contract, and event fields into one tuple or record and verify them with a single toEqual assertion. Remove the individual field-level expect calls while preserving the existing expected values and test coverage.Source: Coding guidelines
packages/envio/test/OnBlockSchema_test.res (1)
3-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove comments that narrate test purpose, callers, or refactor history. Retain only concise explanations of non-obvious invariants or surprising behavior.
packages/envio/test/OnBlockSchema_test.res#L3-L13: retain only the subtle two-stage validation invariant.packages/envio/test/OnBlockSchema_test.res#L61-L62: remove theextractRangeimplementation pointer.packages/envio/test/OnBlockSchema_test.res#L78-L83: keep theSome(undefined)rejection behavior, but remove old-behavior history.packages/envio/test/ClientAddressFilter_test.res#L3-L5: remove the module-purpose summary.packages/envio/test/ClientAddressFilter_test.res#L27-L29: remove the handler-reference narration.packages/envio/test/helpers/MockIndexerConfig.res#L6-L6: remove the function-purpose summary.As per coding guidelines, comments should explain only non-obvious constraints, subtle invariants, specific workarounds, or surprising behavior.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/OnBlockSchema_test.res` around lines 3 - 13, Trim comments at packages/envio/test/OnBlockSchema_test.res lines 3-13, 61-62, and 78-83, packages/envio/test/ClientAddressFilter_test.res lines 3-5 and 27-29, and packages/envio/test/helpers/MockIndexerConfig.res line 6: retain only the concise two-stage validation invariant in OnBlockSchema_test and the Some(undefined) rejection behavior, while removing purpose summaries, caller/handler references, extractRange pointers, and historical narration.Source: Coding guidelines
packages/envio/test/Config_test.res (1)
229-270: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd explicit types to every
Utils.magiccast.Annotate each cast itself with its concrete input type and
Internal.eventParamsoutput type rather than relying on the destination variable annotation.As per coding guidelines, “When using
Utils.magicfor type casting in ReScript, always add explicit type annotations:value->(Utils.magic: inputType => outputType).”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/Config_test.res` around lines 229 - 270, Update every Utils.magic cast in the affected tests to use explicit input and output type annotations in the cast expression, following the inputType => outputType form. For each testParams assignment, annotate the concrete object, tuple, or unit input type and Internal.eventParams as the output, including the casts in the existing event parameter tests.Source: Coding guidelines
packages/envio/test/lib_tests/ChainState_materialize_test.res (1)
3-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove comments that describe code structure or refactor history.
packages/envio/test/lib_tests/ChainState_materialize_test.res#L3-L7: remove the helper-purpose/caller narration, or retain only a subtle invariant required by the unsafe representation.packages/envio/test/lib_tests/ChainState_materialize_test.res#L111-L113: remove the migration and former-caller history.packages/envio/test/lib_tests/ChainState_materialize_test.res#L188-L190: remove the migration and replacement history.packages/envio/test/lib_tests/EffectCache_test.res#L3-L4: remove the module-purpose summary already conveyed by thedescribename.As per coding guidelines, “Don't write a comment that restates what the code already says” and “Never narrate the refactor itself.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/lib_tests/ChainState_materialize_test.res` around lines 3 - 7, Remove the structural and refactor-history comments at packages/envio/test/lib_tests/ChainState_materialize_test.res lines 3-7, 111-113, and 188-190, retaining only an essential unsafe-representation invariant if needed; remove the module-purpose summary at packages/envio/test/lib_tests/EffectCache_test.res lines 3-4 because the describe name already conveys it.Source: Coding guidelines
packages/envio/test/Encoders_schema_test.res (1)
22-24: 🎯 Functional Correctness | 🔵 TrivialResolve the nullable encoding contract before locking it into the test.
The test says
Noneencodes asnull, but expects{}. Decide whether the wire format is{"optNumber":null}or omission, then align the title and expectation and remove the TODO. Would you like me to prepare either version?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/Encoders_schema_test.res` around lines 22 - 24, Resolve the nullable encoding contract in the “encodes None as null” test and make the assertion match the intended wire format: either include optNumber as null or omit the field entirely. Update the test title to describe that behavior, adjust the expected mock3raw value accordingly, and remove the TODO comment.packages/envio/test/lib_tests/Rpc_Test.res (1)
4-5: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the commented-out alternative endpoint.
This stale assignment does not document a constraint; endpoint alternatives belong in configuration or commit history.
- // let rpcUrl = "https://eth.rpc.hypersync.xyz" let rpcUrl = "https://eth.llamarpc.com"As per coding guidelines, comments must not narrate prior alternatives or pointers to where values were defined.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/lib_tests/Rpc_Test.res` around lines 4 - 5, Remove the commented-out alternative endpoint directly above the active rpcUrl assignment in Rpc_Test; keep the active endpoint assignment unchanged and do not replace the removed comment with another explanatory comment.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/envio/test/AddressLowercase_test.res`:
- Around line 14-17: Update the test “fromAddressLowercaseOrThrow returns
lowercase” to construct the address with a genuinely mixed-case hexadecimal
string, while keeping the expected output fully lowercase. This ensures
Address.Evm.fromAddressLowercaseOrThrow is verified to normalize casing rather
than merely return an already-lowercase input.
In `@packages/envio/test/Config_test.res`:
- Around line 151-176: Update the tests for evmBlockFieldSchema and
evmTransactionFieldSchema to collect the mapped values from each parsed field
and compare the resulting arrays directly with [1, 2, …, 27] and [1, 2, …, 32].
Replace the triangular-sum-only assertions while preserving the existing
iteration and parsing logic.
In `@packages/envio/test/HyperSync_test.res`:
- Line 46: Replace the Console.log call in the HyperSync test with a single
whole-value regression assertion that verifies the expected response shape or
normalized query result. Keep the assertion focused on the successful query
outcome and remove the logging entirely.
In `@packages/envio/test/HyperSyncClient_test.res`:
- Around line 3-6: Isolate live-test credential loading in both test modules: in
packages/envio/test/HyperSyncClient_test.res lines 3-6, gate the live suites
behind an explicit opt-in command or flag and resolve ENVIO_API_TOKEN only
inside that path; in packages/envio/test/HyperSync_test.res lines 3-6, move
token resolution into the skipped async test body so module import remains
credential-free.
In `@packages/envio/test/lib_tests/ChainState_materialize_test.res`:
- Around line 93-107: Update the materializePageItems no-op test to construct
`a` with existing inline transaction and block payloads, while keeping both
stores as `None`. Capture those payload identities before the call and assert
afterward that `rawTx(a)` and `rawBlock(a)` still contain the same values,
proving the no-op path preserves inline data.
In `@packages/envio/test/lib_tests/ColumnNameFormat_test.res`:
- Around line 245-291: Update the test block after creating the Postgres client
and storage in the Async.it callback to register guaranteed cleanup for both
resources. Ensure the schema is dropped and storage.close() executes when setup,
writes, reads, or assertions reject, and preserve cleanup ordering so
storage.close() still runs if the DROP SCHEMA operation fails.
In `@packages/envio/test/lib_tests/PackageJson_test.res`:
- Around line 5-6: In the package metadata test, remove the redundant untyped
Utils.EnvioPackage.value->Utils.magic truthiness assertion and retain the
version assertion as the single check. If Utils.magic is still required for the
version access, replace it with an explicitly typed cast rather than an untyped
assertion.
In `@packages/envio/test/RateLimit_test.res`:
- Around line 93-105: Strengthen the elapsed-time assertion in the parallel
getBlockHashes test to require both rate-limit windows, using an approximately
1000ms lower bound rather than 400ms. Keep the existing upper-bound tolerance
relative to elapsed and the deduplicated wall-clock behavior intact.
---
Nitpick comments:
In `@packages/envio/test/Config_test.res`:
- Around line 229-270: Update every Utils.magic cast in the affected tests to
use explicit input and output type annotations in the cast expression, following
the inputType => outputType form. For each testParams assignment, annotate the
concrete object, tuple, or unit input type and Internal.eventParams as the
output, including the casts in the existing event parameter tests.
In `@packages/envio/test/ConfigYaml_test.res`:
- Around line 33-64: Update the affected tests, including the case around
MockIndexerConfig.parseYaml and the ranges noted in the review, to gather all
relevant config, chain, source, contract, and event fields into one tuple or
record and verify them with a single toEqual assertion. Remove the individual
field-level expect calls while preserving the existing expected values and test
coverage.
In `@packages/envio/test/Encoders_schema_test.res`:
- Around line 22-24: Resolve the nullable encoding contract in the “encodes None
as null” test and make the assertion match the intended wire format: either
include optNumber as null or omit the field entirely. Update the test title to
describe that behavior, adjust the expected mock3raw value accordingly, and
remove the TODO comment.
In `@packages/envio/test/lib_tests/ChainState_materialize_test.res`:
- Around line 3-7: Remove the structural and refactor-history comments at
packages/envio/test/lib_tests/ChainState_materialize_test.res lines 3-7,
111-113, and 188-190, retaining only an essential unsafe-representation
invariant if needed; remove the module-purpose summary at
packages/envio/test/lib_tests/EffectCache_test.res lines 3-4 because the
describe name already conveys it.
In `@packages/envio/test/lib_tests/Rpc_Test.res`:
- Around line 4-5: Remove the commented-out alternative endpoint directly above
the active rpcUrl assignment in Rpc_Test; keep the active endpoint assignment
unchanged and do not replace the removed comment with another explanatory
comment.
In `@packages/envio/test/OnBlockSchema_test.res`:
- Around line 3-13: Trim comments at packages/envio/test/OnBlockSchema_test.res
lines 3-13, 61-62, and 78-83, packages/envio/test/ClientAddressFilter_test.res
lines 3-5 and 27-29, and packages/envio/test/helpers/MockIndexerConfig.res line
6: retain only the concise two-stage validation invariant in OnBlockSchema_test
and the Some(undefined) rejection behavior, while removing purpose summaries,
caller/handler references, extractRange pointers, and historical narration.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 23429f6c-fe35-42f0-bec5-854280136099
📒 Files selected for processing (37)
.github/workflows/build_and_verify.ymlpackage.jsonpackages/build-envio/src/build-artifact.tspackages/envio/package.jsonpackages/envio/rescript.jsonpackages/envio/test/AddressLowercase_test.respackages/envio/test/BlockStore_test.respackages/envio/test/ClientAddressFilter_test.respackages/envio/test/ConfigYaml_test.respackages/envio/test/Config_test.respackages/envio/test/Encoders_schema_test.respackages/envio/test/EntityFilter_test.respackages/envio/test/EventRouter_svm_test.respackages/envio/test/HyperSyncClient_test.respackages/envio/test/HyperSync_test.respackages/envio/test/OnBlockSchema_test.respackages/envio/test/RateLimit_test.respackages/envio/test/ReorgDetection_test.respackages/envio/test/SvmHyperSyncClient_test.respackages/envio/test/SvmHyperSyncSource_test.respackages/envio/test/TransactionStore_test.respackages/envio/test/Utils_test.respackages/envio/test/helpers/MockIndexerConfig.respackages/envio/test/lib_tests/ChainState_materialize_test.respackages/envio/test/lib_tests/ColumnNameFormat_test.respackages/envio/test/lib_tests/ConfigEnvioInfo_test.respackages/envio/test/lib_tests/EffectCache_test.respackages/envio/test/lib_tests/Metrics_test.respackages/envio/test/lib_tests/PackageJson_test.respackages/envio/test/lib_tests/Rpc_Test.respackages/envio/test/lib_tests/Throttler_test.respackages/envio/test/setup.tspackages/envio/vitest.config.tsscenarios/test_codegen/test/IndexerState_test.resscenarios/test_codegen/test/YamlConfigIndexer_test.resscenarios/test_codegen/test/helpers/MockIndexer.resscenarios/test_codegen/test/lib_tests/IndexerLoop_test.res
🛑 Comments failed to post (8)
packages/envio/test/AddressLowercase_test.res (1)
14-17: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use a genuinely mixed-case address.
The lowercase input does not verify normalization and would pass if the function returned its input unchanged.
Proposed fix
- let mixed = Address.Evm.fromStringOrThrow("0x2c169dfe5fbba12957bdd0ba47d9cedbfe260ca7") + let mixed = Address.Evm.fromStringOrThrow("0x2C169DFe5fBbA12957Bdd0Ba47d9CEDbFE260CA7")📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.it("fromAddressLowercaseOrThrow returns lowercase", t => { let mixed = Address.Evm.fromStringOrThrow("0x2C169DFe5fBbA12957Bdd0Ba47d9CEDbFE260CA7") let out = mixed->Address.Evm.fromAddressLowercaseOrThrow->Address.toString t.expect(out).toBe("0x2c169dfe5fbba12957bdd0ba47d9cedbfe260ca7")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/AddressLowercase_test.res` around lines 14 - 17, Update the test “fromAddressLowercaseOrThrow returns lowercase” to construct the address with a genuinely mixed-case hexadecimal string, while keeping the expected output fully lowercase. This ensures Address.Evm.fromAddressLowercaseOrThrow is verified to normalize casing rather than merely return an already-lowercase input.packages/envio/test/Config_test.res (1)
151-176: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert the complete mapped variant arrays, not only their sums.
A duplicate/omission combination can preserve the triangular sum. Compare the mapped values with
[1, 2, …, 27]and[1, 2, …, 32]so every variant is proven present exactly once.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/Config_test.res` around lines 151 - 176, Update the tests for evmBlockFieldSchema and evmTransactionFieldSchema to collect the mapped values from each parsed field and compare the resulting arrays directly with [1, 2, …, 27] and [1, 2, …, 32]. Replace the triangular-sum-only assertions while preserving the existing iteration and parsing logic.packages/envio/test/HyperSync_test.res (1)
46-46: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Replace the log with a regression assertion.
This test currently verifies nothing once the query succeeds. Assert the expected response shape or normalized result using one whole-value assertion.
As per coding guidelines, tests must never log and must use assertions for verification.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/HyperSync_test.res` at line 46, Replace the Console.log call in the HyperSync test with a single whole-value regression assertion that verifies the expected response shape or normalized query result. Keep the assertion focused on the successful query outcome and remove the logging entirely.Source: Coding guidelines
packages/envio/test/HyperSyncClient_test.res (1)
3-6: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Isolate live-test credentials from default test discovery.
Both modules resolve
ENVIO_API_TOKENat import time, making ordinary package tests dependent on live-test credentials before suite-level skipping or gating can apply.
packages/envio/test/HyperSyncClient_test.res#L3-L6: place the live suites behind an explicit opt-in command/flag and resolve the token only inside that path.packages/envio/test/HyperSync_test.res#L3-L6: move token resolution into the skipped async test body so importing the module remains credential-free.📍 Affects 2 files
packages/envio/test/HyperSyncClient_test.res#L3-L6(this comment)packages/envio/test/HyperSync_test.res#L3-L6🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/HyperSyncClient_test.res` around lines 3 - 6, Isolate live-test credential loading in both test modules: in packages/envio/test/HyperSyncClient_test.res lines 3-6, gate the live suites behind an explicit opt-in command or flag and resolve ENVIO_API_TOKEN only inside that path; in packages/envio/test/HyperSync_test.res lines 3-6, move token resolution into the skipped async test body so module import remains credential-free.packages/envio/test/lib_tests/ChainState_materialize_test.res (1)
93-107: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Exercise the no-op path with existing inline payloads.
acontains neither payload, so this only proves absent data stays absent. Provide inline transaction and block values and assert their identities remain unchanged.Proposed test adjustment
- let a = makeItem(~blockNumber=1, ~transactionIndex=1, ~transactionMask=2., ~blockMask=2.) + let inlineTx = {"hash": "0xinline"}->(Utils.magic: {..} => Internal.eventTransaction) + let inlineBlock = {"number": 1}->(Utils.magic: {..} => Internal.eventBlock) + let a = makeItem( + ~blockNumber=1, + ~transactionIndex=1, + ~inlineTransaction=inlineTx, + ~inlineBlock, + ) ... - "tx": rawTx(a)->Nullable.toOption, - "block": rawBlock(a)->Nullable.toOption, + "txUntouched": rawTx(a) === inlineTx->Nullable.make, + "blockUntouched": rawBlock(a) === inlineBlock->Nullable.make, ... - "tx": None, - "block": None, + "txUntouched": true, + "blockUntouched": true,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.Async.it("materializePageItems is a no-op for None pages (RPC/Fuel/Simulate)", async t => { let inlineTx = {"hash": "0xinline"}->(Utils.magic: {..} => Internal.eventTransaction) let inlineBlock = {"number": 1}->(Utils.magic: {..} => Internal.eventBlock) let a = makeItem( ~blockNumber=1, ~transactionIndex=1, ~inlineTransaction=inlineTx, ~inlineBlock, ) await ChainState.materializePageItems( ~items=[a], ~transactionStore=None, ~blockStore=None, ~ecosystem=Ecosystem.Fuel, ) t.expect({ "txUntouched": rawTx(a) === inlineTx->Nullable.make, "blockUntouched": rawBlock(a) === inlineBlock->Nullable.make, }).toEqual({ "txUntouched": true, "blockUntouched": true, })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/lib_tests/ChainState_materialize_test.res` around lines 93 - 107, Update the materializePageItems no-op test to construct `a` with existing inline transaction and block payloads, while keeping both stores as `None`. Capture those payload identities before the call and assert afterward that `rawTx(a)` and `rawBlock(a)` still contain the same values, proving the no-op path preserves inline data.packages/envio/test/lib_tests/ColumnNameFormat_test.res (1)
245-291: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Guarantee database cleanup when setup or assertions fail.
Any rejected operation before Lines 290-291 leaves the connection open and schema behind, potentially contaminating later tests. Establish a guaranteed cleanup path immediately after resource creation, and ensure
storage.close()still runs if dropping the schema fails.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/lib_tests/ColumnNameFormat_test.res` around lines 245 - 291, Update the test block after creating the Postgres client and storage in the Async.it callback to register guaranteed cleanup for both resources. Ensure the schema is dropped and storage.close() executes when setup, writes, reads, or assertions reject, and preserve cleanup ordering so storage.close() still runs if the DROP SCHEMA operation fails.packages/envio/test/lib_tests/PackageJson_test.res (1)
5-6: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Remove the redundant untyped
Utils.magicassertion.
value.versionalready covers the needed check here; keep a single assertion and, if the cast remains necessary, use an explicitly typedUtils.magiccast.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/lib_tests/PackageJson_test.res` around lines 5 - 6, In the package metadata test, remove the redundant untyped Utils.EnvioPackage.value->Utils.magic truthiness assertion and retain the version assertion as the single check. If Utils.magic is still required for the version access, replace it with an explicitly typed cast rather than an untyped assertion.packages/envio/test/RateLimit_test.res (1)
93-105: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert that both rate-limit windows are accounted for.
The current
> 400msbound still passes if one expected 500ms window is omitted, so it does not verify the documented approximately 1000ms deduplicated total.- t.expect(rateLimitTime > 400.0 && rateLimitTime < elapsed +. 100.0).toEqual(true) + t.expect(rateLimitTime > 900.0 && rateLimitTime < elapsed +. 100.0).toEqual(true)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.// Two parallel calls — each hits 2 rate limits at ~500ms each. // Sequential accounting would yield ~4 * 500ms = 2000ms; the dedup'd // wall-clock total should be roughly half that (~1000ms). let start = Date.now() let _ = await [ sourceManager->SourceManager.getBlockHashes(~blockNumbers=[1], ~isRealtime=false), sourceManager->SourceManager.getBlockHashes(~blockNumbers=[2], ~isRealtime=false), ]->Promise.all let elapsed = Date.now() -. start let rateLimitTime = sourceManager->SourceManager.getRateLimitTimeMs t.expect(rateLimitTime > 900.0 && rateLimitTime < elapsed +. 100.0).toEqual(true)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/test/RateLimit_test.res` around lines 93 - 105, Strengthen the elapsed-time assertion in the parallel getBlockHashes test to require both rate-limit windows, using an approximately 1000ms lower bound rather than 400ms. Keep the existing upper-bound tolerance relative to elapsed and the deduplicated wall-clock behavior intact.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/envio/vitest.config.ts (1)
13-13: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRemove
passWithNoTestsfrom the CI test path
vitest runwill succeed with zero matched tests, so a badincludeglob or missing generated.res.mjsfiles can make this package’s test job go green without executing anything. Drop this option, or gate it off outside CI.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/envio/vitest.config.ts` at line 13, Remove the passWithNoTests option from the Vitest configuration so the CI vitest run fails when no tests are matched, preserving test-path validation for the package.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/envio/vitest.config.ts`:
- Line 13: Remove the passWithNoTests option from the Vitest configuration so
the CI vitest run fails when no tests are matched, preserving test-path
validation for the package.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: df322730-e42f-4f55-9ef5-d28984a768ea
📒 Files selected for processing (1)
packages/envio/vitest.config.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9812a779fc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | None => Config.load() | ||
| } | ||
| let indexerState = IndexerState.make( | ||
| ~config, |
There was a problem hiding this comment.
Build persistence from the supplied config
When callers use the newly added ~config with MockIndexer.InMemoryStore.make, this still passes a persistence object cached from Config.load(). IndexerState.make derives its entity tables from persistence.allEntities, so a custom YAML-only entity is absent and setEntity (or any lookup of that entity) raises UndefinedEntity; construct the persistence with this local config rather than defaultPersistence().
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29200ef9fc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| HandlerRegister.startRegistration(~config) | ||
| HandlerRegister.finishRegistration(~config) |
There was a problem hiding this comment.
Clear cached handlers for custom configs
When a custom YAML config reuses a contract/event name that was already registered earlier in the same Vitest worker (for example after a default MockIndexer run loaded generated handlers), this path still lets HandlerRegister.finishRegistration reuse the process-wide handler cache via hasRegistration. That attaches stale generated handlers/registrations to the supplied config even though this branch intentionally avoids handler files, so mock-source fetch partitions and dispatch can be driven by the wrong project; clear or ignore the cached registry for the custom-config path before finishing registration.
Useful? React with 👍 / 👎.
| Async.it( | ||
| "runs the indexer loop with a config parsed from user YAML instead of the generated one", | ||
| async t => { | ||
| let parsed = MockIndexerConfig.parseYaml( |
There was a problem hiding this comment.
Keep the YAML parser helper with the scenario tests
In CI I checked the artifact install path: .pnpmfile.cjs redirects scenarios/test_codegen's envio dependency to the built artifact, and this commit strips test from that artifact's rescript.json/doesn't ship packages/envio/test. In that environment this new scenario test resolves MockIndexerConfig only from envio's test sources after the scenario-local helper was deleted, so pnpm test in scenarios/test_codegen fails to compile with an unbound module; keep a scenario-local helper or move it into shipped source.
Useful? React with 👍 / 👎.
| ~contractName=switch chainConfig.contracts->Array.get(0) { | ||
| | Some(contract) => contract.name |
There was a problem hiding this comment.
Preserve the selected contract start block
When the supplied YAML config gives this first contract its own start_block, the only registration created for the custom-config mock source still has startBlock: None, so FetchState derives the contract partition from the chain start block and the mock source queries blocks before that contract should be active. Pass the selected contract's startBlock into makeMockSourceRegistration (and onto the registration) so custom-config tests with per-contract start blocks don't process out-of-range events.
Useful? React with 👍 / 👎.
YamlConfigIndexer_test referenced MockIndexerConfig, which now lives only in envio's test dir and is excluded from the published npm artifact that scenarios build against in CI. Inline the parse via the public Core.parseConfigYaml + Config.fromPublic instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh
…cating test_codegen's acceptance test needs the YAML parse helper that lives in the envio package. It compiled locally (workspace symlink exposes envio's lib/ocaml) but broke in CI, where scenarios build against the published artifact that excludes the test dir. Move MockIndexerConfig into a new packages/envio/testing dir: vitest-free ReScript helpers that ship in the artifact and stay in the published rescript.json sources, so dependent suites compile against them in CI. The test dir (vitest suites) stays stripped. The helper is not part of the user-facing JS API (index.js), keeping it internal. Kept the module name to avoid colliding with test_codegen's own MockConfig. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89f4be462e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "src", | ||
| // Internal ReScript test helpers (vitest-free) that dependent test suites | ||
| // compile against. Not part of the user-facing JS API (index.js). | ||
| "testing", |
There was a problem hiding this comment.
Add testing to artifact allow-lists
When the build-envio-package workflow runs, node packages/build-envio/src/build-artifact.ts ... --out envio-dist now copies this top-level testing dir, and the very next step invokes verify-artifact.ts envio-dist; that verifier's REQUIRED_FILES allow-list still omits testing, so CI fails with Unexpected file in artifact: testing. Fresh evidence beyond the earlier helper comment: npm pack --dry-run on the built artifact also produced zero testing/ files because the generated package.json inherits a files allow-list that omits it, so relaxing the verifier alone still leaves artifact consumers unable to compile MockIndexerConfig.
Useful? React with 👍 / 👎.
| ~contractName=switch chainConfig.contracts->Array.get(0) { | ||
| | Some(contract) => contract.name | ||
| | None => "MockContract" |
There was a problem hiding this comment.
Choose an addressed contract for mock registration
When a supplied YAML chain lists an address-less/dynamic contract first and an addressed contract later, this binds the synthetic mock event to the address-less contract. FetchState.make only creates address-dependent partitions from configured addresses whose contract name appears in the registrations, so the mock source gets no partition for that chain and the indexer either throws Invalid configuration: Nothing to fetch or never queries the custom source; select a contract with configured addresses (or make the synthetic registration wildcard) instead of always using element 0.
Useful? React with 👍 / 👎.
Replace the test/testing split inside the envio package with a separate private workspace package, envio-tests, that depends on envio. It holds all the (non-generated-code) test suites and the MockIndexerConfig helper. - envio ships pure runtime: no test/testing dirs, no vitest devDep. build-artifact.ts drops stripTestSources and the testing PUBLISH entry. - envio-tests runs its vitest suite against the envio artifact in CI (via the pnpmfile redirect), so it loads the NAPI addon through the artifact's platform dependency like scenarios do — no NODE_PATH hack. - test_codegen depends on envio-tests to reuse MockIndexerConfig in its YAML-driven acceptance test, instead of duplicating the parse helper. - CI 'envio package tests' step becomes 'envio-tests'; root test script and workspace wiring updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh
…kindexer-unify-xmdo4l
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh
Main replaced the prom-client-based metrics with a custom Metrics module, so nothing imports prom-client at runtime anymore. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh
Summary
Enable MockIndexer to accept custom configs parsed from user YAML instead of always using the generated project config. Add test infrastructure to the envio package and introduce a test demonstrating YAML-driven indexer configuration.
Key Changes
defaultPersistencefrom eager to lazy evaluation via a ref, preventing database connections for tests that don't use it~configparameter toMockIndexer.Indexer.makeandInMemoryStore.make, with fallback to generated configHandlerRegisterinline registration instead ofHandlerLoader.registerAllHandlers(which requires handler files on disk)~contractNametomakeMockSourceRegistration, using the first contract from chain config or defaulting to "MockContract"entityConfigByNamefunction to reduce duplication in entity config lookupsvitest.config.tsto envio package with sequential test execution and proper module externalizationtest/setup.tsto initialize logging for all testsYamlConfigIndexer_test.resdemonstrating YAML config parsing and indexer executionrescript.jsonto include test directorypnpm testscript to package.jsonrescript.jsonvia newstripTestSourcesfunctionImplementation Details
The custom config flow allows tests to:
MockIndexerConfig.parseYamlMockIndexer.Indexer.makeMock source registrations now use actual contract names from the config, keeping synthetic registrations in the correct address-dependent fetch partition alongside real contracts.
https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh
Summary by CodeRabbit
New Features
Tests