Conversation
Include relevant data model definitions for `EnsNodeMetadata`, `EnsDbClientQuery`, and `EnsDbClientMutation`.
Introduces validation function which allows checking compatibility between two instances of `EnsIndexerPublicConfig` type.
…g compatibility check between two instances of ENSIndexer public config.
Extends ENSNode Schemas definitions to make room for ENSNode metadata that will be written from ENSIndexer in order to be read from ENSDb clients, for example, ENSApi service.
🦋 Changeset detectedLatest commit: 07033c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📝 WalkthroughWalkthroughThis PR introduces the ENSDb module with metadata storage schema, client interfaces for querying and mutating ENSNode metadata, and compatibility validation for ENSIndexer public configurations. It defines strongly-typed representations for metadata records and exposes these through new barrel exports across multiple packages. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
tk-o
left a comment
There was a problem hiding this comment.
Self-review completed.
Greptile SummaryIntroduces ENSDb data model and ENSIndexer config compatibility checking. Creates new
Confidence Score: 5/5
Important Files Changed
Class Diagram%%{init: {'theme': 'neutral'}}%%
classDiagram
class EnsDbClientQuery {
<<interface>>
+getEnsDbVersion() Promise
+getEnsIndexerPublicConfig() Promise
+getIndexingStatusSnapshot() Promise
}
class EnsDbClientMutation {
<<interface>>
+upsertEnsDbVersion(string) Promise
+upsertEnsIndexerPublicConfig(config) Promise
+upsertIndexingStatusSnapshot(snapshot) Promise
}
class EnsNodeMetadata {
<<union>>
}
class EnsNodeMetadataEnsDbVersion {
+key: string
+value: string
}
class EnsNodeMetadataEnsIndexerPublicConfig {
+key: string
+value: EnsIndexerPublicConfig
}
class EnsNodeMetadataEnsIndexerIndexingStatus {
+key: string
+value: CrossChainIndexingStatusSnapshot
}
class EnsIndexerPublicConfig {
+namespace: ENSNamespaceId
+indexedChainIds: Set
+isSubgraphCompatible: boolean
+plugins: Array
+labelSet: Object
+databaseSchemaName: string
+versionInfo: Object
}
class ensNodeMetadataSchema {
+key: text PK
+value: jsonb
}
EnsNodeMetadata <|-- EnsNodeMetadataEnsDbVersion
EnsNodeMetadata <|-- EnsNodeMetadataEnsIndexerPublicConfig
EnsNodeMetadata <|-- EnsNodeMetadataEnsIndexerIndexingStatus
EnsNodeMetadataEnsIndexerPublicConfig --> EnsIndexerPublicConfig
EnsDbClientQuery --> EnsIndexerPublicConfig
EnsDbClientMutation --> EnsIndexerPublicConfig
ensNodeMetadataSchema ..> EnsNodeMetadata : stores
Last reviewed commit: 07033c5 |
There was a problem hiding this comment.
Pull request overview
This PR creates foundational data model infrastructure for persisting ENSNode metadata to ENSDb. It introduces a new ensdb module in the ENSNode SDK with TypeScript interfaces for ENSDb client interactions, adds ENSIndexer configuration compatibility validation, and defines a new database schema for storing ENSNode metadata. This work is preparatory for issue #1252, which aims to enable ENSApi to survive ENSIndexer crashes by storing indexing status and configuration in the database.
Changes:
- Added ENSDb client interface definitions for reading/writing ENSNode metadata (ENSDb version, ENSIndexer config, indexing status)
- Implemented ENSIndexer config compatibility validation with subset semantics for safe configuration updates
- Created
ensnode_metadataschema table using key-value pattern with JSONB storage
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
packages/ensnode-sdk/src/ensdb/client.ts |
Defines TypeScript interfaces for ENSDb client query and mutation operations |
packages/ensnode-sdk/src/ensdb/ensnode-metadata.ts |
Defines discriminated union types for type-safe metadata storage |
packages/ensnode-sdk/src/ensdb/serialize/ensnode-metadata.ts |
Defines serialized representations of metadata types for database storage |
packages/ensnode-sdk/src/ensdb/index.ts |
Exports ensdb module types |
packages/ensnode-sdk/src/ensindexer/config/compatibility.ts |
Implements config compatibility validation enforcing subset semantics |
packages/ensnode-sdk/src/ensindexer/config/compatibility.test.ts |
Tests for config compatibility validation logic |
packages/ensnode-sdk/src/ensindexer/config/index.ts |
Exports compatibility validation |
packages/ensnode-sdk/src/index.ts |
Adds ensdb module to SDK exports |
packages/ensnode-sdk/src/indexing-status/index.ts |
Exports cross-chain indexing status serialization |
packages/ensnode-schema/src/schemas/ensnode-metadata.schema.ts |
Defines ensnode_metadata table schema with key-value JSONB pattern |
packages/ensnode-schema/src/ponder.schema.ts |
Exports new ensnode-metadata schema |
.changeset/short-buttons-burn.md |
Documents schema package changes |
.changeset/itchy-clubs-repeat.md |
Documents ENSIndexer compatibility feature |
.changeset/fresh-adults-decide.md |
Documents ENSDb module addition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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/ensnode-sdk/src/ensdb/client.ts`:
- Around line 6-10: The JSDoc comment block for the ENSDb client header ("ENSDb
Client Query") is malformed because one line in the block is missing the leading
" * " prefix; update the top JSDoc block so every interior line begins with " *
" (e.g., ensure the line containing "Includes methods for reading from ENSDb."
is prefixed with " * ") to produce a well-formed JSDoc comment for the ENSDb
client (client.ts) header.
- Around line 1-4: Change the type import in client.ts to a relative import to
avoid a package-level circular dependency: replace the package self-reference
import of CrossChainIndexingStatusSnapshot and EnsIndexerPublicConfig from
"@ensnode/ensnode-sdk" with a relative path to the local module that exports
those types (e.g., import type { CrossChainIndexingStatusSnapshot,
EnsIndexerPublicConfig } from "./index" or the same relative path used in
ensnode-metadata.ts) so client.ts no longer references the package root.
In `@packages/ensnode-sdk/src/ensdb/ensnode-metadata.ts`:
- Around line 7-11: Rename the property EnsNodeMetadataKeys.IndexingStatus to
EnsIndexerIndexingStatus to match the existing prefix convention used by
EnsDbVersion and EnsIndexerPublicConfig; update the object key name in
EnsNodeMetadataKeys and then update all code references (including any
interfaces like EnsNodeMetadataEnsIndexerIndexingStatus and any serialized-types
files that use key: typeof EnsNodeMetadataKeys.IndexingStatus) to use
EnsNodeMetadataKeys.EnsIndexerIndexingStatus while keeping the string value
"ensindexer_indexing_status" unchanged.
In `@packages/ensnode-sdk/src/ensdb/serialize/ensnode-metadata.ts`:
- Around line 3-9: The import list at the top currently brings in
EnsNodeMetadata without the TypeScript-only modifier; change the import to `type
EnsNodeMetadata` to match the other imports (e.g., `type
EnsNodeMetadataEnsDbVersion`, `type EnsNodeMetadataKeys`) so it is a type-only
import; update the import statement that contains EnsNodeMetadata and ensure
references (including the JSDoc usage around line 33) remain valid under
`verbatimModuleSyntax`/`isolatedModules`.
In `@packages/ensnode-sdk/src/ensindexer/config/compatibility.test.ts`:
- Around line 20-30: Add a new test that uses structuredClone(config) to create
configA and configB with identical contents (no changes to indexedChainIds or
plugins) and asserts that calling
validateEnsIndexerPublicConfigCompatibility(configA, configB) does not throw;
reference the existing test setup using config, configA, configB,
PluginName.Lineanames, and indexedChainIds so the new test mirrors the
happy-path but with exact-match instead of a superset.
In `@packages/ensnode-sdk/src/ensindexer/config/compatibility.ts`:
- Around line 14-62: The validator validateEnsIndexerPublicConfigCompatibility
currently throws on the first mismatch; update it to accumulate all
incompatibility messages (e.g., collect into an array like errors) while
checking indexedChainIds (configAIndexedChainIds/configBIndexedChainIds),
isSubgraphCompatible, namespace, and plugins, and after all checks, if
errors.length > 0 throw a single Error joining those messages so callers see all
failures at once; keep the same descriptive message fragments for each check but
push them into the errors array instead of throwing immediately.
- Around line 18-23: The subset check converts configB.indexedChainIds to an
array and uses .includes(), which is unnecessary and inefficient; replace the
Array.from + .includes() pattern by using Set.has() directly against
configB.indexedChainIds (e.g. change the check that iterates
configA.indexedChainIds to call configB.indexedChainIds.has(configAChainId)),
and remove the temporary configBIndexedChainIds array so lookups are O(1) and
more idiomatic.
|
@greptile review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@greptile review |
Lite PR
Tip: Review docs on the ENSNode PR process
Summary
ensdbmodule in ENSNode SDK. The module includes data model describing ENSDb client interactions and ENSNode metadata vartiants to be stored in ENSDb.ensindexermodule in ENSNode SDK with functionality to perform compatibility check between two instances of ENSIndexer public config.Why
Testing
Notes for Reviewer (Optional)
packages/ensnode-sdk/src/ensindexer/config/compatibility.tsfile.Pre-Review Checklist (Blocking)