Skip to content

ENSDb SDK enhancements#1837

Closed
tk-o wants to merge 12 commits intomainfrom
feat/1833-ensdb-sdk-enhancements
Closed

ENSDb SDK enhancements#1837
tk-o wants to merge 12 commits intomainfrom
feat/1833-ensdb-sdk-enhancements

Conversation

@tk-o
Copy link
Copy Markdown
Contributor

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

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • Created EnsDbPublicConfig data model in ENSNode SDK.
  • Created ENSDB_ROOT_SCHEMA_VERSION const shared from ENSDb SDK.
  • Introduced the idea of "ENSDb Root Schema" to reference the schema definition that consists of the "abstract" ENSIndexer Schema definition and ENSNode Schema definition.
  • Added getEnsDbPublicConfig() method on EnsDbReader class.
  • Extended EnsApiPublicConfig data model with ensDbPublicConfig field.
  • Added ensApiPublicConfig field to response data model for /api/config route.

Why

  • We need to present the following ENSDb version info in ENSAdmin:
    • Postrges version
    • ENSDb Root Schema version
  • We want to enable ENSDb consumers to be able to work with given ENSDb instance based on the version of the "ENSDb Root Schema". I imagine that the version could be maintained following semantic versioning, so many clients could continue using the evergreen "ENSDb Root Schema".

Testing

  • Ran static code checks and testing suite.
  • Ran a local instance of ENSApi and observe how http://localhost:4334/api/config response includes the correct ensDbPublicConfig field.
"ensDbPublicConfig": {
    "postgresVersion": "17.4",
    "rootSchemaVersion": "1.0.0"
  },

Notes for Reviewer (Optional)


Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
    • I groupped updates in multiple commits, hope that allows for a quick review 👍
  • Relevant changesets are included (or are not required)

Copilot AI review requested due to automatic review settings March 26, 2026 16:00
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 26, 2026

🦋 Changeset detected

Latest commit: 332848b

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

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

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a5ff5f9a-b4e5-424c-b3ce-2a69a2c3a7c7

📥 Commits

Reviewing files that changed from the base of the PR and between 96ebaca and 332848b.

📒 Files selected for processing (2)
  • .changeset/dry-trams-brush.md
  • docs/docs.ensnode.io/ensapi-openapi.json

📝 Walkthrough

Walkthrough

Introduces EnsDbPublicConfig to decouple ENSDb version tracking from ENSApi/ENSIndexer versions. Adds new type, validation schema, and a getEnsDbPublicConfig() method to EnsDbReader that queries PostgreSQL server version. Integrates this config into ENSApi's public config response pipeline and updates all related tests and API documentation.

Changes

Cohort / File(s) Summary
EnsDbPublicConfig Type Definition
packages/ensnode-sdk/src/ensdb/ensdb-public-config.ts
New interface defining postgresVersion and rootSchemaVersion string properties.
EnsDbPublicConfig Validation
packages/ensnode-sdk/src/ensdb/zod-schemas/ensdb-public-config.ts, packages/ensnode-sdk/src/ensdb/validate/ensdb-public-config.ts
Zod schema with min-length constraints and validation function to parse and validate EnsDbPublicConfig instances.
EnsDbPublicConfig Exports
packages/ensnode-sdk/src/ensdb/index.ts, packages/ensnode-sdk/src/index.ts, packages/ensnode-sdk/src/internal.ts
Added re-exports to make EnsDbPublicConfig, validation, and schemas publicly available through SDK entrypoints.
ENSDb Root Schema Version
packages/ensdb-sdk/src/config/index.ts, packages/ensdb-sdk/src/index.ts
Added ENSDB_ROOT_SCHEMA_VERSION constant ("1.0.0") and re-exported from config module.
EnsDbReader Enhancement
packages/ensdb-sdk/src/client/ensdb-reader.ts
Added getEnsDbPublicConfig() method that fetches PostgreSQL version via new private getPgVersion() helper and returns validated config.
EnsDbReader Schema Rename
packages/ensdb-sdk/src/lib/drizzle.ts
Renamed internal buildEnsDbSchema to buildEnsDbRootSchema and related local variables for clarity.
ENSApi Config Schema Integration
apps/ensapi/src/config/config.schema.ts
Extended EnsApiConfigSchema to include ensDbPublicConfig field; updated buildConfigFromEnvironment and buildEnsApiPublicConfig to fetch and propagate the config.
ENSApi Config Types
packages/ensnode-sdk/src/ensapi/config/types.ts
Updated EnsApiPublicConfig to include ensDbPublicConfig property of type EnsDbPublicConfig.
ENSApi Config Schema & Validation
packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts
Extended both runtime and serialized config Zod schemas to validate new ensDbPublicConfig field.
ENSApi Config Serialization
packages/ensnode-sdk/src/ensapi/config/serialize.ts
Updated serializeEnsApiPublicConfig to include ensDbPublicConfig in serialized output.
Test Updates
apps/ensapi/src/config/config.schema.test.ts, packages/ensdb-sdk/src/client/ensdb-reader.test.ts, packages/ensnode-sdk/src/ensapi/client.test.ts, packages/ensnode-sdk/src/ensapi/config/conversions.test.ts
Added test coverage for getEnsDbPublicConfig() method, mocked PostgreSQL version queries, and updated config fixtures to include ensDbPublicConfig.
API Documentation
docs/docs.ensnode.io/ensapi-openapi.json
Updated /api/config response schema to include required ensDbPublicConfig object with versioning fields.
Changeset Declarations
.changeset/heavy-laws-sing.md, .changeset/social-dryers-find.md, .changeset/dry-trams-brush.md
Three changelists marking minor version bumps for @ensnode/ensnode-sdk, @ensnode/ensdb-sdk, and ensapi packages.

Sequence Diagram

sequenceDiagram
    participant Client as Client
    participant ENSApi as ENSApi Server
    participant ConfigSchema as Config Schema
    participant EnsDbReader as EnsDbReader
    participant PostgreSQL as PostgreSQL Database

    Client->>ENSApi: GET /api/config
    ENSApi->>ConfigSchema: buildEnsApiPublicConfig()
    ConfigSchema->>EnsDbReader: getEnsDbPublicConfig()
    EnsDbReader->>PostgreSQL: SELECT current_setting('server_version')
    PostgreSQL-->>EnsDbReader: server_version string
    EnsDbReader->>EnsDbReader: validateEnsDbPublicConfig()<br/>(postgresVersion + ENSDB_ROOT_SCHEMA_VERSION)
    EnsDbReader-->>ConfigSchema: EnsDbPublicConfig
    ConfigSchema->>ConfigSchema: merge into EnsApiPublicConfig
    ConfigSchema-->>ENSApi: EnsApiPublicConfig (with ensDbPublicConfig)
    ENSApi-->>Client: JSON response with ensDbPublicConfig
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

ensnode-sdk

Poem

🐰 A database whispers its version true,
PostgreSQL secrets we now pursue!
ENSDb versioning stands on its own,
No longer bound to the API throne—
Independent roots now strongly grown! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'ENSDb SDK enhancements' clearly summarizes the main changes introducing new ENSDb features like EnsDbPublicConfig and related enhancements.
Description check ✅ Passed The PR description follows the template structure with all major sections filled: Summary (6 bullet points), Why (motivation linked to #1833), Testing (static checks and manual verification), Notes, and Pre-Review Checklist.
Linked Issues check ✅ Passed All objectives from #1833 are met: ENSDB_ROOT_SCHEMA_VERSION constant created, version decoupled from ENSIndexer, EnsDbPublicConfig introduced with rootSchemaVersion allowing clients to adapt based on stable schema versions.
Out of Scope Changes check ✅ Passed All changes are directly scoped to introducing ENSDb versioning (EnsDbPublicConfig, ENSDB_ROOT_SCHEMA_VERSION, getEnsDbPublicConfig method) and integrating it into EnsApi config response, with no unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% 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/1833-ensdb-sdk-enhancements

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.

@tk-o tk-o changed the title Feat/1833 ensdb sdk enhancements ENSDb SDK enhancements Mar 26, 2026
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 26, 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 Mar 26, 2026 4:40pm
ensnode.io Skipped Skipped Mar 26, 2026 4:40pm
ensrainbow.io Skipped Skipped Mar 26, 2026 4:40pm

@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Mar 26, 2026

@greptile review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 26, 2026

Greptile Summary

This PR introduces EnsDbPublicConfig — a new data model surfacing PostgreSQL version and ENSDb Root Schema version — and propagates it from the database layer through the ENSDb SDK, ENSNode SDK, and ENSApi /api/config response. All three packages receive appropriate minor changeset entries, and all previously raised concerns (missing @ensnode/ensdb-sdk changeset, hardcoded ENSINDEXER_SCHEMA_NAME in the dev script, literal version string in the test) appear to have been resolved in this revision.\n\n- New EnsDbPublicConfig interface (postgresVersion, rootSchemaVersion) in @ensnode/ensnode-sdk with a Zod schema and validator following existing codebase patterns.\n- New ENSDB_ROOT_SCHEMA_VERSION = "1.0.0" constant in @ensnode/ensdb-sdk/config with clear JSDoc describing what "Root Schema" encompasses.\n- EnsDbReader.getEnsDbPublicConfig() queries current_setting('server_version') via raw SQL, parses the leading version token, and validates the result before returning.\n- buildConfigFromEnvironment in ENSApi fetches the config at startup without retry (reasonable since DB connectivity is already confirmed by the prior pRetry on getEnsIndexerPublicConfig), acknowledged with a TODO referencing issue #1806.\n- EnsApiPublicConfig and its Zod schemas, serializer, OpenAPI spec, and tests are all consistently updated to include ensDbPublicConfig as a required field.

Confidence Score: 5/5

Safe to merge — all layers are consistent, tests cover the happy and error paths, and previously raised concerns are resolved.

The implementation is clean, follows established patterns, is well-tested, and has no logic bugs. All three packages have changesets. The only prior concerns (missing ensdb-sdk changeset, literal version string in test, dev-script env override) are addressed in this revision. The one acknowledged gap (no pRetry on getEnsDbPublicConfig) is deliberately deferred with a TODO and is low-risk because the DB connection is already proven by the prior retry loop.

No files require special attention.

Important Files Changed

Filename Overview
packages/ensdb-sdk/src/client/ensdb-reader.ts Adds getEnsDbPublicConfig() and private getPgVersion() methods; queries PostgreSQL via current_setting('server_version'), parses the major.minor token, and validates via the shared Zod schema before returning.
packages/ensdb-sdk/src/client/ensdb-reader.test.ts Extends test suite with three cases for getEnsDbPublicConfig (happy path, non-string type, empty string) and four getter unit tests; correctly uses ENSDB_ROOT_SCHEMA_VERSION constant (previous concern addressed).
packages/ensnode-sdk/src/ensdb/ensdb-public-config.ts New EnsDbPublicConfig interface with postgresVersion and rootSchemaVersion string fields, clean and well-documented.
packages/ensnode-sdk/src/ensdb/validate/ensdb-public-config.ts New validateEnsDbPublicConfig function using safeParse and prettifyError for clear error messages; follows the same pattern as other validators in the codebase.
packages/ensnode-sdk/src/ensdb/zod-schemas/ensdb-public-config.ts Simple Zod schema requiring non-empty strings for both postgresVersion and rootSchemaVersion.
apps/ensapi/src/config/config.schema.ts Fetches ensDbPublicConfig at startup (no retry, but reasonable since DB connectivity is already confirmed by the prior pRetry for getEnsIndexerPublicConfig) and includes it in both the validated config schema and the public config builder.
packages/ensdb-sdk/src/config/index.ts New file exporting ENSDB_ROOT_SCHEMA_VERSION = '1.0.0' with clear JSDoc explaining what the root schema encompasses.
packages/ensnode-sdk/src/ensapi/config/types.ts Extends EnsApiPublicConfig interface with the required ensDbPublicConfig: EnsDbPublicConfig field, well-documented.
docs/docs.ensnode.io/ensapi-openapi.json OpenAPI spec updated to include ensDbPublicConfig object with postgresVersion and rootSchemaVersion string properties (both minLength: 1), and adds it to the required array — consistent with the Zod schema.
.changeset/social-dryers-find.md Adds minor changeset for @ensnode/ensdb-sdk covering the new getEnsDbPublicConfig method (previously flagged concern is now resolved).

Sequence Diagram

sequenceDiagram
    participant ENSApi as ENSApi
    participant ConfigSchema as Config Builder
    participant EnsDbReader as EnsDbReader
    participant PG as PostgreSQL

    ENSApi->>ConfigSchema: buildConfigFromEnvironment
    ConfigSchema->>EnsDbReader: getEnsIndexerPublicConfig with pRetry
    EnsDbReader->>PG: query metadata table
    PG-->>EnsDbReader: config row
    EnsDbReader-->>ConfigSchema: EnsIndexerPublicConfig

    ConfigSchema->>EnsDbReader: getEnsDbPublicConfig
    EnsDbReader->>PG: SELECT current_setting server version
    PG-->>EnsDbReader: version string
    EnsDbReader->>EnsDbReader: parse and validate
    EnsDbReader-->>ConfigSchema: EnsDbPublicConfig

    ConfigSchema-->>ENSApi: EnsApiConfig

    Note over ENSApi: GET /api/config request
    ENSApi->>ConfigSchema: buildEnsApiPublicConfig
    ConfigSchema-->>ENSApi: EnsApiPublicConfig with ensDbPublicConfig field
Loading

Reviews (3): Last reviewed commit: "Update OpenAPI spec for `/api/config` ro..." | 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

Adds an ENSDb “public config” surface and wires it into ENSApi’s public config so downstream consumers (e.g., ENSAdmin) can display Postgres + ENSDb root schema version information.

Changes:

  • Introduced EnsDbPublicConfig model + validation in @ensnode/ensnode-sdk, and embedded it into EnsApiPublicConfig (including serialization + tests).
  • Added ENSDB_ROOT_SCHEMA_VERSION to @ensnode/ensdb-sdk and implemented EnsDbReader.getEnsDbPublicConfig() (with unit tests).
  • Updated ENSApi config building to fetch and include ensDbPublicConfig.

Reviewed changes

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

Show a summary per file
File Description
packages/ensnode-sdk/src/internal.ts Re-exports ENSDb public config zod schema via the internal entrypoint.
packages/ensnode-sdk/src/index.ts Exposes the new ensdb module from the SDK top-level.
packages/ensnode-sdk/src/ensdb/zod-schemas/ensdb-public-config.ts Adds zod schema for ENSDb public config.
packages/ensnode-sdk/src/ensdb/validate/ensdb-public-config.ts Adds runtime validation helper for ENSDb public config.
packages/ensnode-sdk/src/ensdb/index.ts Barrel export for the new ENSDb public config domain model + validator.
packages/ensnode-sdk/src/ensdb/ensdb-public-config.ts Defines the EnsDbPublicConfig interface.
packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts Extends ENSApi public config schemas to include ensDbPublicConfig.
packages/ensnode-sdk/src/ensapi/config/types.ts Extends EnsApiPublicConfig type with ensDbPublicConfig.
packages/ensnode-sdk/src/ensapi/config/serialize.ts Includes ensDbPublicConfig in serialization output.
packages/ensnode-sdk/src/ensapi/config/conversions.test.ts Updates config serialization/deserialization tests for new field.
packages/ensnode-sdk/src/ensapi/client.test.ts Updates client config-response fixture for new field.
packages/ensdb-sdk/src/lib/drizzle.ts Renames internal schema builder to “root schema” for clarity.
packages/ensdb-sdk/src/index.ts Exports the new config module from the package entrypoint.
packages/ensdb-sdk/src/config/index.ts Introduces ENSDB_ROOT_SCHEMA_VERSION constant.
packages/ensdb-sdk/src/client/ensdb-reader.ts Adds getEnsDbPublicConfig() and a Postgres version query helper.
packages/ensdb-sdk/src/client/ensdb-reader.test.ts Adds unit tests for getEnsDbPublicConfig() (mocking execute).
apps/ensapi/src/config/config.schema.ts Fetches ensDbPublicConfig during startup and includes it in public config.
apps/ensapi/src/config/config.schema.test.ts Updates config-building tests to include ensDbPublicConfig.
apps/ensapi/package.json Changes dev script to set ENSINDEXER_SCHEMA_NAME.
.changeset/heavy-laws-sing.md Adds a changeset for the new SDK data model.
Comments suppressed due to low confidence (1)

packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts:48

  • Same backwards-compatibility concern as above: the serialized public config schema also requires ensDbPublicConfig, so older ENSApi responses will fail validation. Consider making it optional or version-gating the schema.
  return z.object({
    version: z.string().min(1, `${label}.version must be a non-empty string`),
    theGraphFallback: TheGraphFallbackSchema,
    ensDbPublicConfig: schemaEnsDbPublicConfig,
    ensIndexerPublicConfig: makeSerializedEnsIndexerPublicConfigSchema(
      `${label}.ensIndexerPublicConfig`,
    ),
  });

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

Comment on lines 23 to 28
return z.object({
version: z.string().min(1, `${label}.version must be a non-empty string`),
theGraphFallback: TheGraphFallbackSchema,
ensDbPublicConfig: schemaEnsDbPublicConfig,
ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`),
});
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

ensDbPublicConfig is added as a required field in the public config schema. This will cause deserializeEnsApiPublicConfig() to reject responses from older ENSApi servers that don't include this field, which can break SDK users talking to older deployments. Consider making this field optional (and/or providing a default) for backwards compatibility, or bump the SDK major version if strictness is intended.

Copilot uses AI. Check for mistakes.
@tk-o tk-o force-pushed the feat/1833-ensdb-sdk-enhancements branch from 8ad6501 to 5f34c2c Compare March 26, 2026 16:28
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: 1

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

Inline comments:
In `@packages/ensdb-sdk/src/lib/drizzle.ts`:
- Around line 122-131: The JSDoc for buildEnsDbRootSchema contains a redundant
`@returns` line that repeats the summary; remove the `@returns` tag (or its text) so
the docblock only documents anything new beyond the one-line summary. Locate the
JSDoc immediately above the buildEnsDbRootSchema function and delete the
redundant "@returns The ENSDb Root Schema definition for use in building a
Drizzle client for ENSDb." entry, leaving any necessary param/type tags intact.
🪄 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: c456a169-af79-450e-ba0b-06b5b94cc3c9

📥 Commits

Reviewing files that changed from the base of the PR and between 3d212e8 and 96ebaca.

📒 Files selected for processing (21)
  • .changeset/heavy-laws-sing.md
  • .changeset/social-dryers-find.md
  • apps/ensapi/package.json
  • apps/ensapi/src/config/config.schema.test.ts
  • apps/ensapi/src/config/config.schema.ts
  • packages/ensdb-sdk/src/client/ensdb-reader.test.ts
  • packages/ensdb-sdk/src/client/ensdb-reader.ts
  • packages/ensdb-sdk/src/config/index.ts
  • packages/ensdb-sdk/src/index.ts
  • packages/ensdb-sdk/src/lib/drizzle.ts
  • packages/ensnode-sdk/src/ensapi/client.test.ts
  • packages/ensnode-sdk/src/ensapi/config/conversions.test.ts
  • packages/ensnode-sdk/src/ensapi/config/serialize.ts
  • packages/ensnode-sdk/src/ensapi/config/types.ts
  • packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts
  • packages/ensnode-sdk/src/ensdb/ensdb-public-config.ts
  • packages/ensnode-sdk/src/ensdb/index.ts
  • packages/ensnode-sdk/src/ensdb/validate/ensdb-public-config.ts
  • packages/ensnode-sdk/src/ensdb/zod-schemas/ensdb-public-config.ts
  • packages/ensnode-sdk/src/index.ts
  • packages/ensnode-sdk/src/internal.ts

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 22 out of 22 changed files in this pull request and generated 1 comment.


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

@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Mar 26, 2026

@greptile review

@vercel vercel bot temporarily deployed to Preview – ensrainbow.io March 26, 2026 16:40 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io March 26, 2026 16:40 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io March 26, 2026 16:40 Inactive
@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Mar 26, 2026

@greptile review

@tk-o tk-o marked this pull request as ready for review March 26, 2026 16:43
@tk-o tk-o requested a review from a team as a code owner March 26, 2026 16:43
Copilot AI review requested due to automatic review settings March 26, 2026 16:43
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 22 out of 22 changed files in this pull request and generated 1 comment.


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

Comment on lines +136 to +137
const postgresVersion = await this.getPgVersion();
const rootSchemaVersion = ENSDB_ROOT_SCHEMA_VERSION;
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

getEnsDbPublicConfig() sets rootSchemaVersion from the SDK constant ENSDB_ROOT_SCHEMA_VERSION, which means the reported value reflects the client library version, not necessarily the connected ENSDb instance’s schema version. If ENSApi and ENSIndexer (or migrations) are out of sync, this can silently misreport the DB’s actual root schema version.

Consider sourcing rootSchemaVersion from the DB (e.g., the existing ensnode.metadata ensdb_version via getEnsDbVersion() or a new dedicated metadata key), and optionally comparing it against ENSDB_ROOT_SCHEMA_VERSION to detect incompatibilities.

Suggested change
const postgresVersion = await this.getPgVersion();
const rootSchemaVersion = ENSDB_ROOT_SCHEMA_VERSION;
const [postgresVersion, dbRootSchemaVersion] = await Promise.all([
this.getPgVersion(),
this.getEnsDbVersion(),
]);
const rootSchemaVersion = dbRootSchemaVersion ?? ENSDB_ROOT_SCHEMA_VERSION;

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,6 @@
import { z } from "zod/v4";

export const schemaEnsDbPublicConfig = z.object({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: schema should start with capital letter, suggest to rename it to EnsDbPublicConfigSchema

@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Mar 30, 2026

Requirements for issue #1833 have changed, so this PR won't be merged.

@tk-o tk-o closed this Mar 30, 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.

ENSDb Schema Versioning

3 participants