Skip to content

initial rearrange#1749

Draft
sevenzing wants to merge 1 commit intonamehash:mainfrom
sevenzing:ll/ensapi/rearrange-api-register
Draft

initial rearrange#1749
sevenzing wants to merge 1 commit intonamehash:mainfrom
sevenzing:ll/ensapi/rearrange-api-register

Conversation

@sevenzing
Copy link

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • What changed (1-3 bullets, no essays).

Why

  • Why this change exists. Link to related GitHub issues where relevant.

Testing

  • How this was tested.
  • If you didn't test it, say why.

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)

@changeset-bot
Copy link

changeset-bot bot commented Mar 11, 2026

⚠️ No Changeset found

Latest commit: b3795f1

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
Copy link
Contributor

vercel bot commented Mar 11, 2026

@sevenzing is attempting to deploy a commit to the NameHash Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

📝 Walkthrough

Walkthrough

The pull request refactors the API routing structure by removing four public API submodules from the ensnode-api handler, renaming and reorganizing realtime API modules with updated path conventions, creating a new router module to consolidate route wiring, and updating import paths across the codebase to use new module locations and alias paths.

Changes

Cohort / File(s) Summary
Realtime API Module Reorganization
apps/ensapi/src/handlers/api/meta/realtime-api.routes.ts, apps/ensapi/src/handlers/api/meta/realtime-api.ts, apps/ensapi/src/handlers/api/meta/realtime-api.test.ts
Updated realtime API module imports from amirealtime-api to realtime-api, changed basePath from "/amirealtime" to "/api/realtime", and updated operationId from "isRealtime" to "getRealtime".
Router Creation and Ensnode API Refactor
apps/ensapi/src/handlers/api/router.ts, apps/ensapi/src/handlers/api/meta/ensnode-api.ts
Created new router module (router.ts) that instantiates Hono app and wires routes (/, /realtime, /resolve, /name-tokens, /registrar-actions, /graphql). Removed four submodule imports and route registrations from ensnode-api.ts (ensnode-graphql-api, name-tokens-api, registrar-actions-api, resolution-api).
Test Import Path Updates
apps/ensapi/src/handlers/ensanalytics/ensanalytics-api-v1.test.ts, apps/ensapi/src/handlers/ensanalytics/ensanalytics-api.test.ts
Updated test imports from relative paths to aliased "@/..." paths for middleware module references.
Main Entry Point and OpenAPI Updates
apps/ensapi/src/index.ts, apps/ensapi/src/openapi-document.ts
Updated handler imports to reference new module locations: realtimeApi (from realtime-api), apiRouter (new), ensanalytics modules under ensanalytics/ subdirectory, and subgraph-api under subgraph/ subdirectory. Reorganized route bindings and routeGroups configuration accordingly.

Possibly Related PRs

Poem

🐰 Routes reorganized, paths made neat,
The router hops in, completion sweet!
Old amirealtime, now realtime's call,
Realms reshaped, we conquer all! ✨

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is entirely a template with no actual content filled in; all required sections (Summary, Why, Testing) are empty, providing no information about the changes. Fill in the template with specific details: summarize the file reorganization and new router module in Summary, explain the motivation in Why, describe testing performed in Testing, and check the Pre-Review Checklist items.
Title check ❓ Inconclusive The title 'initial rearrange' is vague and does not clearly describe the main changes, which involve reorganizing API route handlers, creating a new router module, and updating import paths. Use a more descriptive title that clearly indicates the main change, such as 'Reorganize API handlers and create centralized router module' or 'Restructure ensapi route handlers into api subdirectory'.
✅ Passed checks (1 passed)
Check name Status Explanation
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 unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@sevenzing sevenzing force-pushed the ll/ensapi/rearrange-api-register branch from 0ee90f6 to b3795f1 Compare March 11, 2026 15:08
@vercel
Copy link
Contributor

vercel bot commented Mar 11, 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 11, 2026 3:08pm
ensnode.io Skipped Skipped Mar 11, 2026 3:08pm
ensrainbow.io Skipped Skipped Mar 11, 2026 3:08pm

@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io March 11, 2026 15:08 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io March 11, 2026 15:08 Inactive
@vercel vercel bot temporarily deployed to Preview – ensnode.io March 11, 2026 15:08 Inactive
Copy link
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

Caution

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

⚠️ Outside diff range comments (1)
apps/ensapi/src/index.ts (1)

63-75: ⚠️ Potential issue | 🟠 Major

Pick one canonical realtime URL; this currently exposes two public endpoints.

apiRouter already makes the same handler available at /api/realtime, so Line 75 keeps a second live path at /amirealtime while the generated OpenAPI only documents /api/realtime. That leaves the legacy path undocumented and makes the public contract ambiguous.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/ensapi/src/index.ts` around lines 63 - 75, The code exposes the realtime
handler twice—once via apiRouter at /api/realtime and again with
app.route("/amirealtime", realtimeApi)—which creates an undocumented duplicate
public path; remove the duplicate by deleting the app.route("/amirealtime",
realtimeApi) line (or replace it with a 301 redirect to /api/realtime if you
must preserve a legacy URL) so that the canonical endpoint is /api/realtime
served by apiRouter and only realtimeApi is referenced through that single
route.
🤖 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/handlers/api/meta/realtime-api.routes.ts`:
- Around line 14-17: The operationId for this route was changed and will break
the published OpenAPI contract; revert the operationId in the createRoute call
for amIRealtimeGetMeta back to the original name (e.g., "isRealtime") so
generated client methods and the API contract remain unchanged—update the
operationId property inside the createRoute invocation that defines
amIRealtimeGetMeta to the original identifier.

---

Outside diff comments:
In `@apps/ensapi/src/index.ts`:
- Around line 63-75: The code exposes the realtime handler twice—once via
apiRouter at /api/realtime and again with app.route("/amirealtime",
realtimeApi)—which creates an undocumented duplicate public path; remove the
duplicate by deleting the app.route("/amirealtime", realtimeApi) line (or
replace it with a 301 redirect to /api/realtime if you must preserve a legacy
URL) so that the canonical endpoint is /api/realtime served by apiRouter and
only realtimeApi is referenced through that single route.
🪄 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: 350239c6-a41e-4389-99b8-a9d70f981c4b

📥 Commits

Reviewing files that changed from the base of the PR and between 6dbee3e and b3795f1.

📒 Files selected for processing (22)
  • apps/ensapi/src/handlers/api/explore/name-tokens-api.routes.ts
  • apps/ensapi/src/handlers/api/explore/name-tokens-api.ts
  • apps/ensapi/src/handlers/api/explore/registrar-actions-api.routes.ts
  • apps/ensapi/src/handlers/api/explore/registrar-actions-api.ts
  • apps/ensapi/src/handlers/api/graphql/ensnode-graphql-api.ts
  • apps/ensapi/src/handlers/api/meta/ensnode-api.routes.ts
  • apps/ensapi/src/handlers/api/meta/ensnode-api.ts
  • apps/ensapi/src/handlers/api/meta/realtime-api.routes.ts
  • apps/ensapi/src/handlers/api/meta/realtime-api.test.ts
  • apps/ensapi/src/handlers/api/meta/realtime-api.ts
  • apps/ensapi/src/handlers/api/resolution/resolution-api.routes.ts
  • apps/ensapi/src/handlers/api/resolution/resolution-api.ts
  • apps/ensapi/src/handlers/api/router.ts
  • apps/ensapi/src/handlers/ensanalytics/ensanalytics-api-v1.routes.ts
  • apps/ensapi/src/handlers/ensanalytics/ensanalytics-api-v1.test.ts
  • apps/ensapi/src/handlers/ensanalytics/ensanalytics-api-v1.ts
  • apps/ensapi/src/handlers/ensanalytics/ensanalytics-api.routes.ts
  • apps/ensapi/src/handlers/ensanalytics/ensanalytics-api.test.ts
  • apps/ensapi/src/handlers/ensanalytics/ensanalytics-api.ts
  • apps/ensapi/src/handlers/subgraph/subgraph-api.ts
  • apps/ensapi/src/index.ts
  • apps/ensapi/src/openapi-document.ts
💤 Files with no reviewable changes (1)
  • apps/ensapi/src/handlers/api/meta/ensnode-api.ts

Comment on lines 14 to +17
export const amIRealtimeGetMeta = createRoute({
method: "get",
path: "/",
operationId: "isRealtime",
operationId: "getRealtime",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep the existing operationId unless you want an explicit breaking API change.

Renaming isRealtime to getRealtime changes the published OpenAPI contract and will rename generated client methods even though the endpoint behavior did not change.

Minimal fix
 export const amIRealtimeGetMeta = createRoute({
   method: "get",
   path: "/",
-  operationId: "getRealtime",
+  operationId: "isRealtime",
   tags: ["Meta"],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const amIRealtimeGetMeta = createRoute({
method: "get",
path: "/",
operationId: "isRealtime",
operationId: "getRealtime",
export const amIRealtimeGetMeta = createRoute({
method: "get",
path: "/",
operationId: "isRealtime",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/ensapi/src/handlers/api/meta/realtime-api.routes.ts` around lines 14 -
17, The operationId for this route was changed and will break the published
OpenAPI contract; revert the operationId in the createRoute call for
amIRealtimeGetMeta back to the original name (e.g., "isRealtime") so generated
client methods and the API contract remain unchanged—update the operationId
property inside the createRoute invocation that defines amIRealtimeGetMeta to
the original identifier.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

Additional Suggestions:

  1. The typecheck script uses 'tsgo --noEmit' from @typescript/native-preview, an unstable development preview that crashes with SIGKILL
  1. The 'files' field in package.json uses incorrect './' prefix for relative paths, which violates npm specification best practices

Fix on Vercel

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