Skip to content

Extend ensdb-sdk with EnsDbConfig data model#1868

Merged
shrugs merged 12 commits intomainfrom
feat/1824-enhance-ensdb-sdk
Apr 3, 2026
Merged

Extend ensdb-sdk with EnsDbConfig data model#1868
shrugs merged 12 commits intomainfrom
feat/1824-enhance-ensdb-sdk

Conversation

@tk-o
Copy link
Copy Markdown
Contributor

@tk-o tk-o commented Apr 3, 2026

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • Added EnsDbConfig data model and validateEnsDbConfig function to ENSDb SDK
  • Integrated the EnsDbConfig data model into ENSApi and ENSIndexer
    • The validated EnsDbConfig object is built for each app based on the environment configuration
      • This step uses validateEnsDbConfig to enforce invariants
    • The validated EnsDbConfig object is merged into each app's config object (EnsApiConfig / EnsIndexerConfig)
      • See includeEnsDbConfig function

Why

  • We need to support using ENSDb SDK for building apps. This includes building a data model in ENSDb SDK that allows a simple integration of ENSDb clients into the target app (for example, ENSApi, ENSIndexer, but also, in the future ENSDb CLI, or the planned "hello world" hono app template).

Testing

  • Ran ENSApi and ENSIndexer locally to ensure database operations working as expected on both sides.

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)

tk-o added 7 commits April 3, 2026 08:15
We do not want the users of ENSDb SDK to have to worry about ENSNode SDK dependency on their end
Added `EnsDbConfig` type and `validateEnsDbConfig` function
Defined `buildEnsDbConfigFromEnvironment` function to source ENSDb config from env vars.
Defined `buildEnsDbConfigFromEnvironment` function to source ENSDb config from env vars.
Copilot AI review requested due to automatic review settings April 3, 2026 08:59
@tk-o tk-o requested a review from a team as a code owner April 3, 2026 08:59
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2026

🦋 Changeset detected

Latest commit: caab8f0

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

This PR includes changesets to release 23 packages
Name Type
@ensnode/ensdb-sdk Major
ensapi Major
ensindexer Major
@ensnode/integration-test-env Patch
ensadmin Major
ensrainbow Major
fallback-ensapi Major
enssdk Major
enscli Major
enskit Major
ensskills Major
@ensnode/datasources Major
@ensnode/ensrainbow-sdk Major
@ensnode/ensnode-react Major
@ensnode/ensnode-sdk Major
@ensnode/ponder-sdk Major
@ensnode/ponder-subgraph Major
@ensnode/shared-configs Major
@docs/ensnode Major
@docs/ensrainbow Major
@docs/mintlify Major
@namehash/ens-referrals Major
@namehash/namehash-ui 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

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 3, 2026

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
admin.ensnode.io Skipped Skipped Apr 3, 2026 4:57pm
ensnode.io Skipped Skipped Apr 3, 2026 4:57pm
ensrainbow.io Skipped Skipped Apr 3, 2026 4:57pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

Warning

Rate limit exceeded

@shrugs has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 26 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 26 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f40c9052-b590-44b7-b787-154ba1e6991a

📥 Commits

Reviewing files that changed from the base of the PR and between 7aa8ce4 and caab8f0.

📒 Files selected for processing (3)
  • apps/ensapi/src/config/config.schema.ts
  • apps/ensindexer/src/config/config.schema.ts
  • apps/ensindexer/src/lib/graphnode-helpers.test.ts
📝 Walkthrough

Walkthrough

Centralized ENSDb configuration validation into the ensdb-sdk package by adding EnsDbConfig, Zod schemas, and validateEnsDbConfig(). Refactored ensapi and ensindexer to consume the SDK validation (including lazy initialization), removed duplicate local validators, and updated tests and mocks accordingly.

Changes

Cohort / File(s) Summary
ENSDb SDK Core
packages/ensdb-sdk/package.json, packages/ensdb-sdk/src/client/ensdb-config.ts, packages/ensdb-sdk/src/client/zod-schemas/ensdb-config.ts, packages/ensdb-sdk/src/client/validate/ensdb-config.ts, packages/ensdb-sdk/src/client/index.ts, .changeset/fluffy-forks-film.md
Added EnsDbConfig interface, Zod schemas (EnsDbUrlSchema, EnsIndexerSchemaNameSchema, EnsDbConfigSchema) and validateEnsDbConfig(); updated package dependencies to include pg-connection-string and zod, and re-exported new modules from SDK.
ensapi app
apps/ensapi/package.json, apps/ensapi/src/config/ensdb-config.schema.ts (removed), apps/ensapi/src/config/ensdb-config.ts, apps/ensapi/src/config/config.schema.ts, apps/ensapi/src/config/config.schema.test.ts, apps/ensapi/src/lib/ensdb/singleton.ts
Removed local ENSDb schema module, switched to SDK validation via validateEnsDbConfig with lazy proxy export, injected validated ENSDb fields via schema transform, updated tests to mock/shared config shape, and removed pg-connection-string dependency.
ensindexer app
apps/ensindexer/package.json, apps/ensindexer/src/config/ensdb-config.ts, apps/ensindexer/src/config/config.schema.ts, apps/ensindexer/src/config/config.test.ts, apps/ensindexer/src/config/types.ts
Added app-level ensdb-config.ts that builds and validates ENSDb config using SDK; removed local connection-string parsing and local ENSDb URL schema; schema now injects SDK-provided ENSDb fields via transform; tests updated and dependency removed.
ensindexer tests & test helpers
apps/ensindexer/src/lib/__test__/mockConfig.ts, apps/ensindexer/src/lib/graphnode-helpers.test.ts, apps/ensindexer/src/lib/subgraph/ids.test.ts, apps/ensindexer/src/config/config.test.ts
Added setupEnsDbConfigMock() test helper that mocks @/config/ensdb-config with lazy getters that call validateEnsDbConfig; updated tests to initialize this mock first and adjusted expected error messages.
ensnode-sdk cleanup
packages/ensnode-sdk/src/shared/config/types.ts, packages/ensnode-sdk/src/shared/config/zod-schemas.ts, packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts
Removed previously exported DatabaseUrl / EnsIndexerSchemaName types and the EnsIndexerSchemaNameSchema Zod schema from shared package; removed related tests.
Removed local validators
apps/ensapi/src/config/ensdb-config.schema.ts (deleted), apps/ensindexer/src/config/... (local schema removals)
Deleted duplicated local ENSDb validation modules and parsers that are now provided by the SDK.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application Module
    participant ConfigMod as App Config Module
    participant LazyProxy as lazyProxy<EnsDbConfig>
    participant Env as process.env
    participant SDK as ensdb-sdk.validateEnsDbConfig

    App->>ConfigMod: import ensDbConfig
    ConfigMod->>LazyProxy: create lazyProxy(for builder)
    App->>LazyProxy: access ensDbUrl / ensIndexerSchemaName
    activate LazyProxy
    LazyProxy->>Env: read ENSDB_URL, ENSINDEXER_SCHEMA_NAME
    LazyProxy->>SDK: validateEnsDbConfig(unvalidated)
    SDK->>SDK: parse via Zod schemas
    alt validation succeeds
        SDK-->>LazyProxy: return validated EnsDbConfig
        LazyProxy-->>App: return requested values
    else validation fails
        SDK-->>LazyProxy: throw Error (prettified)
        LazyProxy->>ConfigMod: log error
        LazyProxy->>ConfigMod: process.exit(1)
    end
    deactivate LazyProxy
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Poem

🐰 Hopped through configs, tidy and swift,
Packaged the checks into one little gift.
Lazy paws wait till values are sought,
Then validate, cheer — no duplicates fought! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Extend ensdb-sdk with EnsDbConfig data model' accurately describes the primary change: adding the EnsDbConfig data model to the ensdb-sdk package.
Description check ✅ Passed The PR description follows the template with all required sections completed: Summary, Why, Testing, Notes, and Pre-Review Checklist. The description clearly explains changes and links to related issue #1824.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #1824: moved DatabaseUrlSchema, EnsIndexerSchemaNameSchema, EnsDbConfigSchema, and EnsDbConfig type into ensdb-sdk [#1824]; implemented validateEnsDbConfig function for validation [#1824]; and integrated into ENSApi and ENSIndexer applications [#1824].
Out of Scope Changes check ✅ Passed All changes are directly related to the PR objective of consolidating ENSDb configuration into ensdb-sdk and integrating it into apps. Removal of pg-connection-string dependencies is a necessary cleanup from moving validation logic. No unrelated changes detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1824-enhance-ensdb-sdk

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.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 3, 2026

Greptile Summary

This PR consolidates the EnsDbConfig data model and its validation logic into the ensdb-sdk package, then wires both ensapi and ensindexer up to the new shared primitive — replacing per-app inline Zod schema definitions with a single validateEnsDbConfig function.

Key changes:

  • New ensdb-sdk exports: EnsDbConfig interface, validateEnsDbConfig function, and supporting Zod schemas (EnsDbConfigSchema, EnsDbUrlSchema) centralised under packages/ensdb-sdk/src/client/.
  • pg-connection-string dependency relocated: removed from ensapi and ensindexer package.json and promoted to a direct dependency of ensdb-sdk.
  • ensapi: old inline ensdb-config.schema.ts file deleted; ensdb-config.ts now calls validateEnsDbConfig and wraps the result in a lazyProxy to preserve the deferred-init behaviour required for OpenAPI generation.
  • ensindexer: new ensdb-config.ts module with eager module-level initialisation (confirmed intentional); inline EnsDbUrlSchema and EnsIndexerSchemaNameSchema removed from config.schema.ts.
  • ensnode-sdk cleanup: DatabaseUrl, EnsIndexerSchemaName type aliases and the standalone EnsIndexerSchemaNameSchema removed; types.ts now references EnsDbConfig[\"ensDbUrl\"] and EnsDbConfig[\"ensIndexerSchemaName\"] directly.
  • Tests updated across both apps; new setupEnsDbConfigMock helper added to mockConfig.ts.

Confidence Score: 5/5

Safe to merge — no runtime bugs or data-integrity issues found; the only finding is a P2 test mock design smell.

All previous P1 concerns (duplicate schema definitions, missing deduplication) are addressed. The remaining finding (double-validation in mock getters) is a test-only style issue that does not affect production behaviour and does not reduce the score below 5.

apps/ensindexer/src/lib/test/mockConfig.ts — double-validation getter pattern worth tidying for long-term test maintainability.

Important Files Changed

Filename Overview
packages/ensdb-sdk/src/client/ensdb-config.ts New EnsDbConfig interface with well-documented invariants for ensDbUrl and ensIndexerSchemaName; clean public API surface.
packages/ensdb-sdk/src/client/validate/ensdb-config.ts New validateEnsDbConfig function that throws on failure using prettifyError; correctly typed with Unvalidated.
packages/ensdb-sdk/src/client/zod-schemas/ensdb-config.ts Centralised Zod schemas for URL and schema name validation; EnsIndexerSchemaNameSchema is internal-only (not re-exported), EnsDbUrlSchema exported but used only within the SDK.
apps/ensindexer/src/config/ensdb-config.ts Eager module-level initialisation; uses console.error consistent with the rest of the ensindexer codebase (no dedicated logger module).
apps/ensapi/src/config/ensdb-config.ts Migrated to validateEnsDbConfig from ensdb-sdk; correctly wrapped in lazyProxy for deferred initialisation during OpenAPI generation.
apps/ensindexer/src/lib/test/mockConfig.ts New setupEnsDbConfigMock function added; both getters call validateEnsDbConfig with both fields, meaning an invalid field throws from whichever getter is called first.
apps/ensindexer/src/config/config.schema.ts EnsDb fields injected via transform closure referencing eagerly-validated ensDbConfig module; removes inline Zod schema duplication.
packages/ensnode-sdk/src/shared/config/types.ts Removes now-redundant DatabaseUrl and EnsIndexerSchemaName type aliases.
packages/ensnode-sdk/src/shared/config/zod-schemas.ts Removes EnsIndexerSchemaNameSchema (now owned by ensdb-sdk); clean deduplication as called out in previous review thread.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph ensdb-sdk
        EC[EnsDbConfig interface]
        ZS[EnsDbConfigSchema Zod schema]
        VF[validateEnsDbConfig throws on failure]
        ZS --> VF
        EC --> VF
    end

    subgraph ensapi
        AEC[ensdb-config.ts buildEnsDbConfigFromEnvironment wrapped in lazyProxy]
        ACS[config.schema.ts EnsApiConfigSchema .transform includeEnsDbConfig]
        AEC --> ACS
    end

    subgraph ensindexer
        IEC[ensdb-config.ts buildEnsDbConfigFromEnvironment eager module-level init]
        ICS[config.schema.ts ENSIndexerConfigSchema .transform includeEnsDbConfig]
        IEC --> ICS
    end

    VF --> AEC
    VF --> IEC
    process.env --> AEC
    process.env --> IEC
Loading

Reviews (2): Last reviewed commit: "Apply AI PR feedback" | Re-trigger Greptile

Copy link
Copy Markdown
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 centralizes ENSDb configuration typing and validation into @ensnode/ensdb-sdk, then updates ENSIndexer/ENSApi to consume that shared validation while removing duplicated app-local schemas and direct dependencies.

Changes:

  • Added EnsDbConfig + Zod validation (EnsDbConfigSchema, validateEnsDbConfig) to packages/ensdb-sdk.
  • Replaced app-local ENSDb config schema/validation in ENSIndexer and ENSApi with the SDK validator.
  • Updated dependencies/lockfile to move pg-connection-string/zod usage into ensdb-sdk and remove them from apps.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pnpm-lock.yaml Lockfile updates for dependency moves (notably Zod v4 usage and pg-connection-string relocation).
packages/ensdb-sdk/src/client/zod-schemas/ensdb-config.ts Introduces Zod schemas for ENSDb URL + schema name and config object.
packages/ensdb-sdk/src/client/validate/ensdb-config.ts Adds validateEnsDbConfig helper that throws formatted errors on invalid config.
packages/ensdb-sdk/src/client/index.ts Exposes new client exports (config type + validator).
packages/ensdb-sdk/src/client/ensdb-config.ts Adds EnsDbConfig interface to the SDK.
packages/ensdb-sdk/package.json Adds runtime deps (pg-connection-string, zod) required by the new validator/schemas.
apps/ensindexer/src/lib/subgraph/ids.test.ts Updates test setup to include ENSDb config mocking helper.
apps/ensindexer/src/lib/graphnode-helpers.test.ts Updates test setup to include ENSDb config mocking helper.
apps/ensindexer/src/lib/test/mockConfig.ts Adds setupEnsDbConfigMock helper for tests.
apps/ensindexer/src/config/ensdb-config.ts New ENSIndexer ENSDb config builder using validateEnsDbConfig.
apps/ensindexer/src/config/config.test.ts Mocks ENSDb config module and updates assertions to new error messages.
apps/ensindexer/src/config/config.schema.ts Removes ENSDb fields from schema and injects validated ENSDb config via transform.
apps/ensindexer/package.json Removes pg-connection-string from app deps (now provided via SDK).
apps/ensapi/src/lib/ensdb/singleton.ts Updates import path for ENSDb config builder.
apps/ensapi/src/config/ensdb-config.ts Replaces app-local schema with SDK validator + lazy default export.
apps/ensapi/src/config/ensdb-config.schema.ts Deletes old ENSApi-specific ENSDb config schema/validator module.
apps/ensapi/src/config/config.schema.ts Injects ENSDb config via transform instead of extending app-local schema.
apps/ensapi/src/config/config.schema.test.ts Mocks ENSDb config module to keep schema tests isolated from env.
apps/ensapi/package.json Removes pg-connection-string from app deps (now provided via SDK).
.changeset/fluffy-forks-film.md Declares a minor bump for @ensnode/ensdb-sdk due to new public validation API.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Copy link
Copy Markdown
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: 5

🤖 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/ensindexer/src/config/config.schema.ts`:
- Around line 99-106: The transform includeEnsDbConfig currently reads the
process-global ensDbConfig (default-exported from `@/config/ensdb-config`) causing
stale values; instead, inside buildConfigFromEnvironment(_env) validate and
build an ENSDb config from the provided _env (using the same logic as
buildEnsDbConfigFromEnvironment but with _env) and merge those fields into the
returned config (ensDbUrl and ensIndexerSchemaName) rather than referencing the
module-level ensDbConfig singleton; update buildConfigFromEnvironment to call
the ENSDb build/validation with the passed _env (checking _env.ENSDB_URL and
_env.ENSINDEXER_SCHEMA_NAME) and then spread those validated values into the
final config.

In `@apps/ensindexer/src/config/ensdb-config.ts`:
- Around line 9-22: The ENS config builder here is app-specific and
side-effectful; extract the pure builder into the SDK as
buildEnsDbConfig(ensDbUrl, ensIndexerSchemaName) that simply calls
validateEnsDbConfig({ensDbUrl, ensIndexerSchemaName}) and returns the validated
EnsDbConfig, then update buildEnsDbConfigFromEnvironment to only read env
(ENSDB_URL, ENSINDEXER_SCHEMA_NAME), call the new SDK buildEnsDbConfig, and keep
the try/catch that logs the error and exits; reference validateEnsDbConfig,
buildEnsDbConfig (new SDK export), and buildEnsDbConfigFromEnvironment to locate
and change the code.

In `@packages/ensdb-sdk/src/client/ensdb-config.ts`:
- Around line 5-8: Update the comment block that starts "PostgreSQL connection
string for ENSDb." to document both accepted URI schemes by stating that ENSDb
accepts either "postgresql://" or the shorter "postgres://" and show the
expected format (e.g., postgres[s]://username:password@host:port/database).
Modify the docstring text near that comment so consumers know both schemes are
supported by the shared validator.

In `@packages/ensdb-sdk/src/client/validate/ensdb-config.ts`:
- Around line 8-14: Remove the redundant JSDoc `@returns` tag from the "Validate
ENSDb config" comment block (the JSDoc above the function that validates ENSDb
config); keep the summary and the `@throws` line but delete the `@returns` line that
merely restates the summary so the JSDoc is concise and follows the guideline.

In `@packages/ensdb-sdk/src/client/zod-schemas/ensdb-config.ts`:
- Around line 22-29: The schema EnsIndexerSchemaNameSchema is currently
file-local; export it so downstream consumers can reuse it from the SDK. Modify
the declaration of EnsIndexerSchemaNameSchema to be an exported symbol (export
const EnsIndexerSchemaNameSchema) and ensure any other modules that import it
use the exported name; preserve the existing z.string().trim().nonempty(...)
validation and error messages when exporting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0d832320-c8a4-4026-9c59-8159cb4f56fe

📥 Commits

Reviewing files that changed from the base of the PR and between 9c5f68b and 3e8161f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/fluffy-forks-film.md
  • apps/ensapi/package.json
  • apps/ensapi/src/config/config.schema.test.ts
  • apps/ensapi/src/config/config.schema.ts
  • apps/ensapi/src/config/ensdb-config.schema.ts
  • apps/ensapi/src/config/ensdb-config.ts
  • apps/ensapi/src/lib/ensdb/singleton.ts
  • apps/ensindexer/package.json
  • apps/ensindexer/src/config/config.schema.ts
  • apps/ensindexer/src/config/config.test.ts
  • apps/ensindexer/src/config/ensdb-config.ts
  • apps/ensindexer/src/lib/__test__/mockConfig.ts
  • apps/ensindexer/src/lib/graphnode-helpers.test.ts
  • apps/ensindexer/src/lib/subgraph/ids.test.ts
  • packages/ensdb-sdk/package.json
  • packages/ensdb-sdk/src/client/ensdb-config.ts
  • packages/ensdb-sdk/src/client/index.ts
  • packages/ensdb-sdk/src/client/validate/ensdb-config.ts
  • packages/ensdb-sdk/src/client/zod-schemas/ensdb-config.ts
💤 Files with no reviewable changes (3)
  • apps/ensapi/package.json
  • apps/ensindexer/package.json
  • apps/ensapi/src/config/ensdb-config.schema.ts

@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Apr 3, 2026

@greptile review

Copy link
Copy Markdown
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: 2

🤖 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/ensindexer/src/config/types.ts`:
- Line 4: Import RpcConfig using a type-only import since it's only referenced
in JSDoc and not used at runtime: change the import line that currently brings
in RpcConfig and RpcConfigs to import RpcConfig with the `type` modifier (e.g.,
`type RpcConfig`) while keeping RpcConfigs as-is, ensuring JSDoc {`@link`
RpcConfig} still resolves but no runtime value is imported.

In `@packages/ensdb-sdk/src/client/ensdb-config.ts`:
- Around line 4-20: The interface EnsDbConfig currently documents invariants on
its fields ensDbUrl and ensIndexerSchemaName; extract those invariants into
dedicated type aliases (e.g., PostgresConnectionString and PostgresSchemaName)
with the exact documentation once, then update EnsDbConfig to use those aliases
for ensDbUrl and ensIndexerSchemaName respectively so the invariant docs live on
the type aliases rather than the interface properties.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f6e58d09-c1c8-4fc3-84a5-7452f49b16ec

📥 Commits

Reviewing files that changed from the base of the PR and between 3e8161f and 7aa8ce4.

📒 Files selected for processing (5)
  • apps/ensindexer/src/config/types.ts
  • packages/ensdb-sdk/src/client/ensdb-config.ts
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts
  • packages/ensnode-sdk/src/shared/config/types.ts
  • packages/ensnode-sdk/src/shared/config/zod-schemas.ts
💤 Files with no reviewable changes (2)
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts
  • packages/ensnode-sdk/src/shared/config/zod-schemas.ts

shrugs added 2 commits April 3, 2026 11:27
# Conflicts:
#	apps/ensindexer/src/lib/graphnode-helpers.test.ts
Copilot AI review requested due to automatic review settings April 3, 2026 16:48
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io April 3, 2026 16:48 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io April 3, 2026 16:48 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io April 3, 2026 16:48 Inactive
Copy link
Copy Markdown
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 23 out of 24 changed files in this pull request and generated 6 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts:33

  • The tests for makeEnsIndexerSchemaNameSchema parsing and its custom value-label error messages were removed, but makeEnsIndexerSchemaNameSchema is still used by makeEnsIndexerPublicConfigSchema / makeSerializedEnsIndexerPublicConfigSchema. Add a focused test case to keep coverage for schema-name validation and ensure error messages remain stable.
    describe("Parsing", () => {
      it("can parse a list of plugin name values", () => {
        expect(
          makePluginsListSchema().parse([
            `${PluginName.Subgraph}`,
            `${PluginName.Registrars}`,
            `${PluginName.ProtocolAcceleration}`,
          ]),
        ).toStrictEqual([
          PluginName.Subgraph,
          PluginName.Registrars,
          PluginName.ProtocolAcceleration,
        ]);

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

@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io April 3, 2026 16:53 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io April 3, 2026 16:53 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io April 3, 2026 16:53 Inactive
Copilot AI review requested due to automatic review settings April 3, 2026 16:55
@shrugs shrugs force-pushed the feat/1824-enhance-ensdb-sdk branch from cf4067a to d10db1f Compare April 3, 2026 16:55
@vercel vercel bot temporarily deployed to Preview – ensnode.io April 3, 2026 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io April 3, 2026 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io April 3, 2026 16:57 Inactive
@shrugs shrugs merged commit c336c79 into main Apr 3, 2026
17 checks passed
@shrugs shrugs deleted the feat/1824-enhance-ensdb-sdk branch April 3, 2026 17:00
Copy link
Copy Markdown
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 23 out of 24 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

apps/ensindexer/src/lib/subgraph/ids.test.ts:16

  • setupEnsDbConfigMock() / setupConfigMock() are called before later import statements in source order, but static ESM imports are evaluated before the module body runs. As a result, ./ids (which imports @/config) will be loaded before the mocks are registered, so the real config module can execute and read env/exit. To ensure the mocks apply, declare the needed vi.mock(...) calls at top-level in this test file (so Vitest can hoist them), or switch to dynamically importing ./ids after registering the mocks.
import {
  resetMockConfig,
  setupConfigMock,
  setupEnsDbConfigMock,
  updateMockConfig,
} from "@/lib/__test__/mockConfig";

// Setup mocks before any imports that depend on them
setupEnsDbConfigMock();
setupConfigMock();

import { labelhash, namehash, zeroAddress } from "viem";

import { makeEventId, makeRegistrationId, makeResolverId } from "./ids";

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

Comment on lines +5 to 11
import { setupConfigMock, setupEnsDbConfigMock } from "@/lib/__test__/mockConfig";
import "@/lib/__test__/mockLogger";

setupConfigMock(); // setup config mock before importing dependent modules
// Setup mocks before any imports that depend on them
setupEnsDbConfigMock();
setupConfigMock();

Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

Same issue as ids.test.ts: setupEnsDbConfigMock() / setupConfigMock() run in the module body, but import declarations (including ./graphnode-helpers) execute first. This can load modules that depend on @/config / @/config/ensdb-config before the mocks are active. Prefer top-level vi.mock(...) declarations (hoisted) or use dynamic await import(...) after registering mocks.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +5
---
"@ensnode/ensdb-sdk": minor
---

Added `validateEnsDbConfig` function to support validation for the `EnsDbConfig` data model.
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This changeset describes only adding validateEnsDbConfig, but the PR also introduces the EnsDbConfig data model and its schema. Consider updating the changeset text to mention the new EnsDbConfig export as part of the minor release so consumers understand what was added.

Copilot uses AI. Check for mistakes.
Comment on lines +58 to +66
export function setupEnsDbConfigMock() {
vi.mock("@/config/ensdb-config", async () => {
const { validateEnsDbConfig } =
await vi.importActual<typeof import("@ensnode/ensdb-sdk")>("@ensnode/ensdb-sdk");

// Default test values when env vars are not explicitly set
const defaultEnsDbUrl = "postgresql://postgres:postgres@localhost:5432/postgres";
const defaultEnsIndexerSchemaName = "ensindexer_0";

Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

setupEnsDbConfigMock() registers a mock for @/config/ensdb-config, but it can’t protect against modules that have already imported @/config/ensdb-config as a side effect of importing this mockConfig.ts module (e.g., via the module-scope _defaultMockConfig = buildConfigFromEnvironment(...)). If any test imports mockConfig.ts before calling this helper, the real ensdb-config module may already have run (and potentially process.exit(1)), making the mock ineffective. Consider restructuring the test utilities so no config-building happens at module scope, or ensure @/config/ensdb-config is mocked at top-level in each test file before importing mockConfig.ts.

Copilot uses AI. Check for mistakes.
Comment on lines +185 to +187
// include the validated ENSDb config values in the parsed EnsIndexerConfig
ensDbUrl: ensDbConfig.ensDbUrl,
ensIndexerSchemaName: ensDbConfig.ensIndexerSchemaName,
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This comment says “parsed EnsApiConfig” but this is the ENSIndexer config builder. Please rename to “parsed EnsIndexerConfig” (and similarly adjust any other EnsApi references) to avoid confusion.

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot mentioned this pull request Apr 3, 2026
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.

Consolidate ideas around building ENSDb Config into ENSDb SDK

3 participants