Skip to content

docs: extend ENS Unigraph examples#2264

Merged
tk-o merged 15 commits into
mainfrom
docs/extend-ens-unigraph-examples
Jun 10, 2026
Merged

docs: extend ENS Unigraph examples#2264
tk-o merged 15 commits into
mainfrom
docs/extend-ens-unigraph-examples

Conversation

@tk-o

@tk-o tk-o commented Jun 5, 2026

Copy link
Copy Markdown
Member

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • Created "Core concepts" page for the ENS Unigraph
  • Refactored ENS Unigraph examples
    • Split code snippets and results into separate files to enable simpler structure of the example pages (simple import and passing props to the actual UI component displaying rich preview of the given example).
  • Added multiple examples presenting various capabilities of the ENS Unigraph indexed data model.

Why

  • There were just a few examples, and we want to demonstrate more use cases for the ENS Unigraph.

Testing

  • All queries (both SQL and SDK forms) were tested with a local ENSApi instance to ensure completeness and correctness.

Notes for Reviewer (Optional)

  • Anything non-obvious or worth a heads-up.

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 tk-o requested a review from a team as a code owner June 5, 2026 15:16
Copilot AI review requested due to automatic review settings June 5, 2026 15:16
@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c9cef02

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
enskit-react-example.ensnode.io Ready Ready Preview, Comment Jun 9, 2026 4:25pm
ensnode.io Ready Ready Preview, Comment Jun 9, 2026 4:25pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
admin.ensnode.io Skipped Skipped Jun 9, 2026 4:25pm
ensrainbow.io Skipped Skipped Jun 9, 2026 4:25pm

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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

Centralizes Unigraph SQL/SDK examples into typed TypeScript modules, updates the example renderer to consume optional HTML result notes, refactors MDX pages to import shared examples, adds five new example pages, and updates sidebar navigation and CSS selectors to surface the examples.

Changes

Unigraph Example Documentation System

Layer / File(s) Summary
Type contracts and output utilities
docs/ensnode.io/src/data/unigraph-examples/types.ts, docs/ensnode.io/src/data/unigraph-examples/utils.ts
CodeExample and QueryExample interfaces plus outputSource and EnsNodeInstances standardize example payloads and produce HTML result notes.
Shared example data modules
docs/ensnode.io/src/data/unigraph-examples/* (account-domains.ts, domain-by-name.ts, domain-events.ts, domains-fuzzy-search-by-name.ts, expiring-registrations.ts, indexing-status.ts, latest-registrations.ts, subdomains-by-parent-name.ts)
Typed QueryExample modules exporting sql and sdk CodeExample objects with codeSnippet, result, and optional resultNote, centralizing snippet/result data used by MDX pages.
Example renderer updates
docs/ensnode.io/src/components/molecules/unigraph-static-example/UnigraphStaticExample.astro
Renders StaticExampleNote via set:html using sql.resultNote ?? defaultResultNote and ensDbSdk.resultNote ?? defaultResultNote.
Documentation pages and MDX wiring
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/*, docs/ensnode.io/src/components/molecules/EnsDbReaderIntro.astro, docs/ensnode.io/src/components/molecules/EnsUnigraphIntro.astro
Refactors existing example MDX pages to import shared modules and adds new example pages (Domain Events, Fuzzy Search, Expiring Registrations, Latest Registrations, Subdomains); updates a reader note to reference the “Connect example.”
Navigation sidebar and style tweaks
docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts, docs/ensnode.io/src/content/docs/docs/integrate/index.mdx, docs/ensnode.io/src/styles/starlight.css
Adds six example links under ENS Unigraph SQL (including Connect, Domain Fuzzy Search, Domain Events, Subdomains, Latest Registrations, Expiring Registrations), re-capitalizes ENSNode Plugins (Data Models), expands Writers/Readers/Plugins descriptions, and adds .static-example p a underline styling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

docs

🐰 I hopped through docs to tidy the trail,
Examples gathered, no story to derail,
Types stitched the snippets, notes glowing bright,
Sidebar points the way, CSS kept polite,
Now the guide is neat — hop forward, take flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'docs: extend ENS Unigraph examples' accurately reflects the main objective of the changeset: expanding ENS Unigraph documentation with new examples and refactored example structure.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description follows the required template structure with all key sections: Summary, Why, Testing, and Pre-Review Checklist completed.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/extend-ens-unigraph-examples

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 Docs/extend ens unigraph examples docs: extend ENS Unigraph examples Jun 5, 2026
@greptile-apps

greptile-apps Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR expands the ENS Unigraph documentation by refactoring existing examples and adding six new ones (domain events, fuzzy search, subdomains, account domains, latest registrations, expiring registrations, and indexing status). Example data is moved into dedicated TypeScript files under src/data/unigraph-examples/, each exporting both a SQL snippet and an SDK snippet with matching result fixtures, and the .mdx pages now simply import and render those data objects.

  • Each example file provides both a raw SQL query and a Drizzle ORM SDK equivalent, with result snapshots sourced from live ENSNode instances and noted via the new outputSource utility.
  • Previously flagged issues (stale JSDoc, missing/wrong drizzle-orm imports, SQL/result column mismatches, double-wrapped indexingStatus, and a sidebar typo) have all been resolved in this revision.
  • A minor edge case exists in the subdomains-by-parent-name SDK snippet where null subregistryId values passed to inArray would silently yield empty results for parent domains without a subregistry.

Confidence Score: 5/5

Documentation-only change with no runtime code paths; safe to merge.

All changes are confined to static documentation files — TypeScript data objects, MDX pages, and a sidebar config. Every previously flagged issue has been corrected in this revision. The one remaining note (null subregistryId values in an inArray call inside a code snippet) is a non-blocking documentation quality concern that does not affect the site's runtime behaviour.

docs/ensnode.io/src/data/unigraph-examples/subdomains-by-parent-name.ts — the SDK snippet's inArray call may silently return empty results when a parent domain has a null subregistryId.

Important Files Changed

Filename Overview
docs/ensnode.io/src/data/unigraph-examples/subdomains-by-parent-name.ts New example for subdomain queries; SQL and SDK results are consistent, but the SDK snippet passes potentially-null subregistryId values directly into inArray, which could silently return no results for domains without a subregistry.
docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts New example for latest-registrations queries; SQL and SDK results are now consistent (previously flagged column and import mismatches have been resolved).
docs/ensnode.io/src/data/unigraph-examples/indexing-status.ts New indexing-status example; the previously reported double-wrapped indexingStatus issue has been fixed — SQL and SDK result objects now correctly reflect the query outputs.
docs/ensnode.io/src/data/unigraph-examples/expiring-registrations.ts New expiring-registrations example; JSDoc and SQL/SDK results are consistent. Previously flagged JSDoc copy-paste error has been corrected.
docs/ensnode.io/src/data/unigraph-examples/domains-fuzzy-search-by-name.ts New fuzzy-search example; both asc and desc are imported and used, SQL and SDK results are consistent.
docs/ensnode.io/src/data/unigraph-examples/domain-events.ts New domain-events example; SQL and SDK select identical fields and results match, JSDoc is correct.
docs/ensnode.io/src/data/unigraph-examples/account-domains.ts New account-domains example; SQL and SDK are consistent, JSDoc explains ENSv1/ENSv2 canonical-field motivation clearly.
docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts Added seven new sidebar entries for Unigraph examples; previously flagged 'Exipring Registrations' typo has been corrected to 'Expiring Registrations'.
docs/ensnode.io/src/data/unigraph-examples/types.ts New shared types file defining CodeExample and QueryExample interfaces used across all example data files.
docs/ensnode.io/src/data/unigraph-examples/utils.ts New utility file providing outputSource helper and ENSNode instance URL mapping used by all example data files.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[.mdx example page] -->|imports| B[unigraph-examples/*.ts]
    B --> C{QueryExample}
    C --> D[sql.codeSnippet\nraw SQL string]
    C --> E[sdk.codeSnippet\nDrizzle ORM string]
    C --> F[sql.result\nstatic fixture]
    C --> G[sdk.result\nstatic fixture]
    C --> H[resultNote\noutputSource helper]
    H --> I[utils.ts\noutputSource + EnsNodeInstances]
    B --> J[types.ts\nCodeExample / QueryExample]
    A --> K[UnigraphStaticExample.astro\nrenders code + result]
Loading

Reviews (10): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment thread docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts Outdated
Comment thread docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/account-domains.ts Outdated

Copilot AI left a comment

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.

Pull request overview

This PR expands the ENS Unigraph SQL examples in the docs by moving example payloads into dedicated data modules and adding several new example pages that import those modules for rendering.

Changes:

  • Introduced a small QueryExample/CodeExample type contract and added multiple new Unigraph example data files (SQL + ensdb-sdk snippets + static results).
  • Added new MDX pages for each example and refactored existing pages to import examples from @data/unigraph-examples/....
  • Updated the Integrate sidebar to include the expanded Unigraph examples navigation.

Reviewed changes

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

Show a summary per file
File Description
docs/ensnode.io/src/data/unigraph-examples/types.ts Adds shared TS types for example payloads.
docs/ensnode.io/src/data/unigraph-examples/subdomains-by-parent-name.ts Adds subdomains-by-parent SQL/SDK example + result fixture.
docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts Adds latest-registrations SQL/SDK example + result fixture.
docs/ensnode.io/src/data/unigraph-examples/indexing-status.ts Adds indexing-status SQL/SDK example + result fixture.
docs/ensnode.io/src/data/unigraph-examples/expiring-registrations.ts Adds expiring-registrations SQL/SDK example + result fixture.
docs/ensnode.io/src/data/unigraph-examples/domains-fuzzy-search-by-name.ts Adds pg_trgm-based fuzzy name search example + result fixture.
docs/ensnode.io/src/data/unigraph-examples/domain-events.ts Adds domain events join example + result fixture.
docs/ensnode.io/src/data/unigraph-examples/domain-by-name.ts Adds canonical-name lookup example + result fixture.
docs/ensnode.io/src/data/unigraph-examples/account-domains.ts Adds “domains owned by address” example + result fixture.
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/subdomains-by-parent-name.mdx New example page wiring the data module into the UI component.
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/latest-registrations.mdx New example page wiring the data module into the UI component.
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/indexing-status.mdx Refactors existing page to import the new data module.
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/expiring-registrations.mdx New example page wiring the data module into the UI component.
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domains-fuzzy-search-by-name.mdx New example page wiring the data module into the UI component.
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-events.mdx New example page wiring the data module into the UI component.
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-by-name.mdx Refactors existing page to import the new data module.
docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/account-domains.mdx Refactors existing page to import the new data module.
docs/ensnode.io/src/content/docs/docs/integrate/index.mdx Updates integration option descriptions.
docs/ensnode.io/src/components/molecules/EnsDbReaderIntro.astro Minor copy tweak referencing the “Connect” example.
docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts Adds sidebar links for the expanded Unigraph example set.

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

Comment thread docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts
Comment thread docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/account-domains.ts Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/indexing-status.ts Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/indexing-status.ts Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts
Comment thread docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts Outdated

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts`:
- Around line 206-207: Correct the typo in the sidebar entry by changing the
label string "Exipring Registrations" to "Expiring Registrations"; locate the
object where label: "Exipring Registrations" appears (the same entry with link:
"/docs/integrate/unigraph/examples/expiring-registrations") and update the label
value to the spelled-correct form.

In
`@docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-events.mdx`:
- Line 17: The description paragraph starting with "Fetch recent events for a
Domain by its canonical name..." is missing the consistent setup reference;
update that paragraph (in the content of domain-events.mdx) to append the
sentence "See [Connect](/docs/integrate/unigraph/examples) for setup." so it
matches the other example pages (search for the exact paragraph text or the
file's title/section to locate where to insert this reference).

In `@docs/ensnode.io/src/data/unigraph-examples/account-domains.ts`:
- Around line 98-119: The example uses asc(...) in orderBy but never imports it;
update the import line in the codeSnippet to include asc (i.e., import { and,
eq, asc } from "drizzle-orm") so the call to asc in the accountDomains query
resolves correctly—modify the import near the top of the snippet where and and
eq are imported.

In `@docs/ensnode.io/src/data/unigraph-examples/expiring-registrations.ts`:
- Around line 3-5: Update the module JSDoc to describe expiring registrations
rather than recent events; replace the current summary line ("Example query for
fetching recent events for a Domain by its canonical name.") with a concise
description matching the file intent such as "Example query for fetching
expiring registrations for a Domain" (or similar phrasing) in the top comment of
expiring-registrations.ts so the documentation matches the query implemented in
this module.

In `@docs/ensnode.io/src/data/unigraph-examples/indexing-status.ts`:
- Around line 119-130: The example outputs incorrectly nest indexingStatus one
level too deep; update the result objects so they use
indexingStatusSnapshot.indexingStatus instead of { indexingStatus:
indexingStatusSnapshot } (i.e., set result to { indexingStatus:
indexingStatusSnapshot.indexingStatus }) for both occurrences referenced around
indexingStatusSnapshot and the SDK snippet constants to match the SQL/SDK
examples.

In `@docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts`:
- Around line 8-24: The SQL in the codeSnippet currently selects five columns
(d.canonical_name, r.start, r.expiry, d.owner_id, d.id AS domain_id) with LIMIT
15 but the documented result payload contains additional registration columns
and only five rows; make them consistent by either (A) expanding the SELECT in
the codeSnippet to include the extra registration fields shown in the result
(e.g., add r.transaction_hash, r.registration_index, r.type, etc.) and keep
LIMIT 5 if the example intends five rows, or (B) update the result block to
match the current SQL (only the five selected columns and 15 rows); locate the
codeSnippet string in latest-registrations.ts and change the SELECT column list
and LIMIT (or the result block) accordingly so both the query and the documented
result match exactly.
- Around line 89-127: The code snippet is missing the desc import and the SQL
example's selected columns and LIMIT don't match the shown result objects;
update the drizzle import to include desc (alongside and, asc, eq, ne, lte, sql)
so the call to desc(ensIndexerSchema.registration.start) is valid, and then make
the SELECT and LIMIT in the SQL example consistent with the JavaScript query and
example output—either change the SQL SELECT to return the same fields as
recentRegistrations (canonicalName, expiry, start,
registrationType/registration.type, ownerId, domainId) and set LIMIT 5, or alter
the JS select to include grace_period/base/premium/registration_type and use
LIMIT 15 to match the displayed result—ensure recentRegistrations, desc, and the
SQL SELECT/LIMIT are aligned.
🪄 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: 246d12cd-2c73-4f09-9279-aed3c5020bc8

📥 Commits

Reviewing files that changed from the base of the PR and between c8267e4 and d4e91df.

📒 Files selected for processing (20)
  • docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts
  • docs/ensnode.io/src/components/molecules/EnsDbReaderIntro.astro
  • docs/ensnode.io/src/content/docs/docs/integrate/index.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/account-domains.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-by-name.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-events.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domains-fuzzy-search-by-name.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/expiring-registrations.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/indexing-status.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/latest-registrations.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/subdomains-by-parent-name.mdx
  • docs/ensnode.io/src/data/unigraph-examples/account-domains.ts
  • docs/ensnode.io/src/data/unigraph-examples/domain-by-name.ts
  • docs/ensnode.io/src/data/unigraph-examples/domain-events.ts
  • docs/ensnode.io/src/data/unigraph-examples/domains-fuzzy-search-by-name.ts
  • docs/ensnode.io/src/data/unigraph-examples/expiring-registrations.ts
  • docs/ensnode.io/src/data/unigraph-examples/indexing-status.ts
  • docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts
  • docs/ensnode.io/src/data/unigraph-examples/subdomains-by-parent-name.ts
  • docs/ensnode.io/src/data/unigraph-examples/types.ts

Comment thread docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/account-domains.ts Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/indexing-status.ts Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts
Comment thread docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts Outdated
Comment thread apps/ensapi/src/handlers/api/router.ts Outdated
Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated
Copilot AI review requested due to automatic review settings June 5, 2026 17:55
@tk-o tk-o force-pushed the docs/extend-ens-unigraph-examples branch from 66e5135 to 2b41753 Compare June 5, 2026 17:55
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io June 5, 2026 17:55 Inactive
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io June 5, 2026 17:55 Inactive

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts (1)

98-104: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Align SDK field selection with the SQL example.

The SQL snippet (lines 8-17) selects grace_period, base, and premium from the registration table, but the SDK .select() block omits these fields. This creates an inconsistency between the two examples—users comparing SQL vs SDK approaches will see different output shapes.

🔄 Suggested alignment
 const recentRegistrations = await ensDb
   .select({
     canonicalName: ensIndexerSchema.domain.canonicalName,
     expiry: ensIndexerSchema.registration.expiry,
     start: ensIndexerSchema.registration.start,
+    gracePeriod: ensIndexerSchema.registration.gracePeriod,
+    base: ensIndexerSchema.registration.base,
+    premium: ensIndexerSchema.registration.premium,
     registrationType: ensIndexerSchema.registration.type,
     ownerId: ensIndexerSchema.domain.ownerId,
     domainId: ensIndexerSchema.domain.id,
   })

Then update the SDK result array (lines 135-181) to include gracePeriod, base, and premium in each row to match the SQL result payload.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts` around
lines 98 - 104, The SDK .select(...) call currently selects canonicalName,
expiry, start, registrationType, ownerId, and domainId but omits the
registration fields selected in the SQL example; update the .select invocation
to also include ensIndexerSchema.registration.grace_period,
ensIndexerSchema.registration.base, and ensIndexerSchema.registration.premium
(mapped to SDK names like gracePeriod, base, premium as needed) so the SDK
projection matches the SQL example, and then update the example SDK result array
(the result rows shown later) to add gracePeriod, base, and premium to each row
so the returned payload shape mirrors the SQL output.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/ensapi/src/handlers/api/test/test-queries-api.ts`:
- Around line 165-207: The /fuzzy-search route handler lacks input validation
and error handling; add a Zod schema and apply the validate() middleware to
parse/validate query params (q as non-empty string and limit as a positive
integer with a sensible default) for the app.get("/fuzzy-search", ...) route,
then wrap the database calls that use di.context.ensDb (the sqlResult and
drizzleResult queries) in a try-catch and call the existing errorResponse helper
in the catch to return a formatted error and avoid throwing raw errors to the
client.
- Around line 211-285: The /expiring route handler (app.get("/expiring")) lacks
input validation and error handling: create a Zod schema for start, end, and
limit and apply the validate() middleware to the route (use the same param names
used in the handler), then wrap the database calls that use ensDb and
ensIndexerSchema in a try-catch and return errors via the errorResponse helper;
on validation success parse and pass the validated start/end/limit into the
query and keep returning jsonBigInt on success.
- Around line 60-122: The /subdomains handler lacks input validation, error
handling, explicit missing-parent responses, and contains a debug console.log;
update the app.get("/subdomains", async (c) => { ... }) route to: validate query
params using a Zod schema (name:string, limit:number) via the validate()
middleware, wrap the database work that uses ensDb and ensIndexerSchema in a
try-catch and return errors using the errorResponse helper on catch, remove the
console.log(subdomains) call, and when parentDomain or
parentDomain.subregistryId is falsy return a clear errorResponse (e.g., 404 or
validation-style error) instead of falling through to an implicit undefined
return. Ensure you reference the existing symbols parentDomain and subdomains
when implementing these checks.
- Around line 392-445: The /domain-events route handler is missing input
validation and error handling; add a Zod schema for the query params (validate
name as string and limit as optional positive integer with a max), apply the
validate() middleware to this route so the handler uses the validated values
instead of raw c.req.query, and wrap the DB calls (the RAW SQL block and the
DRIZZLE select chain) in a try-catch that returns the standardized
errorResponse(...) on failure (use the same errorResponse helper used elsewhere
in this app); refer to the route handler for "/domain-events", the local
variables name and limit, and the DB usage via ensDb, ensIndexerSchema to locate
where to apply the validate() middleware and try-catch.
- Around line 26-57: The GET /domain-by-name handler is missing input
validation, lacks error handling, and contains a debug console.log; add a Zod
schema for the "name" query param and call the existing validate() middleware
(from apps/ensapi/src/lib/handlers/validate.ts) to validate c.req.query before
running DB logic, wrap the DB calls in a try-catch and on error return the
shared errorResponse(...) helper (from
apps/ensapi/src/lib/handlers/error-response.ts) with the caught error, and
remove the console.log(vitalik) statement; keep using the same
functions/variables in the handler (app.get("/domain-by-name"), ensDb,
ensIndexerSchema, jsonBigInt) but ensure validation runs first and DB errors are
caught and mapped to errorResponse.
- Around line 125-162: Replace the hardcoded owner and limit in the
app.get("/account-domains", async (c) => { ... }) handler by reading
c.req.query("owner") and c.req.query("limit"), add a Zod schema for those query
params and apply the existing validate() middleware for this route, wrap the
database calls (ensDb.execute and ensDb.select(...) usages referencing
ensIndexerSchema) in a try-catch and call the shared errorResponse helper on
failure, and ensure the successful response still returns jsonBigInt({ owner,
sql: sqlResult.rows, drizzle: drizzleResult }) after parsing/normalizing the
validated limit to a number.
- Around line 288-355: The /recent-registrations route handler is missing input
validation and error handling; add a Zod schema for the query param (limit) and
apply the validate() middleware before this handler, and wrap the DB calls
(ensDb.execute and the Drizzle query producing sqlResult and drizzleResult) in a
try-catch that returns the centralized errorResponse helper on failure; ensure
the validated limit is used (instead of raw parseInt) and that any caught error
is passed to errorResponse so the route fails gracefully.
- Around line 358-389: The /permissions handler returns inconsistent data and
lacks validation/error handling: validate the incoming user query using the
project's Zod schema via the validate() middleware, wrap the DB calls (the raw
SQL execute returning sqlResult and the Drizzle select producing drizzleResult)
in a try-catch and call the errorResponse helper on failure, and return
sqlResult.rows (not sqlResult) alongside drizzleResult in the jsonBigInt
response; update the app.get("/permissions") handler to perform these changes
around the existing ensDb/ensIndexerSchema usage so consumers always receive the
same array format and errors are handled.

---

Outside diff comments:
In `@docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts`:
- Around line 98-104: The SDK .select(...) call currently selects canonicalName,
expiry, start, registrationType, ownerId, and domainId but omits the
registration fields selected in the SQL example; update the .select invocation
to also include ensIndexerSchema.registration.grace_period,
ensIndexerSchema.registration.base, and ensIndexerSchema.registration.premium
(mapped to SDK names like gracePeriod, base, premium as needed) so the SDK
projection matches the SQL example, and then update the example SDK result array
(the result rows shown later) to add gracePeriod, base, and premium to each row
so the returned payload shape mirrors the SQL output.
🪄 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: 829bd0dd-5833-4726-892a-6bdd6fa62b2f

📥 Commits

Reviewing files that changed from the base of the PR and between d4e91df and 66e5135.

📒 Files selected for processing (11)
  • apps/ensapi/src/handlers/api/router.ts
  • apps/ensapi/src/handlers/api/test/test-queries-api.ts
  • docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/account-domains.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-by-name.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-events.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/expiring-registrations.mdx
  • docs/ensnode.io/src/data/unigraph-examples/account-domains.ts
  • docs/ensnode.io/src/data/unigraph-examples/expiring-registrations.ts
  • docs/ensnode.io/src/data/unigraph-examples/indexing-status.ts
  • docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts

Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated
Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated
Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated
Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated
Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated
Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated
Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated
Comment thread apps/ensapi/src/handlers/api/test/test-queries-api.ts Outdated

Copilot AI left a comment

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.

Pull request overview

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

Comment thread docs/ensnode.io/src/data/unigraph-examples/types.ts
Comment thread docs/ensnode.io/src/data/unigraph-examples/domains-fuzzy-search-by-name.ts Outdated
Comment thread docs/ensnode.io/src/components/molecules/EnsDbReaderIntro.astro

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.

Comment thread docs/ensnode.io/src/data/unigraph-examples/domain-events.ts Outdated
Comment thread docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/index.mdx Outdated
Comment thread docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts
Comment thread docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts

@coderabbitai coderabbitai Bot left a comment

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
docs/ensnode.io/src/data/unigraph-examples/domain-events.ts (1)

11-31: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

SQL syntax error: missing comma after selector.

Line 20 ends with e.selector but is missing the trailing comma before e.topics, on line 21. This will cause a SQL parse error when the query is executed.

🐛 Proposed fix
   e.sender,
   e.from,
   e.to,
-  e.selector
+  e.selector,
   e.topics,
   e.data,
   d.id as domain_id
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/ensnode.io/src/data/unigraph-examples/domain-events.ts` around lines 11
- 31, The SQL query in the codeSnippet has a missing comma after the select
column e.selector which causes a parse error; update the SELECT list in
domain-events.ts (the codeSnippet string) to add a comma after e.selector so the
columns read "... e.selector, e.topics, e.data, d.id as domain_id ..." ensuring
the SELECT list is properly comma-separated and the query executes.
docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts (2)

86-185: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

SDK select fields don't match documented result objects.

The SDK query selects 9 fields including base (line 97) and premium (line 98), but the result array (lines 132-183) only contains 7 fields—base and premium are missing. This matches the same inconsistency in the SQL example.

Apply the same fix as the SQL variant: either remove the fields from the select or add them to the result objects.

🔧 Option 1: Remove from select
   .select({
     canonicalName: ensIndexerSchema.domain.canonicalName,
     start: ensIndexerSchema.registration.start,
     expiry: ensIndexerSchema.registration.expiry,
     gracePeriod: ensIndexerSchema.registration.gracePeriod,
-    base: ensIndexerSchema.registration.base,
-    premium: ensIndexerSchema.registration.premium,
     registrationType: ensIndexerSchema.registration.type,
     ownerId: ensIndexerSchema.domain.ownerId,
     domainId: ensIndexerSchema.domain.id,
   })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts` around
lines 86 - 185, The SDK select includes ensIndexerSchema.registration.base and
.premium but the example result objects (recentRegistrations result) omit those
fields; update the example to include base and premium in each result object
(matching the selected fields) or alternatively remove .base and .premium from
the select — modify either the select block that builds recentRegistrations
(references: recentRegistrations, ensIndexerSchema.registration.base,
ensIndexerSchema.registration.premium) and the example result array so both
sides match (add base and premium entries to each object with example values if
you choose to add them).

11-84: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

SQL SELECT fields don't match documented result objects.

The SQL query selects 9 fields including r.base (line 16) and r.premium (line 17), but the result array (lines 32-83) only contains 7 fields—base and premium are missing from every result object. Users copying this example will get different output than documented.

Either:

  1. Remove base and premium from the SQL SELECT to match the results, OR
  2. Add base and premium fields to each result object
🔧 Option 1: Remove from SELECT
 SELECT
   d.canonical_name,
   r.start,
   r.expiry,
   r.grace_period,
-  r.base,
-  r.premium,
   r.type as registration_type,
   d.owner_id,
   d.id as domain_id
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts` around
lines 11 - 84, The SELECT includes r.base and r.premium but the result array
lacks those keys; fix by either removing r.base and r.premium from the SQL
snippet in codeSnippet to match the current result objects, or (preferred) add
base and premium properties to every object in the result array so the
documented output matches the SELECT (update each result object next to
canonical_name/start/expiry/... to include base and premium fields). Ensure you
update the codeSnippet's SELECT or the result array consistently for r.base and
r.premium.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@docs/ensnode.io/src/data/unigraph-examples/domain-events.ts`:
- Around line 11-31: The SQL query in the codeSnippet has a missing comma after
the select column e.selector which causes a parse error; update the SELECT list
in domain-events.ts (the codeSnippet string) to add a comma after e.selector so
the columns read "... e.selector, e.topics, e.data, d.id as domain_id ..."
ensuring the SELECT list is properly comma-separated and the query executes.

In `@docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts`:
- Around line 86-185: The SDK select includes ensIndexerSchema.registration.base
and .premium but the example result objects (recentRegistrations result) omit
those fields; update the example to include base and premium in each result
object (matching the selected fields) or alternatively remove .base and .premium
from the select — modify either the select block that builds recentRegistrations
(references: recentRegistrations, ensIndexerSchema.registration.base,
ensIndexerSchema.registration.premium) and the example result array so both
sides match (add base and premium entries to each object with example values if
you choose to add them).
- Around line 11-84: The SELECT includes r.base and r.premium but the result
array lacks those keys; fix by either removing r.base and r.premium from the SQL
snippet in codeSnippet to match the current result objects, or (preferred) add
base and premium properties to every object in the result array so the
documented output matches the SELECT (update each result object next to
canonical_name/start/expiry/... to include base and premium fields). Ensure you
update the codeSnippet's SELECT or the result array consistently for r.base and
r.premium.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: de15c735-afdd-41ea-b646-371ef55782fb

📥 Commits

Reviewing files that changed from the base of the PR and between 77ab8dc and 97c5302.

📒 Files selected for processing (22)
  • docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts
  • docs/ensnode.io/src/components/molecules/EnsUnigraphIntro.astro
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/concepts.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/account-domains.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-by-name.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-events.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domains-fuzzy-search-by-name.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/expiring-registrations.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/index.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/indexing-status.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/latest-registrations.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/subdomains-by-parent-name.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/index.mdx
  • docs/ensnode.io/src/data/unigraph-examples/account-domains.ts
  • docs/ensnode.io/src/data/unigraph-examples/domain-by-name.ts
  • docs/ensnode.io/src/data/unigraph-examples/domain-events.ts
  • docs/ensnode.io/src/data/unigraph-examples/domains-fuzzy-search-by-name.ts
  • docs/ensnode.io/src/data/unigraph-examples/expiring-registrations.ts
  • docs/ensnode.io/src/data/unigraph-examples/latest-registrations.ts
  • docs/ensnode.io/src/data/unigraph-examples/subdomains-by-parent-name.ts
  • docs/ensnode.io/src/data/unigraph-examples/utils.ts
  • docs/ensnode.io/src/styles/starlight.css
💤 Files with no reviewable changes (7)
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/expiring-registrations.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/latest-registrations.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domains-fuzzy-search-by-name.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/account-domains.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/domain-by-name.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/indexing-status.mdx
  • docs/ensnode.io/src/content/docs/docs/integrate/unigraph/examples/subdomains-by-parent-name.mdx

Copilot AI review requested due to automatic review settings June 9, 2026 16:02

Copilot AI left a comment

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.

Pull request overview

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

Comment thread docs/ensnode.io/src/data/unigraph-examples/types.ts
Comment thread docs/ensnode.io/src/content/docs/docs/integrate/unigraph/concepts.mdx Outdated

@shrugs shrugs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just spot checked the documentation preview and it looks great to me.

@tk-o tk-o merged commit b2485e5 into main Jun 10, 2026
22 checks passed
@tk-o tk-o deleted the docs/extend-ens-unigraph-examples branch June 10, 2026 04:38
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.

3 participants