Skip to content

MockIndexer: fix dropped-item default and thread envioInfo - #1459

Closed
DZakh wants to merge 1 commit into
mainfrom
claude/configyaml-mockindexer-unify-xmdo4l
Closed

MockIndexer: fix dropped-item default and thread envioInfo#1459
DZakh wants to merge 1 commit into
mainfrom
claude/configyaml-mockindexer-unify-xmdo4l

Conversation

@DZakh

@DZakh DZakh commented Jul 21, 2026

Copy link
Copy Markdown
Member

Small follow-up to #1445 — DX/correctness fixes in the MockIndexer test harness.

Changes

1. resolveGetItemsOrThrow no longer silently drops items above the fetched range

When a caller resolved items without an explicit ~latestFetchedBlockNumber, the mock defaulted it to toBlock ?? fromBlock. If an item's blockNumber sat above that (e.g. the first query where toBlock is unset ⇒ defaults to fromBlock), the indexer — which only processes up to latestFetchedBlockNumber — would silently drop it. The default now floors at the highest item block, so the item is processed. The YAML acceptance test drops the ~latestFetchedBlockNumber=300 workaround it previously needed, which demonstrates the fix.

2. MockIndexer.make accepts ~envioInfo

Previously Persistence.init was always passed {} as envio_info. make now takes ~envioInfo (defaulting to {}, so existing callers are unchanged) and preserves it across restart, so custom-config restart/compat-diff scenarios can validate against the real stripped public config JSON. The acceptance test now passes publicConfigJson->Config.stripSensitiveData.

3. Restore vitest to envio's devDependencies (bug fix)

envio's src/bindings/Vitest.res.mjs imports "vitest". #1445 removed vitest from envio's devDependencies; this resolves fine in CI (scenarios build against the published artifact and provide vitest) but breaks local workspace runs, where node_modules/envio symlinks to the package whose node_modules no longer has vitest — so any test_codegen suite touching the Vitest binding (e.g. WriteRead_test) failed locally. Restoring the devDep fixes local dev; it's excluded from the shipped artifact's dependencies, so nothing changes for published envio.

Verification

pnpm rescript in test_codegen, plus vitest on the affected suites: YamlConfigIndexer_test, IndexerLoop_test, WriteRead_test, StalledPolling_test, SourceBlockHashes_test, SourceManager_test, FetchState_test, Rollback_test, EventOrigin_test — all green. Full suite runs on CI.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fb6Yyif9GZG1DWAiCER4Gh


Generated by Claude Code

Summary by CodeRabbit

  • Testing
    • Improved mock indexer behavior when determining the latest fetched block from returned data.
    • Updated YAML-based indexing tests to validate configuration metadata handling and default block-range behavior.
    • Added Vitest as a development testing tool.

- resolveGetItemsOrThrow now defaults latestFetchedBlockNumber to at least
  the highest item block, so an item above the fetched range (e.g. toBlock
  unset ⇒ defaults to fromBlock) is processed instead of silently dropped.
  The YAML acceptance test drops its ~latestFetchedBlockNumber workaround.
- MockIndexer.make accepts ~envioInfo (defaulting to {}), recorded on init
  and preserved across restart, so custom-config restart/compat-diff
  scenarios validate against the real stripped public config JSON. The
  acceptance test now passes it.
- Restore vitest to envio devDependencies: envio's Vitest binding imports
  "vitest", which resolves in CI (scenarios build against the artifact) but
  not for local workspace runs where node_modules/envio is a symlink, so
  test_codegen suites touching the binding failed locally.

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

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee7aec8b-52fd-4884-b6ed-45523d137c13

📥 Commits

Reviewing files that changed from the base of the PR and between 003d0a8 and 444ba71.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • packages/envio/package.json
  • scenarios/test_codegen/test/YamlConfigIndexer_test.res
  • scenarios/test_codegen/test/helpers/MockIndexer.res

📝 Walkthrough

Walkthrough

The mock indexer now accepts sanitized configuration metadata, preserves it across restarts, and derives default fetched block numbers from returned items. The YAML-driven test uses these behaviors, and Vitest is added as a development dependency.

Changes

MockIndexer YAML configuration

Layer / File(s) Summary
MockIndexer configuration and fetched-range handling
scenarios/test_codegen/test/helpers/MockIndexer.res
Indexer.make accepts envioInfo, passes it to persistence initialization and restarts, and derives default fetched block numbers from returned item blocks.
YAML test integration
scenarios/test_codegen/test/YamlConfigIndexer_test.res, packages/envio/package.json
The YAML test passes sanitized public configuration, relies on default fetched-range behavior, and adds Vitest 4.1.0 as a development dependency.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main MockIndexer behavior fix and the new envioInfo plumbing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
packages/envio/package.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants