chore: upgrade HyperIndex to envio@3.2.1#215
Conversation
Bump envio, migrate to the V3 API where needed, and refresh bundled agent skills.
|
@moose-code is attempting to deploy a commit to the InfinityBase Team on Vercel. A member of the Team first needs to authorize it. |
| @@ -1,4 +1,4 @@ | |||
| import { TestHelpers } from 'generated'; | |||
| import { TestHelpers } from "envio"; | |||
There was a problem hiding this comment.
🔴 CRITICAL: TestHelpers/MockDb API does not exist in envio v3
Problem: The import import { TestHelpers } from 'envio' was valid in v2 where generated re-exported test utilities. In envio v3 the testing API is createTestIndexer() (documented in the bundled indexer-testing skill added by this very PR). MockDb and the TestHelpers namespace were removed. Running pnpm test after this upgrade will throw a module resolution or named-export error, breaking CI.
Suggestion: Rewrite the test using the v3 API:
import { describe, it } from 'vitest';
import { createTestIndexer } from 'envio';
describe('Manager contract ManagerLogEvent tests', () => {
it('should process first block with events', async (t) => {
const indexer = createTestIndexer();
t.expect(
await indexer.process({ chains: { 0: {} } })
).toMatchInlineSnapshot(``);
});
});Also update package.json test script from pnpm mocha to pnpm vitest run since v3 uses Vitest, not Mocha.
| "strict": false, | ||
| "noImplicitOverride": true, | ||
| "module": "ESNext", | ||
| "moduleResolution": "bundler", |
There was a problem hiding this comment.
🟡 IMPORTANT: strict: false is a regression from the previous config
Problem: The previous tsconfig.json had "strict": true and "noImplicitAny": true. This PR sets "strict": false with no explanation. This silently disables strictNullChecks, noImplicitAny, strictFunctionTypes, and strictPropertyInitialization across the entire codebase. The handlers in EventHandlers.ts do things like record potentially being undefined (from context.Records.get(recordId)) — without strictNullChecks these paths are no longer type-checked, which is a real safety regression for blockchain indexing code.
Suggestion: Keep "strict": true. If specific v3-generated types are incompatible with strict mode, suppress them narrowly with // @ts-expect-error or fix the type, rather than disabling strict globally. The skipLibCheck: true already handles issues in .d.ts files from dependencies.
|
|
||
| Manager.ManagerLogEvent.handler(async ({ event, context }) => { | ||
| indexer.onEvent( | ||
| { contract: "Manager", event: "ManagerLogEvent" }, |
There was a problem hiding this comment.
🔵 SUGGESTION: Formatting — handler body indentation is misaligned after migration
Problem: The async ({ event, context }) => { arrow function body is indented at the same level as the indexer.onEvent( call arguments, but the closing } and ) are on separate lines in an inconsistent style (e.g. lines 51-52, 67-68, 109-110). This is a mechanical artifact of wrapping the old handler(async ...) call. Not a blocker, but it will generate noise in future diffs.
Suggestion: Reindent the handler body consistently:
indexer.onEvent(
{ contract: 'Manager', event: 'ManagerLogEvent' },
async ({ event, context }) => {
// body indented 4 spaces from the indexer.onEvent call
},
);| @@ -9,7 +9,7 @@ | |||
| "codegen": "envio codegen", | |||
| "dev": "envio dev", | |||
| "test": "pnpm mocha", | |||
There was a problem hiding this comment.
🟡 IMPORTANT: Test runner mismatch — mocha script but v3 uses Vitest
Problem: "test": "pnpm mocha" still references Mocha. The v3 envio testing infrastructure (as documented in the newly added indexer-testing skill) is built on Vitest. @types/chai and @types/mocha remain in devDependencies but Vitest is not listed. If the test file is rewritten for v3 (necessary per the critical finding above), this script will not execute it.
Suggestion: Replace with "test": "vitest run" and add vitest to devDependencies. Remove @types/mocha and @types/chai if they are no longer needed after the migration.
guimroque
left a comment
There was a problem hiding this comment.
Code Review: chore/upgrade-envio-3.2.1
This PR migrates the Envio HyperIndex indexer from v2 to v3.2.1, covering the mandatory API surface changes (networks → chains, Manager.Event.handler → indexer.onEvent, generated → envio imports, ts-node → envio start). The migration is mechanically correct and the bundled .claude/skills/ documentation is a legitimate artifact of envio skills update. Two issues warrant attention before merge: the test suite still imports a v2 API (TestHelpers from envio) that no longer exists in v3, and strict: false was introduced in the tsconfig without justification, silently removing type safety guarantees that were previously enforced.
Summary
envio(HyperIndex) to 3.2.1networks->chains,indexer.onEvent, imports fromenvio, etc.)envio skills update(under.claude/skills/)Context
This indexer is deployed on Envio's hosted service. Merging this PR makes it straightforward to redeploy on 3.2.1.
Test plan
pnpm installpnpm envio codegenpnpm dev(or hosted redeploy) and confirm indexing starts