Skip to content

chore: upgrade HyperIndex to envio@3.2.1#215

Open
moose-code wants to merge 1 commit into
infinitybase:enviofrom
moose-code:chore/upgrade-envio-3.2.1
Open

chore: upgrade HyperIndex to envio@3.2.1#215
moose-code wants to merge 1 commit into
infinitybase:enviofrom
moose-code:chore/upgrade-envio-3.2.1

Conversation

@moose-code

Copy link
Copy Markdown

Summary

  • Upgrade envio (HyperIndex) to 3.2.1
  • Migrate config/handlers to the V3 API where needed (networks -> chains, indexer.onEvent, imports from envio, etc.)
  • Refresh bundled agent skills via 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 install
  • pnpm envio codegen
  • pnpm dev (or hosted redeploy) and confirm indexing starts

Bump envio, migrate to the V3 API where needed, and refresh bundled agent skills.
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@moose-code is attempting to deploy a commit to the InfinityBase Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread apps/indexer/test/Test.ts
@@ -1,4 +1,4 @@
import { TestHelpers } from 'generated';
import { TestHelpers } from "envio";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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" },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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
  },
);

Comment thread apps/indexer/package.json
@@ -9,7 +9,7 @@
"codegen": "envio codegen",
"dev": "envio dev",
"test": "pnpm mocha",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 guimroque left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (networkschains, Manager.Event.handlerindexer.onEvent, generatedenvio imports, ts-nodeenvio 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.

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