Skip to content

Use ENSRainbow public config within ENSIndexer public config#1705

Merged
tk-o merged 16 commits intomainfrom
feat/1166-use-ensrainbow-public-config
Mar 3, 2026
Merged

Use ENSRainbow public config within ENSIndexer public config#1705
tk-o merged 16 commits intomainfrom
feat/1166-use-ensrainbow-public-config

Conversation

@tk-o
Copy link
Contributor

@tk-o tk-o commented Mar 2, 2026

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • Adds ensRainbowPublicConfig: EnsRainbowPublicConfig field to EnsIndexerPublicConfig
  • Updates all relevant zod schemas, types, and mocks, to follow updated EnsIndexerPublicConfig data model
  • Adds new invariant to EnsIndexerPublicConfig schema which ensures ENSRainbow labelset match between server labelset and client labelset.

Why


Testing

  • Successfully executed lint, typecheck and testing suite.
  • Ran ENSIndexer, ENSApi and ENSAdmin locally, together, and observed the ENSAdmin UI:
image

Notes for Reviewer (Optional)


Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

Resolves #1166, #1168.

Copilot AI review requested due to automatic review settings March 2, 2026 18:53
@vercel
Copy link
Contributor

vercel bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Mar 3, 2026 8:13pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
ensnode.io Skipped Skipped Mar 3, 2026 8:13pm
ensrainbow.io Skipped Skipped Mar 3, 2026 8:13pm

@changeset-bot
Copy link

changeset-bot bot commented Mar 2, 2026

🦋 Changeset detected

Latest commit: ea1898b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@ensnode/ensrainbow-sdk Major
ensindexer Major
@docs/ensnode Major
ensadmin Major
ensapi Major
@ensnode/ensnode-sdk Major
ensrainbow Major
fallback-ensapi Major
@namehash/ens-referrals Major
@ensnode/ensnode-react Major
@namehash/namehash-ui Major
@ensnode/datasources Major
@ensnode/ensnode-schema Major
@ensnode/ponder-sdk Major
@ensnode/ponder-subgraph Major
@ensnode/shared-configs Major
@docs/ensrainbow Major
@docs/mintlify Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR replaces the flat ensRainbow and ensRainbowSchema fields with a nested ensRainbowPublicConfig object (version, labelSet, recordsCount) across types, schemas, mocks, tests, docs, validation logic, and UI display paths; it also introduces ENSRainbow config schemas and an invariant validating label-set compatibility.

Changes

Cohort / File(s) Summary
Mocks & Test Data
apps/ensadmin/src/app/mock/config-api.mock.ts, apps/ensadmin/src/app/mock/config-info/data.json, packages/ensnode-sdk/src/ensapi/client.test.ts, packages/ensnode-sdk/src/ensindexer/client.mock.ts, apps/ensindexer/src/lib/ensdb-client/ensdb-client.mock.ts
Replace ensRainbow + ensRainbowSchema with ensRainbowPublicConfig (version, labelSet, recordsCount) in test fixtures and mock configs.
Public Types & Exports
packages/ensnode-sdk/src/ensrainbow/config.ts, packages/ensnode-sdk/src/ensrainbow/index.ts, packages/ensrainbow-sdk/src/client.ts, packages/ensnode-sdk/src/ensindexer/config/types.ts
Add EnsRainbowPublicConfig type and update EnsIndexerVersionInfo/public config to use ensRainbowPublicConfig; re-export config from ensrainbow and adapt ENSRainbow SDK to use the shared type.
Schema Factories & Validation
packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts, packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts, packages/ensnode-sdk/src/ensindexer/config/labelset-utils.ts, packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts
Introduce makeLabelSetIdSchema, makeLabelSetVersionSchema, makeEnsRainbowPublicConfigSchema; move/centralize label-set schemas; replace flat fields with ensRainbowPublicConfig in ENSIndexer schema and add invariant invariant_ensRainbowSupportedLabelSetAndVersion.
Serialization / Conversions / Tests
packages/ensnode-sdk/src/ensapi/config/conversions.test.ts, packages/ensnode-sdk/src/ensindexer/config/conversions.test.ts, packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts
Update serialization/deserialization test fixtures and expectations to use ensRainbowPublicConfig shape instead of ensRainbow + ensRainbowSchema.
Config Validation Logic
apps/ensapi/src/config/config.schema.test.ts, apps/ensapi/src/config/validations.ts
Adjust validations and invariant error messages to reference ensRainbowPublicConfig.version and the new nested fields.
ENSIndexer Runtime API
apps/ensindexer/src/lib/version-info.ts
Rename types/functions to EnsIndexer*, use ensRainbowPublicConfig from config, remove ensRainbowSchema, update parsing schema usage and return parsed.data.
UI
apps/ensadmin/src/components/connection/cards/ensnode-info.tsx
Change UI to read ensRainbowPublicConfig.version and ensRainbowPublicConfig.labelSet and display recordsCount; minor badge padding tweak.
Docs & Changesets
docs/ensnode.io/src/content/docs/docs/usage/api.mdx, .changeset/*
Update API docs/examples to show ensRainbowPublicConfig; add changesets noting version bumps and the public-config shape change.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

ensnode-sdk

Poem

🐰 A little rabbit hops with glee,

Nesting rainbows now for all to see,
Label sets and counts in tidy rows,
Validations guard where certainty grows,
Hooray — configs snug where structure flows!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: introducing ENSRainbow public config within ENSIndexer public config, which aligns with the changeset.
Linked Issues check ✅ Passed The PR addresses all primary objectives from issue #1166: nested ensRainbowPublicConfig in EnsIndexerVersionInfo, removal of ensRainbowSchema, labelset compatibility invariant checks, and ENSAdmin UI updates showing records count.
Out of Scope Changes check ✅ Passed All changes are directly related to restructuring the ENSIndexer and ENSRainbow public config objects to include ensRainbowPublicConfig. No unrelated modifications to logging, dependencies, or other systems detected.
Description check ✅ Passed The PR description follows the required template with all essential sections: Summary, Why, Testing, Notes for Reviewer, and Pre-Review Checklist completed with appropriate detail.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/1166-use-ensrainbow-public-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Comment on lines +574 to +578
{ensIndexerPublicConfig.versionInfo.ensRainbowPublicConfig.labelSet.labelSetId}:
{
ensIndexerPublicConfig.versionInfo.ensRainbowPublicConfig.labelSet
.highestLabelSetVersion
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolves #1168

Comment on lines +593 to +610
<InfoCardItem
label="Records Count"
value={
<p className={cardItemValueStyles}>
{ensIndexerPublicConfig.versionInfo.ensRainbowPublicConfig.recordsCount}
</p>
}
additionalInfo={
<p>
The total number of Rainbow Records.{" "}
<ExternalLinkWithIcon
href={`https://ensnode.io/ensrainbow/concepts/glossary/#rainbow-record`}
>
Learn more.
</ExternalLinkWithIcon>
</p>
}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We present extra info now that we have access to it 👍

@tk-o
Copy link
Contributor Author

tk-o commented Mar 2, 2026

Self-review completed 👍

@tk-o
Copy link
Contributor Author

tk-o commented Mar 2, 2026

@greptile review

@tk-o tk-o marked this pull request as ready for review March 2, 2026 18:58
@tk-o tk-o requested a review from a team as a code owner March 2, 2026 18:58
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/ensapi/src/config/config.schema.test.ts`:
- Around line 42-46: Add a unit test in the config.schema.test.ts suite that
asserts behavior when ensRainbowPublicConfig.version is different from
packageJson.version: create a test case where ensRainbowPublicConfig.version is
set to a different string than packageJson.version and validate the
schema/validation logic (the same assertions used for the existing
ensRainbowPublicConfig block) to ensure connected-service configs permit or
reject a mismatched version as intended; reference the existing
ensRainbowPublicConfig object and packageJson.version to locate where to add the
new case and mirror existing test patterns for consistency.

In `@apps/ensapi/src/config/validations.ts`:
- Around line 37-43: The current validation enforces exact equality between
ensIndexerPublicConfig.versionInfo.ensRainbowPublicConfig.version and
packageJson.version which wrongly treats ENSRainbow as an internal component;
remove or relax that strict check in validations.ts by deleting the equality
branch that pushes the custom issue (the block referencing
ensIndexerPublicConfig.versionInfo.ensRainbowPublicConfig.version and
packageJson.version) or replace it with a non-blocking compatibility/info-level
check; update any tests or callers expecting this issue to no longer fail when
ENSRainbow version differs from ENSApi.

In `@docs/ensnode.io/src/content/docs/docs/usage/api.mdx`:
- Around line 125-129: The docs use the new ensRainbowPublicConfig object but
the surrounding prose still says “ENSRainbow version and schema details”; update
the “Key Configuration Details” paragraph to reference ensRainbowPublicConfig
and its fields (version, labelSet with labelSetId/highestLabelSetVersion, and
recordsCount) so the wording aligns with the example. Specifically, replace the
ambiguous phrase “ENSRainbow version and schema details” with something like
“ensRainbowPublicConfig — contains version, labelSet (labelSetId and
highestLabelSetVersion), and recordsCount” and ensure any subsequent sentences
refer to those exact field names.

In `@packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts`:
- Around line 167-170: The nested ensRainbowPublicConfig schema is calling
makeLabelSetIdSchema() and makeLabelSetVersionSchema() without a valueLabel,
causing "undefined" in errors; update the calls to pass descriptive labels —
e.g., call makeLabelSetIdSchema("ensRainbowPublicConfig.labelSet.labelSetId")
and
makeLabelSetVersionSchema("ensRainbowPublicConfig.labelSet.highestLabelSetVersion")
where those functions are invoked so validation errors reference the correct
field paths.

In `@packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts`:
- Around line 108-115: The nested ensRainbowPublicConfig.labelSet schema uses
makeLabelSetIdSchema() and makeLabelSetVersionSchema() without explicit field
labels, which yields poor error messages; update the call sites inside the
ensRainbowPublicConfig object (labelSet) to pass descriptive labels (e.g.,
"labelSet.labelSetId" and "labelSet.highestLabelSetVersion") into
makeLabelSetIdSchema(...) and makeLabelSetVersionSchema(...) so Zod errors
report meaningful field names when validation fails.

In `@packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts`:
- Around line 13-20: The validation error messages in makeLabelSetIdSchema (and
the similar factory at lines ~31-34) use the optional parameter valueLabel which
can be undefined, producing messages like "undefined must be..."; fix this by
giving valueLabel a sensible default (e.g., "value" or "label") in the function
signature or normalizing it at the start of the function, then use that fallback
when constructing the z.string/.min/.max/.regex error messages so all validation
output remains stable when no argument is passed.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0de5e9 and 04336fb.

📒 Files selected for processing (19)
  • apps/ensadmin/src/app/mock/config-api.mock.ts
  • apps/ensadmin/src/app/mock/config-info/data.json
  • apps/ensadmin/src/components/connection/cards/ensnode-info.tsx
  • apps/ensapi/src/config/config.schema.test.ts
  • apps/ensapi/src/config/validations.ts
  • apps/ensindexer/src/lib/version-info.ts
  • docs/ensnode.io/src/content/docs/docs/usage/api.mdx
  • packages/ensnode-sdk/src/ensapi/client.test.ts
  • packages/ensnode-sdk/src/ensapi/config/conversions.test.ts
  • packages/ensnode-sdk/src/ensindexer/client.mock.ts
  • packages/ensnode-sdk/src/ensindexer/config/conversions.test.ts
  • packages/ensnode-sdk/src/ensindexer/config/labelset-utils.ts
  • packages/ensnode-sdk/src/ensindexer/config/types.ts
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts
  • packages/ensnode-sdk/src/ensrainbow/config.ts
  • packages/ensnode-sdk/src/ensrainbow/index.ts
  • packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts
  • packages/ensrainbow-sdk/src/client.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces EnsRainbowPublicConfig as a shared type in @ensnode/ensnode-sdk and embeds it in EnsIndexerVersionInfo as ensRainbowPublicConfig, replacing the previous flat ensRainbow (version string) and ensRainbowSchema (integer) fields. This allows ENSIndexer to expose richer ENSRainbow service configuration (version, label set, and records count) through its public config API, which ENSApi can then forward to ENSAdmin UI.

Changes:

  • EnsRainbowPublicConfig type is extracted into packages/ensnode-sdk/src/ensrainbow/config.ts and a corresponding Zod schema (makeEnsRainbowPublicConfigSchema) is added to ensrainbow/zod-schemas/config.ts
  • EnsIndexerVersionInfo.ensRainbow + ensRainbowSchema replaced with ensRainbowPublicConfig: EnsRainbowPublicConfig; all dependent schemas, types, and mocks updated
  • ENSAdmin UI updated to display the new recordsCount field from ensRainbowPublicConfig

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/ensrainbow-sdk/src/client.ts EnsRainbow.ENSRainbowPublicConfig changed from interface to type alias re-exporting from ensnode-sdk
packages/ensnode-sdk/src/ensrainbow/config.ts New file defining EnsRainbowPublicConfig interface
packages/ensnode-sdk/src/ensrainbow/index.ts Exports the new config.ts
packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts New file with Zod schemas for EnsRainbowPublicConfig
packages/ensnode-sdk/src/ensindexer/config/types.ts Replaces ensRainbow+ensRainbowSchema fields with ensRainbowPublicConfig: EnsRainbowPublicConfig
packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts Updates makeEnsIndexerVersionInfoSchema and removes duplicate schema helpers
packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts Updates tests for new field structure
packages/ensnode-sdk/src/ensindexer/config/labelset-utils.ts Updates import of makeLabelSetIdSchema/makeLabelSetVersionSchema to new location
packages/ensnode-sdk/src/ensindexer/config/conversions.test.ts Updates mock data to new field structure
packages/ensnode-sdk/src/ensindexer/client.mock.ts Updates mock config to new field structure
packages/ensnode-sdk/src/ensapi/config/conversions.test.ts Updates mock data to new field structure
packages/ensnode-sdk/src/ensapi/client.test.ts Updates example config response to new field structure
apps/ensindexer/src/lib/version-info.ts Fetches ensRainbowPublicConfig via new config() API instead of version()
apps/ensapi/src/config/validations.ts Updates version mismatch check to use ensRainbowPublicConfig.version
apps/ensapi/src/config/config.schema.test.ts Updates test config to new field structure
apps/ensadmin/src/components/connection/cards/ensnode-info.tsx Displays recordsCount and uses ensRainbowPublicConfig for version/label set display
apps/ensadmin/src/app/mock/config-info/data.json Updates mock data to new field structure
apps/ensadmin/src/app/mock/config-api.mock.ts Updates mock config to new field structure
docs/ensnode.io/src/content/docs/docs/usage/api.mdx Updates API example response to reflect new ensRainbowPublicConfig structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tk-o
Copy link
Contributor Author

tk-o commented Mar 2, 2026

@greptile review

@tk-o
Copy link
Contributor Author

tk-o commented Mar 3, 2026

@greptile review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 3, 2026

Additional Comments (1)

packages/ensrainbow-sdk/src/client.ts
Non-JSON error response will throw a parse error

If the ENSRainbow service returns a non-2xx response whose body is not valid JSON (e.g., a plain-text 404 Not Found from a proxy/load balancer, or an older ENSRainbow instance that doesn't yet expose /v1/config), the await response.json() call in the error branch will itself throw a SyntaxError, completely masking the original HTTP status. Since getENSIndexerVersionInfo() propagates the error, this would cause a confusing crash at indexer startup with no indication of the real cause.

  if (!response.ok) {
    let errorMessage: string;
    try {
      const errorData = (await response.json()) as { error?: string; errorCode?: number };
      errorMessage = errorData.error ?? `Failed to fetch ENSRainbow config: ${response.statusText}`;
    } catch {
      errorMessage = `Failed to fetch ENSRainbow config: ${response.status} ${response.statusText}`;
    }
    throw new Error(errorMessage);
  }

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

apps/ensindexer/src/lib/version-info.ts:138

  • The invariant check for label-set compatibility between ENSIndexer client and ENSRainbow server (invariant_ensRainbowSupportedLabelSetAndVersion) was added to makeEnsIndexerPublicConfigSchema, which runs at deserialization time in the consumer (ENSDb Writer Worker via ensIndexerClient.config()). However, the ENSIndexer's own /api/config endpoint in apps/ensindexer/ponder/src/api/handlers/ensnode-api.ts builds the config via buildENSIndexerPublicConfig() and then directly serializes it without validating through makeEnsIndexerPublicConfigSchema. This means:
  1. ENSIndexer's /api/config will return HTTP 200 even when there's a label-set mismatch between the configured client label set and the ENSRainbow server's actual label set.
  2. The failure only occurs on the consumer side (ENSDb Writer Worker), not at the source.

Issue #1166 (which this PR claims to resolve) explicitly requires: "if this invariant check fails then ENSIndexer should throw an error such that ultimately the API call to get the config of the ENSIndexer instance should trigger a HTTP 500 error."

To fulfill this requirement, buildENSIndexerPublicConfig (or the /api/config handler) should run the validation via makeEnsIndexerPublicConfigSchema and return HTTP 500 if the invariant fails. Note that deserializeEnsIndexerPublicConfig already performs this validation, so wrapping the built config through that schema would trigger the check and allow the handler to catch and return HTTP 500.

export async function getENSIndexerVersionInfo(): Promise<ENSIndexerVersionInfo> {
  const ensRainbowApiClient = getENSRainbowApiClient();
  const ensRainbowPublicConfig = await ensRainbowApiClient.config();

  // ENSIndexer version
  const ensIndexerVersion = packageJson.version;

  // ENSDb version
  // ENSDb version is always the same as the ENSIndexer version number
  const ensDbVersion = ensIndexerVersion;

  // parse unvalidated version info
  const schema = makeENSIndexerVersionInfoSchema();
  const parsed = schema.safeParse({
    ensRainbowPublicConfig,
    nodejs: process.versions.node,
    ponder: getPackageVersion("ponder"),
    ensDb: ensDbVersion,
    ensIndexer: ensIndexerVersion,
    ensNormalize: getPackageVersion("@adraffy/ens-normalize"),
  } satisfies SerializedENSIndexerVersionInfo);

  if (parsed.error) {
    throw new Error(`Cannot deserialize ENSIndexerVersionInfo:\n${prettifyError(parsed.error)}\n`);
  }

  // return version info we have now validated
  return parsed.data;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@tk-o Looks good! 1 question but appreciate your advice on how to proceed on it 👍

ensRainbowSchema: number;
* ENSRainbow public config
*/
ensRainbowPublicConfig: EnsRainbowPublicConfig;
Copy link
Member

Choose a reason for hiding this comment

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

This field should be moved out of EnsIndexerVersionInfo and into EnsIndexerPublicConfig.

Goal: It's not a version number like all the other fields in EnsIndexerVersionInfo

Copilot AI review requested due to automatic review settings March 3, 2026 20:04
@tk-o tk-o force-pushed the feat/1166-use-ensrainbow-public-config branch from 5a29a9d to 5fd3bb3 Compare March 3, 2026 20:04
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io March 3, 2026 20:04 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io March 3, 2026 20:04 Inactive
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

apps/ensindexer/src/config/public.ts:33

  • The buildENSIndexerPublicConfig function assembles the config and returns it without passing it through makeEnsIndexerPublicConfigSchema, so the new invariant_ensRainbowSupportedLabelSetAndVersion check (which validates that the server labelSet from ENSRainbow is compatible with the client labelSet) is never triggered on the ENSIndexer server side. As a result, the /config HTTP endpoint will return a 200 response with mismatched label set data rather than a 500 error as required by issue #1166. The invariant check should be applied to the built config in buildENSIndexerPublicConfig (or in the /config route handler) so that a misconfiguration causes a server-side error.
export async function buildENSIndexerPublicConfig(
  config: EnsIndexerConfig,
): Promise<EnsIndexerPublicConfig> {
  const [versionInfo, ensRainbowPublicConfig] = await Promise.all([
    getENSIndexerVersionInfo(),
    ensRainbowApiClient.config(),
  ]);

  return {
    databaseSchemaName: config.databaseSchemaName,
    ensRainbowPublicConfig,
    labelSet: config.labelSet,
    indexedChainIds: config.indexedChainIds,
    isSubgraphCompatible: config.isSubgraphCompatible,
    namespace: config.namespace,
    plugins: config.plugins,
    versionInfo,
  };

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 3, 2026 20:12
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io March 3, 2026 20:12 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io March 3, 2026 20:12 Inactive
@tk-o tk-o merged commit a0be9a6 into main Mar 3, 2026
18 checks passed
@tk-o tk-o deleted the feat/1166-use-ensrainbow-public-config branch March 3, 2026 20:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

apps/ensindexer/src/config/public.ts:34

  • Issue #1166 requires that when ENSIndexer detects a label set mismatch between its configured client label set and the ENSRainbow server label set, the /api/config endpoint must return an HTTP 500 error. This requirement is not met.

buildENSIndexerPublicConfig constructs the config object and returns it without running it through makeEnsIndexerPublicConfigSchema. The invariant invariant_ensRainbowSupportedLabelSetAndVersion is only applied during deserialization on the consuming side (e.g. in EnsIndexerClient.config()), not on the ENSIndexer server side when building and serving the response.

To meet the requirement, buildENSIndexerPublicConfig (or the /api/config handler) should validate the constructed config through makeEnsIndexerPublicConfigSchema, and if the validation fails due to label set mismatch, the error should propagate as an HTTP 500. For example, the built config can be passed through makeEnsIndexerPublicConfigSchema().parse(config) (with proper handling of the Set<ChainId> type), or validateSupportedLabelSetAndVersion can be called directly in buildENSIndexerPublicConfig.

export async function buildENSIndexerPublicConfig(
  config: EnsIndexerConfig,
): Promise<EnsIndexerPublicConfig> {
  const [versionInfo, ensRainbowPublicConfig] = await Promise.all([
    getENSIndexerVersionInfo(),
    ensRainbowApiClient.config(),
  ]);

  return {
    databaseSchemaName: config.databaseSchemaName,
    ensRainbowPublicConfig,
    labelSet: config.labelSet,
    indexedChainIds: config.indexedChainIds,
    isSubgraphCompatible: config.isSubgraphCompatible,
    namespace: config.namespace,
    plugins: config.plugins,
    versionInfo,
  };
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 119 to 131
"versionInfo": {
"nodejs": "22.18.0",
"ponder": "0.11.43",
"ensDb": "0.35.0",
"ensIndexer": "0.35.0",
"ponder": "0.16.1",
"ensDb": "1.5.1",
"ensIndexer": "1.5.1",
"ensNormalize": "1.11.1",
"ensRainbow": "0.34.0",
"ensRainbowSchema": 3
"ensRainbowPublicConfig": {
"version": "1.5.1",
"labelSet": { "labelSetId": "subgraph", "highestLabelSetVersion": 0 },
"recordsCount": 133856894
}
}
}
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The example JSON response in the documentation shows ensRainbowPublicConfig nested inside versionInfo, but according to the actual type definitions (EnsIndexerPublicConfig in packages/ensnode-sdk/src/ensindexer/config/types.ts), ensRainbowPublicConfig is a top-level field of the config, not a child of versionInfo. The versionInfo object only contains nodejs, ponder, ensDb, ensIndexer, and ensNormalize.

The example response should be corrected: ensRainbowPublicConfig should appear as a top-level sibling of versionInfo, labelSet, namespace, etc., and the versionInfo block should not contain ensRainbowPublicConfig.

Copilot uses AI. Check for mistakes.
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.

Connection view: update ENSRainbow section values Update ENSIndexer version info to fully cover ENSRainbow version info

3 participants