Skip to content

Comments

ENSv2 API: Introduce Domain.subdomains#1658

Open
shrugs wants to merge 2 commits intomainfrom
feat/domain-subdomains
Open

ENSv2 API: Introduce Domain.subdomains#1658
shrugs wants to merge 2 commits intomainfrom
feat/domain-subdomains

Conversation

@shrugs
Copy link
Collaborator

@shrugs shrugs commented Feb 20, 2026

#1582

Summary

  • added Domain.subdomains abstraction for downward traversal of the namegraph

Why

  • makes it easier for ENS team to render views without needing to select type-specific fragments

Testing

  • manual

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)

…r traversal of the unified ENSv1/ENSv2 namegraph without needing to select a type-specific fragment.
Copilot AI review requested due to automatic review settings February 20, 2026 21:50
@shrugs shrugs requested a review from a team as a code owner February 20, 2026 21:50
@vercel
Copy link
Contributor

vercel bot commented Feb 20, 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 Feb 20, 2026 9:50pm
ensnode.io Ready Ready Preview, Comment Feb 20, 2026 9:50pm
ensrainbow.io Ready Ready Preview, Comment Feb 20, 2026 9:50pm

@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: 76b66dd

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
ensindexer Major
ensadmin Major
ensrainbow Major
fallback-ensapi Major
@ensnode/datasources Major
@ensnode/ensrainbow-sdk Major
@ensnode/ponder-metadata Major
@ensnode/ensnode-schema 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

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

A new subdomains Relay connection field was added to the Domain GraphQL schema, enabling unified traversal of ENSv1 and ENSv2 subdomains. The resolver implements type-specific logic: ENSv1 queries v1Domain by parentId, while ENSv2 queries v2Domain by registryId with cursor-based pagination support.

Changes

Cohort / File(s) Summary
Changeset
.changeset/seven-cows-call.md
New changeset documenting a minor version bump for ensapi with the addition of Domain.subdomains field.
Domain Schema
apps/ensapi/src/graphql-api/schema/domain.ts
Added subdomains Relay connection field to DomainInterfaceRef with conditional resolver logic: ENSv1Domain queries by parentId, ENSv2Domain queries by registryId (or returns empty list if subregistryId is null). Removed a documentation comment.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A rabbit hops through domains deep,
Now subdomains are mine to keep!
ENSv1, v2—no need to fret,
One path to traverse the namegraph yet! 🌳

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: introducing a new Domain.subdomains field to the ENSv2 GraphQL API.
Description check ✅ Passed The description follows the template structure with Summary, Why, Testing, and Pre-Review Checklist sections all completed with relevant information.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/domain-subdomains

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.

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 a unified Domain.subdomains field to the GraphQL API, providing a single interface-level abstraction for traversing both ENSv1 and ENSv2 domain hierarchies without requiring type-specific fragments.

Changes:

  • Added Domain.subdomains connection field that handles both v1 (parent-child) and v2 (registry-based) domain relationships
  • Removed an unrelated TODO comment about partial names

Reviewed changes

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

File Description
apps/ensapi/src/graphql-api/schema/domain.ts Adds Domain.subdomains connection with proper v1/v2 traversal logic and removes obsolete TODO comment
.changeset/seven-cows-call.md Documents the new feature as a minor version bump

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

Copy link

@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 `@apps/ensapi/src/graphql-api/schema/domain.ts`:
- Around line 213-250: The ENSv1 query logic in Domain.subdomains and
ENSv1Domain.children is duplicated; extract a helper (e.g., findV1ChildDomains)
that encapsulates the db.query.v1Domain.findMany call and cursor decoding (use
cursors.decode<ENSv1DomainId>), accepting the parent id and cursor args
({before, after, limit, inverted}) and returning the result, then replace the
duplicated blocks in Domain.subdomains (ENSv1 branch) and ENSv1Domain.children
to call findV1ChildDomains(parent.id, cursorArgs) so both resolvers delegate to
the single implementation.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 20, 2026

Greptile Summary

Added Domain.subdomains connection field to the GraphQL API that provides unified access to child domains across both ENSv1 and ENSv2 implementations.

  • Implements type-specific logic: ENSv1 domains query by parentId, ENSv2 domains query by subregistryId
  • Returns empty array for ENSv2 domains without a subregistry (subregistryId is null)
  • Follows established patterns from ENSv1Domain.children and Registry.domains implementations
  • Includes proper cursor-based pagination with before, after, limit, and inverted support
  • Properly loads label data with with: { label: true } for both domain types
  • Description field is marked as "TODO" and should be updated before merge

Confidence Score: 4/5

  • Safe to merge with minor documentation improvement recommended
  • The implementation correctly mirrors existing patterns (ENSv1Domain.children and Registry.domains), properly handles both domain types, includes appropriate null checks for ENSv2 domains without subregistries, and follows the established cursor pagination pattern. The only issue is a missing description field marked as "TODO".
  • No files require special attention - the domain.ts changes follow established patterns and the TODO description is a minor cosmetic issue

Important Files Changed

Filename Overview
.changeset/seven-cows-call.md Added changeset for Domain.subdomains feature - properly documents the minor version bump
apps/ensapi/src/graphql-api/schema/domain.ts Added Domain.subdomains connection to unify ENSv1/v2 subdomain traversal - implementation follows existing patterns but missing description

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Domain.subdomains Query] --> B{Check Domain Type}
    B -->|ENSv1Domain| C[Query v1Domain.findMany]
    B -->|ENSv2Domain| D{Has subregistryId?}
    D -->|null| E[Return empty array]
    D -->|exists| F[Query v2Domain.findMany]
    C --> G[Filter by parentId]
    F --> H[Filter by registryId = subregistryId]
    G --> I[Apply cursor pagination]
    H --> I
    I --> J[Return unified Domain connection]
Loading

Last reviewed commit: 76b66dd

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

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.

1 participant