MockIndexer: fix dropped-item default and thread envioInfo - #1459
Conversation
- 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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe 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. ChangesMockIndexer YAML configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.jsonTraceback (most recent call last): Comment |
Small follow-up to #1445 — DX/correctness fixes in the MockIndexer test harness.
Changes
1.
resolveGetItemsOrThrowno longer silently drops items above the fetched rangeWhen a caller resolved items without an explicit
~latestFetchedBlockNumber, the mock defaulted it totoBlock ?? fromBlock. If an item'sblockNumbersat above that (e.g. the first query wheretoBlockis unset ⇒ defaults tofromBlock), the indexer — which only processes up tolatestFetchedBlockNumber— 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=300workaround it previously needed, which demonstrates the fix.2.
MockIndexer.makeaccepts~envioInfoPreviously
Persistence.initwas always passed{}asenvio_info.makenow takes~envioInfo(defaulting to{}, so existing callers are unchanged) and preserves it acrossrestart, so custom-config restart/compat-diff scenarios can validate against the real stripped public config JSON. The acceptance test now passespublicConfigJson->Config.stripSensitiveData.3. Restore
vitestto envio's devDependencies (bug fix)envio's
src/bindings/Vitest.res.mjsimports"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, wherenode_modules/enviosymlinks to the package whosenode_modulesno longer has vitest — so any test_codegen suite touching theVitestbinding (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 rescriptin 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