Conversation
… and mismatch handling - Implemented eager building of public configuration from CLI/env arguments to serve immediately at startup. - Added tests for handling label-set mismatches between environment and database. - Updated API routes to reflect immediate availability of public config and adjusted readiness checks accordingly. - Refactored public config building logic for clarity and reusability.
🦋 Changeset detectedLatest commit: 3aadc33 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 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.
3 Skipped Deployments
|
There was a problem hiding this comment.
Pull request overview
Enhances ENSRainbow startup behavior so /v1/config is available immediately (built from CLI/env label-set args) while the DB bootstraps in the background, and adds enforcement/tests for env/DB label-set mismatches.
Changes:
- Make
/v1/configserve an eagerly-built in-memory public config immediately at startup (no 503 during bootstrap). - Add post-bootstrap validation that the opened DB’s stored label set matches configured
LABEL_SET_ID/LABEL_SET_VERSION, terminating on mismatch, with new tests. - Refactor public config construction into a reusable “from label set” helper and adjust API readiness logic/docs accordingly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdx | Document /v1/config as immediately available and adjust bootstrap/503 route list. |
| apps/ensrainbow/src/lib/api.ts | Change createApi to take a concrete public config, and adjust /ready + /v1/config behavior. |
| apps/ensrainbow/src/config/public.ts | Add buildEnsRainbowPublicConfigFromLabelSet helper for eager + post-bootstrap paths. |
| apps/ensrainbow/src/commands/server-command.ts | Update createApi usage to pass public config directly. |
| apps/ensrainbow/src/commands/server-command.test.ts | Update tests to reflect eager /v1/config behavior while DB is unattached. |
| apps/ensrainbow/src/commands/entrypoint-command.ts | Build public config eagerly; add env-vs-DB label-set mismatch validation and injectable exit hook. |
| apps/ensrainbow/src/commands/entrypoint-command.test.ts | Add tests for early /v1/config availability and mismatch termination behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughENSRainbow now builds public config eagerly from CLI/env label-set inputs at startup and injects it into the API immediately. During DB bootstrap the entrypoint validates the DB's stored serverLabelSet against the configured set; on mismatch it requests a controlled exit via a configurable exit hook and prevents readiness. ChangesEntrypoint & tests
Server & API wiring
Public config builder
Docs & changeset
Sequence DiagramsequenceDiagram
participant CLI as CLI/Env
participant Entrypoint as Entrypoint
participant API as API Server
participant DB as Database
rect rgba(76, 175, 80, 0.5)
CLI->>Entrypoint: provide LABEL_SET_ID / LABEL_SET_VERSION
Entrypoint->>Entrypoint: buildEnsRainbowPublicConfigFromLabelSet()
Entrypoint->>API: inject publicConfig (concrete)
API->>API: GET /v1/config returns configured publicConfig
end
rect rgba(33, 150, 243, 0.5)
Entrypoint->>DB: runDbBootstrap()
DB-->>Entrypoint: DbConfig (serverLabelSet)
Entrypoint->>Entrypoint: compare db.serverLabelSet vs configured
end
rect rgba(244, 67, 54, 0.5)
alt mismatch detected
Entrypoint->>API: keep /ready non-200 (503)
Entrypoint->>Entrypoint: resolve bootstrapComplete
Entrypoint->>Entrypoint: call options.exit(1)
else match
Entrypoint->>API: mark ready → /ready returns 200
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. Review rate limit: 0/1 reviews remaining, refill in 46 minutes and 49 seconds.Comment |
…ance validation checks
There was a problem hiding this comment.
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/content/docs/ensrainbow/usage/api.mdx (1)
193-217:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate
/v1/configexample payload to the current schema.The “Get Public Config” sample still documents the old shape. Current API returns
serverLabelSet+versionInfo, so this section is now misleading for integrators.📘 Proposed docs fix
Success Response: ```json { - "version": "0.1.0", - "labelSet": { + "serverLabelSet": { "labelSetId": "subgraph", "highestLabelSetVersion": 0 }, - "recordsCount": 133856894 + "versionInfo": { + "ensRainbow": "0.1.0" + } }The response contains:
--version: The current version of ENSRainbow
--labelSet: The label set of the loaded database
labelSetId: The label set ID of the loaded database
highestLabelSetVersion: The highest label set version available in the database
--recordsCount: The total count of labels that can be healed by the ENSRainbow instance
+-serverLabelSet: The configured server label-set identity
labelSetId: The configured label-set ID
highestLabelSetVersion: The configured highest label-set version
+-versionInfo.ensRainbow: The running ENSRainbow version</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@docs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdxaround lines 193 -
217, Update the "/v1/config" "Get Public Config" example and description to
match the current API schema: replace the top-level "version" and
"labelSet"/"recordsCount" shape with "serverLabelSet" (containing "labelSetId"
and "highestLabelSetVersion") and "versionInfo" (containing "ensRainbow"), i.e.,
change the JSON example to include "serverLabelSet" and "versionInfo.ensRainbow"
and remove "recordsCount", and update the bullet list below to document
"serverLabelSet.labelSetId", "serverLabelSet.highestLabelSetVersion" and
"versionInfo.ensRainbow" instead of the old "version", "labelSet", and
"recordsCount".</details> </blockquote></details> </blockquote></details>🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed. Outside diff comments: In `@docs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdx`: - Around line 193-217: Update the "/v1/config" "Get Public Config" example and description to match the current API schema: replace the top-level "version" and "labelSet"/"recordsCount" shape with "serverLabelSet" (containing "labelSetId" and "highestLabelSetVersion") and "versionInfo" (containing "ensRainbow"), i.e., change the JSON example to include "serverLabelSet" and "versionInfo.ensRainbow" and remove "recordsCount", and update the bullet list below to document "serverLabelSet.labelSetId", "serverLabelSet.highestLabelSetVersion" and "versionInfo.ensRainbow" instead of the old "version", "labelSet", and "recordsCount".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID:
00baf6e1-4e3f-4055-b72e-55ae211bc6ed📒 Files selected for processing (7)
apps/ensrainbow/src/commands/entrypoint-command.test.tsapps/ensrainbow/src/commands/entrypoint-command.tsapps/ensrainbow/src/commands/server-command.test.tsapps/ensrainbow/src/commands/server-command.tsapps/ensrainbow/src/config/public.tsapps/ensrainbow/src/lib/api.tsdocs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdx
…n info and rename label set fields
There was a problem hiding this comment.
Pull request overview
This PR updates ENSRainbow’s startup behavior so /v1/config is available immediately (built from CLI/env label set args) while the DB bootstraps in the background, and adds mismatch handling to terminate if the on-disk DB label set doesn’t match the configured label set.
Changes:
- Refactor API route wiring so
/v1/configis always served from an eagerly-built in-memory public config, while/readyand DB-backed routes remain gated on DB bootstrap completion. - Add entrypoint/server tests to cover “config available during bootstrap” and “env/DB label-set mismatch triggers termination”.
- Update public-config construction helpers and documentation to reflect the new response shape/availability.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdx | Updates API docs to reflect /v1/config being available immediately and adjusts the documented response fields. |
| apps/ensrainbow/src/lib/api.ts | Changes createApi to accept a concrete publicConfig and gates readiness/DB routes on dbConfigSupplier(). |
| apps/ensrainbow/src/config/public.ts | Refactors public config building to allow construction directly from a label set (pre-DB). |
| apps/ensrainbow/src/commands/server-command.ts | Updates createApi call site to new signature. |
| apps/ensrainbow/src/commands/server-command.test.ts | Updates tests to assert /v1/config returns 200 pre-attach while other DB-backed endpoints remain 503. |
| apps/ensrainbow/src/commands/entrypoint-command.ts | Builds public config eagerly from args; adds env-vs-DB label-set mismatch detection and an injectable exit hook. |
| apps/ensrainbow/src/commands/entrypoint-command.test.ts | Adds tests for early /v1/config and mismatch-triggered exit/readiness behavior. |
| .changeset/ensrainbow-eager-public-config.md | Changeset describing the behavioral change and mismatch handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Changed the exit function type from `never` to `void` for better clarity. - Introduced a `requestExit` function to manage exit requests and handle potential errors gracefully. - Updated comments to reflect the new exit handling mechanism.
There was a problem hiding this comment.
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 `@docs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdx`:
- Around line 214-217: Update the /v1/config docs to reflect eager startup
semantics: change the description of serverLabelSet (and its fields
serverLabelSet.labelSetId and serverLabelSet.highestLabelSetVersion) from “the
label set managed by the ENSRainbow instance / DB-loaded values” to “configured
startup label-set values (validated against DB during bootstrap)”; keep
versionInfo.ensRainbow as the service version and ensure the text makes clear
these values are CLI/env-derived at startup and then validated against the DB
during bootstrap.
🪄 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: f33bec33-f769-42ae-b361-fbdae026a49f
📒 Files selected for processing (7)
.changeset/ensrainbow-eager-public-config.mdapps/ensrainbow/src/commands/entrypoint-command.test.tsapps/ensrainbow/src/commands/entrypoint-command.tsapps/ensrainbow/src/commands/server-command.test.tsapps/ensrainbow/src/config/public.tsapps/ensrainbow/src/lib/api.tsdocs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdx
There was a problem hiding this comment.
Pull request overview
This PR makes ENSRainbow’s public configuration (GET /v1/config) available immediately on startup (before DB bootstrap completes) by building it eagerly from CLI/env label-set arguments, while keeping /ready and DB-backed endpoints gated on DB attach + post-bootstrap validation (including env-vs-DB label-set mismatch handling).
Changes:
- Serve
/v1/configfrom an eagerly built in-memory config (no longer 503 during bootstrap). - Gate
/readyand DB-backed routes on a non-nullDbConfigsnapshot; add explicit env-vs-DB label-set mismatch termination behavior. - Add/adjust tests and update docs + changeset to reflect the new readiness/config semantics.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdx | Documents /v1/config as available immediately and updates the response shape/semantics. |
| apps/ensrainbow/src/lib/api.ts | Updates API wiring to accept a concrete publicConfig and gate DB-backed endpoints on DbConfig availability. |
| apps/ensrainbow/src/config/public.ts | Refactors public config construction to support building from a label set (pre-DB) or DbConfig (post-DB). |
| apps/ensrainbow/src/commands/server-command.ts | Adapts to the new createApi signature (pass publicConfig directly). |
| apps/ensrainbow/src/commands/server-command.test.ts | Updates server API construction and adds pending-server assertions for eager /v1/config. |
| apps/ensrainbow/src/commands/entrypoint-command.ts | Builds public config eagerly from CLI/env; adds mismatch validation + injectable exit hook for tests. |
| apps/ensrainbow/src/commands/entrypoint-command.test.ts | Adds coverage for early /v1/config availability and env-vs-DB mismatch exit behavior. |
| .changeset/ensrainbow-eager-public-config.md | Records the behavior change for release notes/versioning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR makes ENSRainbow's Confidence Score: 5/5Safe to merge — logic is sound and all new code paths are covered by tests. No P0 or P1 issues found. The one P2 finding (an unreachable apps/ensrainbow/src/commands/entrypoint-command.ts — minor dead-code guard, no action required to merge. Important Files Changed
Sequence DiagramsequenceDiagram
participant EP as entrypointCommand
participant HTTP as HTTP Server
participant BS as runDbBootstrap (setTimeout)
participant DB as Database
participant Client as ENSIndexer / Client
EP->>EP: buildEnsRainbowPublicConfigFromLabelSet(args)
EP->>HTTP: serve(app) — binds port
EP->>BS: schedule via setTimeout(0)
Client->>HTTP: GET /v1/config
HTTP-->>Client: 200 (in-memory config)
Client->>HTTP: GET /ready
HTTP-->>Client: 503 (dbConfigSupplier = null)
BS->>DB: open / download + extract
DB-->>BS: attached
alt label set matches
BS->>EP: cachedDbConfig = dbConfig
Client->>HTTP: GET /ready
HTTP-->>Client: 200
Client->>HTTP: GET /v1/heal/:labelhash
HTTP-->>Client: 200 / healed label
else label set mismatch
BS->>EP: resolvePromise() + requestExit(1)
EP->>EP: process.exit(1)
Client->>HTTP: GET /ready
HTTP-->>Client: 503 (cachedDbConfig still null)
end
Reviews (3): Last reviewed commit: "refactor(ensrainbow): enhance exit hook ..." | Re-trigger Greptile |
lightwalker-eth
left a comment
There was a problem hiding this comment.
@djstrong Looks good, thank you 🫡 Please take the lead to merge when ready 👍
…nfig building - Changed the exit function type in EntrypointCommandOptions from `void` to `never` to enforce non-return behavior. - Updated the server command tests to utilize the new `buildEnsRainbowPublicConfigFromLabelSet` function for improved clarity and functionality.
There was a problem hiding this comment.
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/ensrainbow/src/commands/entrypoint-command.ts`:
- Around line 53-60: The optional exit hook (exit?: (code: number) => never) is
only a TypeScript guarantee; at runtime a test or misconfigured implementation
can return normally and leave the server running. Update the places that call
this.exit(...) (the exit property on the EntryPointCommand and the bootstrap
error handlers around the block referenced at lines ~186–196) to enforce the
non-returning contract: call the hook, then if it returns, immediately throw a
new Error (or call process.exit as a fallback) so the process cannot continue;
ensure the same enforcement exists in both the initial bootstrap failure and the
env-vs-DB mismatch paths. Reference the exit property on the EntryPointCommand
and the bootstrap/error handler methods when making the change.
🪄 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: b33ef739-ed71-4d28-8104-9cd99ac28770
📒 Files selected for processing (3)
apps/ensrainbow/src/commands/entrypoint-command.tsapps/ensrainbow/src/commands/server-command.test.tsdocs/ensnode.io/src/content/docs/ensrainbow/usage/api.mdx
…onstructor - Eliminated the one-time async readiness hook from the PublicConfigBuilder constructor to streamline the configuration process. - Updated related tests to reflect the removal of the readiness check, ensuring they still validate the expected behavior of the public config retrieval.
- Updated the exit function in EntrypointCommandOptions to ensure it throws an error instead of returning, enforcing the non-returning contract. - Improved the requestExit function to handle cases where the exit hook may return, adding a fallback to process.exit to prevent the server from running in a failed state. - Updated comments for clarity on the exit handling mechanism and its implications for testing.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Lite PR
Tip: Review docs on the ENSNode PR process
Summary
GET /v1/configimmediately on startup (entrypoint mode), using CLI/env label-set values.GET /readyandGET /v1/heal/:labelhashare now aligned to only succeed once bootstrap has completed and DB-backed config is published; docs + tests updated.Why
EnsRainbowPublicConfigas soon as possible.Testing
Notes for Reviewer (Optional)
entrypointCommandbuilds/v1/configfromLABEL_SET_ID/LABEL_SET_VERSIONimmediately, then validates those values against DB metadata after bootstrap; on mismatch it exits (testable via an injectedexithook).Pre-Review Checklist (Blocking)