Skip to content

Use Ponder runtime logger across ENSIndexer app#1864

Merged
shrugs merged 15 commits intomainfrom
feat/ensindexer-logger-from-ponder
Apr 3, 2026
Merged

Use Ponder runtime logger across ENSIndexer app#1864
shrugs merged 15 commits intomainfrom
feat/ensindexer-logger-from-ponder

Conversation

@tk-o
Copy link
Copy Markdown
Contributor

@tk-o tk-o commented Apr 2, 2026

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • Updated Ponder SDK to include Ponder runtim logger instance in PonderAppContext data model.
  • Integrated the updated PonderAppContext data model into ENSIndexer app.
    • Created the @/lib/logger module which includes the logger export.
    • Created formatLogParam helper to format additional params passed along the log message.
  • Replaced console.log with logger.info (or logger.debug if deemed more suitable).
  • Replaced console.warn with logger.warn.
  • Replaced console.error with logger.error.

Log output after the changes

image

Why

ENSIndexer logs output has been inconsitent, as pointed out in this PR comment with feedack.

Inconsitent Log output

Different approach to formatting different log messages.

image

Testing

  • Ran local ENSIndexer and observed if all log messages are consistent now in terms of formatting.

Notes for Reviewer (Optional)

  • Please review commit-by-commit
  • formatLogParam allows to manage white-spaces for printed logs params. Ideally, single log message should be printend within a single line (no pretty-priting of JSON objects). This is to improve logs readability on the cloud platform side.
Pasted_Image_2_4_2026__14_24

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 April 2, 2026 12:27
Copilot AI review requested due to automatic review settings April 2, 2026 12:27
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 2, 2026

🦋 Changeset detected

Latest commit: c6b7cf7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
ensindexer Major
@ensnode/ponder-sdk Major
ensadmin Major
ensrainbow Major
ensapi Major
fallback-ensapi Major
enssdk Major
enscli Major
enskit Major
ensskills Major
@ensnode/datasources Major
@ensnode/ensrainbow-sdk Major
@ensnode/ensdb-sdk Major
@ensnode/ensnode-react Major
@ensnode/ensnode-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
@ensnode/integration-test-env Patch

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

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 2, 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 Apr 3, 2026 3:37pm
ensnode.io Skipped Skipped Apr 3, 2026 3:37pm
ensrainbow.io Skipped Skipped Apr 3, 2026 3:37pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

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

Adds a structured Ponder logger API and logger field to PonderAppContext, validates and wraps runtime-provided loggers, and replaces ad‑hoc console.* usages across ENSIndexer with structured logger calls plus local context wiring and test mocks.

Changes

Cohort / File(s) Summary
SDK: logger types, wrapper & deserialization
packages/ponder-sdk/src/ponder-app-logger.ts, packages/ponder-sdk/src/deserialize/ponder-app-logger.ts, packages/ponder-sdk/src/deserialize/ponder-app-context.ts, packages/ponder-sdk/src/ponder-app-context.ts, packages/ponder-sdk/src/index.ts
Introduce PonderAppLog/PonderAppLogger types, wrapPonderAppLogger (normalizes/serializes log payloads), validate/transform a required logger during context deserialization, and re-export logger utilities.
SDK: local mock
packages/ponder-sdk/src/local-ponder-client.mock.ts
Add a no-op logger to the mock ponderAppContext.
Local context & logger export
apps/ensindexer/src/lib/local-ponder-context.ts, apps/ensindexer/src/lib/logger.ts, apps/ensindexer/src/lib/local-ponder-client.ts
Add localPonderContext (deserialized from globalThis.PONDER_COMMON), export logger from local context, and update local client to consume localPonderContext.
Global replacement: console. → logger*
apps/ensindexer/ponder/ponder.config.ts, apps/ensindexer/ponder/src/api/index.ts, apps/ensindexer/ponder/src/api/handlers/ensnode-api.ts, apps/ensindexer/src/lib/dns-helpers.ts, apps/ensindexer/src/lib/version-info.ts, apps/ensindexer/src/lib/graphnode-helpers.ts, apps/ensindexer/src/plugins/ensv2/handlers/ensv1/NameWrapper.ts, apps/ensindexer/src/lib/ensrainbow/singleton.ts, apps/ensindexer/src/lib/ensdb/migrate-ensnode-schema.ts
Replace scattered console.log/warn/error with structured logger.* calls; payloads standardized (msg, module, contextual fields); control flow unchanged.
Workers & singletons
apps/ensindexer/src/lib/ensdb-writer-worker/..., apps/ensindexer/src/lib/ensdb-writer-worker/singleton.ts
Convert worker logging to structured logger calls, add retry/fetch attempt logs and a configFetchRetries constant; behavior and error handling preserved.
Tests: logger mock & updates
apps/ensindexer/src/lib/__test__/mockLogger.ts, apps/ensindexer/src/lib/dns-helpers.test.ts, apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.test.ts, apps/ensindexer/src/lib/graphnode-helpers.test.ts
Add Vitest mockLogger (global assignment and vi.mock), import it in tests and update spies/assertions to observe logger calls.
Config helper rename
packages/ensnode-sdk/src/shared/config/pretty-printing.ts, apps/ensrainbow/src/commands/server-command.ts
Rename/replace prettyPrintJson with stringifyConfig(..., { pretty }) and update call sites accordingly.
Changesets
.changeset/warm-geese-fall.md, .changeset/fast-coins-grab.md
Record minor bumps: @ensnode/ponder-sdk (adds logger) and ensindexer (structured logging migration).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I found a tidy logger in the glade,

no more stray console crumbs to be made.
Msgs hop in order, with module and cheer,
errors now rest safe, with context near. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: integrating Ponder runtime logger across the ENSIndexer application.
Description check ✅ Passed The PR description covers all required template sections with clear summaries, rationale, testing approach, and reviewer notes.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ensindexer-logger-from-ponder

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
Copy Markdown
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 standardizes logging across the ENSIndexer app by routing logs through Ponder’s runtime logger, and updates @ensnode/ponder-sdk’s app context model to expose that logger consistently.

Changes:

  • Extend PonderAppContext to include a runtime logger and validate it during deserialization.
  • Add apps/ensindexer/src/lib/logger.ts (runtime logger + formatLogParam) and replace console.* usage with structured logger calls across ENSIndexer.
  • Update Vitest tests to mock the logger module and assert against logger.* calls.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/ponder-sdk/src/ponder-app-context.ts Adds PonderAppLogger and logger field on PonderAppContext.
packages/ponder-sdk/src/local-ponder-client.mock.ts Updates mock context to include a no-op logger.
packages/ponder-sdk/src/deserialize/ponder-app-context.ts Validates/deserializes logger from PONDER_COMMON into PonderAppContext.
apps/ensindexer/src/lib/logger.ts New logger wrapper pulling from globalThis.PONDER_COMMON.logger + formatLogParam.
apps/ensindexer/src/lib/test/mockLogger.ts New helper to mock @/lib/logger in Vitest.
apps/ensindexer/src/plugins/ensv2/handlers/ensv1/NameWrapper.ts Replaces a console.warn with logger.warn.
apps/ensindexer/src/lib/version-info.ts Replaces console.warn with structured logger.error on lookup failure.
apps/ensindexer/src/lib/graphnode-helpers.ts Replaces retry warning logs with structured logger.warn.
apps/ensindexer/src/lib/graphnode-helpers.test.ts Updates tests to spy on logger.warn instead of console.warn.
apps/ensindexer/src/lib/ensraibow-api-client.ts Replaces console.warn with structured warning about default ENSRainbow endpoint.
apps/ensindexer/src/lib/ensdb/migrate-ensnode-schema.ts Replaces console.log with logger.debug/info around migrations.
apps/ensindexer/src/lib/ensdb-writer-worker/singleton.ts Replaces console.error with logger.error for worker failures.
apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.ts Replaces multiple console.* calls with structured logger calls across worker lifecycle.
apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.test.ts Ensures logger is mocked for worker tests.
apps/ensindexer/src/lib/dns-helpers.ts Replaces console.warn with structured logger.warn in DNS parsing helpers.
apps/ensindexer/src/lib/dns-helpers.test.ts Ensures logger is mocked for DNS helper tests.
apps/ensindexer/ponder/src/api/index.ts Uses runtime logger for init and API error handling.
apps/ensindexer/ponder/src/api/handlers/ensnode-api.ts Uses runtime logger for API error handling.
apps/ensindexer/ponder/ponder.config.ts Logs startup config and plugin warnings via runtime logger.
.changeset/warm-geese-fall.md Changeset for @ensnode/ponder-sdk context update.
.changeset/cuddly-steaks-jog.md Changeset for ENSIndexer logging enhancement.

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

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 2, 2026

Greptile Summary

This PR replaces all console.log/warn/error calls across the ENSIndexer app with a structured Ponder runtime logger, improving log consistency and cloud-platform readability. It introduces:

  • A new PonderAppLogger interface and PonderAppLog type in @ensnode/ponder-sdk
  • A wrapPonderAppLogger utility that automatically JSON-stringifies complex parameters and silently filters non-Error values from the error field
  • A localPonderContext module centralizing PONDER_COMMON deserialization
  • A @/lib/logger re-export module consumed across ENSIndexer
  • Updated Zod deserialization schemas to validate and wrap the Ponder runtime logger
  • Test infrastructure (mockLogger.ts) to avoid the PONDER_COMMON check in unit tests
  • stringifyConfig API replacing the deprecated prettyPrintJson helper

The structural design is clean and the abstraction layers are well-separated. The wrapper's intentional behavior of silently dropping non-Error values in the error field is consistent across all call sites, matching the documented approach agreed on in prior review discussions.

Confidence Score: 5/5

Safe to merge — all remaining findings are P2 style suggestions that do not affect correctness or runtime behavior

All prior P1 concerns from earlier review rounds have been acknowledged and deliberately resolved (error-dropped warnings, log-level escalation). The new logger infrastructure is well-typed, correctly pipelines through Zod validation, and the wrapLogMethod silent-filter behavior is intentional and documented. The only new findings are a misplaced import in a test file and a redundant/misleading comment in mockLogger.ts — neither blocks merge.

No files require special attention; minor style notes on apps/ensindexer/src/lib/graphnode-helpers.test.ts and apps/ensindexer/src/lib/test/mockLogger.ts

Important Files Changed

Filename Overview
packages/ponder-sdk/src/ponder-app-logger.ts New file defining PonderAppLogger interface and PonderAppLog type; well-typed and clearly documented
packages/ponder-sdk/src/deserialize/ponder-app-logger.ts New wrapPonderAppLogger utility with clear logic for formatting log values and filtering non-Error error fields; no issues
packages/ponder-sdk/src/deserialize/ponder-app-context.ts Adds logger field to Zod schema pipeline; correctly validates raw logger then wraps it via schemaPonderAppLogger transform
apps/ensindexer/src/lib/local-ponder-context.ts New module centralizing PONDER_COMMON deserialization with a clear guard; clean extraction from local-ponder-client.ts
apps/ensindexer/src/lib/logger.ts Minimal re-export of the Ponder runtime logger from localPonderContext; simple and correct
apps/ensindexer/src/lib/test/mockLogger.ts Test mock for logger; PONDER_COMMON setup is redundant given the vi.mock override, and the comment referencing importOriginal is misleading
apps/ensindexer/src/lib/graphnode-helpers.test.ts Updates console.warn spies to logger.warn spies; import of logger placed mid-file after vi.mock calls (unusual but functionally correct via ESM hoisting)
apps/ensindexer/src/lib/ensrainbow/singleton.ts All console calls replaced with structured logger; adds conditional error attachment on last retry attempt
apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.ts Comprehensive replacement of console calls with structured logger; adds debug-level pre-action logs
packages/ensnode-sdk/src/shared/config/pretty-printing.ts Renames prettyPrintJson to stringifyConfig and adds a pretty option; clean API improvement

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Ponder runtime global] -->|injected at startup| B[local-ponder-context.ts
deserializePonderAppContext]
    B --> C[Validate raw logger shape
via Zod schema]
    C --> D[wrapPonderAppLogger
auto-formats log params]
    D --> E[localPonderContext.logger]
    E --> F[lib/logger.ts
singleton export]
    F --> G[ponder.config.ts]
    F --> H[api/index.ts + ensnode-api.ts]
    F --> J[ensdb-writer-worker.ts]
    F --> K[ensrainbow/singleton.ts]
    F --> L[dns-helpers.ts, graphnode-helpers.ts, NameWrapper.ts, version-info.ts]
    D --> M{wrapLogMethod per call}
    M -->|string/number/boolean/Error| N[pass through unchanged]
    M -->|plain object| O[JSON.stringify compact
URL to href, Map to obj, Set to arr]
    M -->|error field with non-Error value| P[filtered out silently]
Loading

Reviews (4): Last reviewed commit: "Apply AI PR feedback" | Re-trigger Greptile

Copy link
Copy Markdown
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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/cuddly-steaks-jog.md:
- Line 5: The changeset description contains a typo: replace the word "apporach"
with "approach" in the .changeset/cuddly-steaks-jog.md changeset description so
the release note reads "Enhanced application logging approach to use a
streamlined logger implementation across ENSIndexer app." Ensure only the
misspelled word is corrected and the rest of the sentence remains unchanged.

In `@apps/ensindexer/src/lib/dns-helpers.ts`:
- Line 171: The warning messages in parseDnsTxtRecordArgs use inconsistent
function labels and unstructured payloads: replace the hardcoded prefix
"parseDNSRecordArgs" with the correct function name parseDnsTxtRecordArgs and
pass a structured single-line payload using formatLogParam(txtDatas) instead of
pre-joining answers/strings; update all logger.warn calls in that function
(including the one currently logging `No TXT answers found...` and the
neighboring warnings at lines ~178-181) to use logger.warn({ msg:
'parseDnsTxtRecordArgs: ...', ...formatLogParam(txtDatas) }) or equivalent
structured payload so logs are consistent and searchable.

In `@apps/ensindexer/src/lib/logger.ts`:
- Around line 18-23: The current formatLogParam function mutates string payloads
by using .replace(": ", ":"), which will change legitimate top-level string
values; remove that replacement and only trim each line from prettyPrintJson
(i.e., keep prettyPrintJson(param).split("\n").map(line =>
line.trim()).join("").trim()) so you preserve original string contents; update
the formatLogParam implementation (referenced by function name formatLogParam
and the use of prettyPrintJson) accordingly.
🪄 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: f1e73f32-f53d-4b74-a87b-b90d1fda1800

📥 Commits

Reviewing files that changed from the base of the PR and between d6063f4 and 08ff1ef.

📒 Files selected for processing (21)
  • .changeset/cuddly-steaks-jog.md
  • .changeset/warm-geese-fall.md
  • apps/ensindexer/ponder/ponder.config.ts
  • apps/ensindexer/ponder/src/api/handlers/ensnode-api.ts
  • apps/ensindexer/ponder/src/api/index.ts
  • apps/ensindexer/src/lib/__test__/mockLogger.ts
  • apps/ensindexer/src/lib/dns-helpers.test.ts
  • apps/ensindexer/src/lib/dns-helpers.ts
  • apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.test.ts
  • apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.ts
  • apps/ensindexer/src/lib/ensdb-writer-worker/singleton.ts
  • apps/ensindexer/src/lib/ensdb/migrate-ensnode-schema.ts
  • apps/ensindexer/src/lib/ensraibow-api-client.ts
  • apps/ensindexer/src/lib/graphnode-helpers.test.ts
  • apps/ensindexer/src/lib/graphnode-helpers.ts
  • apps/ensindexer/src/lib/logger.ts
  • apps/ensindexer/src/lib/version-info.ts
  • apps/ensindexer/src/plugins/ensv2/handlers/ensv1/NameWrapper.ts
  • packages/ponder-sdk/src/deserialize/ponder-app-context.ts
  • packages/ponder-sdk/src/local-ponder-client.mock.ts
  • packages/ponder-sdk/src/ponder-app-context.ts

@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Apr 2, 2026

@greptile review

Copy link
Copy Markdown
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: 2

♻️ Duplicate comments (1)
apps/ensindexer/src/lib/version-info.ts (1)

67-70: ⚠️ Potential issue | 🟡 Minor

Use logger.warn for this handled fallback path.

This branch recovers by returning "unknown", so logging at error level will over-report non-fatal behavior.

Proposed fix
-    logger.error({
+    logger.warn({
       msg: `Could not find version for ${packageName}`,
       error: buildLogError(error),
     });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/ensindexer/src/lib/version-info.ts` around lines 67 - 70, The catch
branch in getVersionForPackage (the block that currently calls logger.error with
msg `Could not find version for ${packageName}` and error: buildLogError(error))
is a handled fallback that returns "unknown", so change the logging level from
logger.error to logger.warn (and keep the same message and error payload) to
avoid over-reporting non-fatal conditions; update the call that references
packageName and buildLogError(error) accordingly.
🤖 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/ensindexer/src/lib/__test__/mockLogger.ts`:
- Around line 4-9: The test logger stub mockLogger is missing the trace method
that exists on the runtime PonderAppLogger, causing tests that call
logger.trace(...) to fail; update the mock by adding a trace: vi.fn() property
to the mockLogger object and any other test logger stubs (the other instance
noted) so the test stub matches the PonderAppLogger contract.

In `@apps/ensindexer/src/lib/ensdb-writer-worker/singleton.ts`:
- Around line 39-42: The logger.error call in singleton.ts is missing the module
field used elsewhere; update the call to include module:
formatLogParam("EnsDbWriterWorker") alongside the existing msg and error fields
and ensure formatLogParam is imported together with buildLogError (i.e., add
formatLogParam to the import list) so logs match the structured format used by
other EnsDbWriterWorker entries.

---

Duplicate comments:
In `@apps/ensindexer/src/lib/version-info.ts`:
- Around line 67-70: The catch branch in getVersionForPackage (the block that
currently calls logger.error with msg `Could not find version for
${packageName}` and error: buildLogError(error)) is a handled fallback that
returns "unknown", so change the logging level from logger.error to logger.warn
(and keep the same message and error payload) to avoid over-reporting non-fatal
conditions; update the call that references packageName and buildLogError(error)
accordingly.
🪄 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: f9103bb3-bb1a-41ec-9edf-78e44cc74e65

📥 Commits

Reviewing files that changed from the base of the PR and between 08ff1ef and b8161e7.

📒 Files selected for processing (12)
  • .changeset/fast-coins-grab.md
  • apps/ensindexer/ponder/src/api/index.ts
  • apps/ensindexer/src/lib/__test__/mockLogger.ts
  • apps/ensindexer/src/lib/dns-helpers.test.ts
  • apps/ensindexer/src/lib/dns-helpers.ts
  • apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.test.ts
  • apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.ts
  • apps/ensindexer/src/lib/ensdb-writer-worker/singleton.ts
  • apps/ensindexer/src/lib/graphnode-helpers.test.ts
  • apps/ensindexer/src/lib/logger.ts
  • apps/ensindexer/src/lib/version-info.ts
  • packages/ponder-sdk/src/ponder-app-context.ts

Copilot AI review requested due to automatic review settings April 2, 2026 15:39
Comment on lines +63 to +72
logger.warn({
msg: `ENSRainbow health check failed`,
attempt: attemptNumber,
retriesLeft,
error: buildLogError(retriesLeft === 0 ? error : undefined),
ensRainbowInstance: formatLogParam(ensRainbowUrl.href),
advice: formatLogParam(
`This might be due to ENSRainbow having a cold start, which can take 30+ minutes.`,
),
});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This produces a really nice log message:

17:38:43.661 WARN  ENSRainbow health check failed attempt=1 retriesLeft=60 ensRainbowInstance="http://localhost:3223/" advice="This might be due to ENSRainbow having a cold start, which can take 30+ minutes."

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

♻️ Duplicate comments (1)
apps/ensindexer/src/lib/version-info.ts (1)

67-70: ⚠️ Potential issue | 🟡 Minor

Use logger.warn instead of logger.error for gracefully handled exceptions.

This exception is caught and handled gracefully by returning "unknown". Since the application continues to function normally, logger.warn is the appropriate level. Reserve logger.error for unrecoverable failures or critical issues that require immediate attention.

🛠️ Proposed fix
-    logger.error({
+    logger.warn({
       msg: `Could not find version for ${packageName}`,
       error,
     });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/ensindexer/src/lib/version-info.ts` around lines 67 - 70, The caught
exception in version-info.ts that logs the missing package version is currently
using logger.error even though the code handles it gracefully (returns
"unknown"); change the call to logger.warn so the event is recorded at warning
level instead of error, keeping the same message and error object. Locate the
logger.error call that references packageName and error in the getVersion /
version retrieval logic and replace it with logger.warn to reflect that this is
non-fatal.
🤖 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/ponder-sdk/src/deserialize/ponder-app-context.ts`:
- Around line 46-55: The deserialize pipeline is double-wrapping the runtime
logger: schemaPonderAppLogger applies .transform(wrapPonderAppLogger) and the
same transform is applied again later when the raw schema is piped into the
final schema; remove the redundant second wrap so the runtime logger is wrapped
exactly once. Locate schemaPonderAppLogger and any other schemas listed (lines
referenced around 64, 78, 94) that call wrapPonderAppLogger and eliminate the
duplicate .transform(wrapPonderAppLogger) application (keep the transform in
only one canonical place), or conditionally apply the wrapper only when the
input is not already wrapped to prevent double-wrapping.

---

Duplicate comments:
In `@apps/ensindexer/src/lib/version-info.ts`:
- Around line 67-70: The caught exception in version-info.ts that logs the
missing package version is currently using logger.error even though the code
handles it gracefully (returns "unknown"); change the call to logger.warn so the
event is recorded at warning level instead of error, keeping the same message
and error object. Locate the logger.error call that references packageName and
error in the getVersion / version retrieval logic and replace it with
logger.warn to reflect that this is non-fatal.
🪄 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: ab6c8cf0-315e-4eb7-a6ec-2f330d70ebe8

📥 Commits

Reviewing files that changed from the base of the PR and between d47e15c and 009b53f.

📒 Files selected for processing (18)
  • apps/ensindexer/ponder/ponder.config.ts
  • apps/ensindexer/ponder/src/api/handlers/ensnode-api.ts
  • apps/ensindexer/ponder/src/api/index.ts
  • apps/ensindexer/src/lib/__test__/mockLogger.ts
  • apps/ensindexer/src/lib/dns-helpers.ts
  • apps/ensindexer/src/lib/ensdb-writer-worker/ensdb-writer-worker.ts
  • apps/ensindexer/src/lib/ensdb-writer-worker/singleton.ts
  • apps/ensindexer/src/lib/ensdb/migrate-ensnode-schema.ts
  • apps/ensindexer/src/lib/ensrainbow/singleton.ts
  • apps/ensindexer/src/lib/local-ponder-client.ts
  • apps/ensindexer/src/lib/local-ponder-context.ts
  • apps/ensindexer/src/lib/logger.ts
  • apps/ensindexer/src/lib/version-info.ts
  • packages/ponder-sdk/src/deserialize/ponder-app-context.ts
  • packages/ponder-sdk/src/deserialize/ponder-app-logger.ts
  • packages/ponder-sdk/src/index.ts
  • packages/ponder-sdk/src/ponder-app-context.ts
  • packages/ponder-sdk/src/ponder-app-logger.ts

Copilot AI review requested due to automatic review settings April 3, 2026 05:52
@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Apr 3, 2026

@greptile review

@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Apr 3, 2026

@shrugs nice suggestions! I've put the logger wrapper functionality into Ponder SDK so anyone could use the logger with nice auto-formatting applied 👍 It's in packages/ponder-sdk/src/deserialize/ponder-app-logger.ts file.

Copy link
Copy Markdown
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: 2

🤖 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/shared/config/pretty-printing.ts`:
- Around line 33-34: The stringifyConfig function passes the indentation arg to
JSON.stringify inverted; currently options.pretty true yields compact output.
Update the call in stringifyConfig to pass options.pretty ? 2 : undefined (i.e.,
use 2 spaces when pretty is true, undefined when false) while keeping the
configJSONReplacer argument intact so pretty=true produces an indented string
and pretty=false produces compact output.
- Line 31: Remove the redundant `@returns` JSDoc tag in the JSDoc block in
pretty-printing.ts (the doc block describing the function that returns "The JSON
string representation of the config object"); edit the JSDoc immediately above
that function to delete the lone "@returns The JSON string representation of the
config object" line so the summary remains but the redundant `@returns` tag is
removed.
🪄 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: c7b2c7c0-9eaf-4ef0-8ea4-49f1c14be538

📥 Commits

Reviewing files that changed from the base of the PR and between 009b53f and d80ea92.

📒 Files selected for processing (3)
  • apps/ensrainbow/src/commands/server-command.ts
  • packages/ensnode-sdk/src/shared/config/pretty-printing.ts
  • packages/ponder-sdk/src/deserialize/ponder-app-context.ts

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

Copilot reviewed 28 out of 28 changed files in this pull request and generated 7 comments.


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

Comment on lines +48 to +57
function formatLogValue(value: unknown): unknown {
// Primitives pass through
if (isPrimitive(value)) return value;

// Error instances pass through (handled specially by logger)
if (value instanceof Error) return value;

// Otherwise JSON stringify with replacer
return JSON.stringify(value, replacer);
}
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

formatLogValue uses JSON.stringify for non-primitive objects, which will throw for common values in the EVM/TypeScript ecosystem (notably objects containing nested bigint values) and for circular structures. A logger wrapper should avoid throwing, otherwise a logging attempt can crash the app.

Consider extending the replacer to safely serialize bigint (e.g. to string) and wrapping JSON.stringify in a try/catch with a safe fallback (like String(value) or a sentinel like "[Unserializable]").

Copilot uses AI. Check for mistakes.
tk-o added 2 commits April 3, 2026 08:04
Part of streamling formatting for logging config objects
@tk-o
Copy link
Copy Markdown
Contributor Author

tk-o commented Apr 3, 2026

@greptile review

Copilot AI review requested due to automatic review settings April 3, 2026 15:37
@vercel vercel bot temporarily deployed to Preview – ensnode.io April 3, 2026 15:37 Inactive
@vercel vercel bot temporarily deployed to Preview – ensrainbow.io April 3, 2026 15:37 Inactive
@vercel vercel bot temporarily deployed to Preview – admin.ensnode.io April 3, 2026 15:37 Inactive
Copy link
Copy Markdown
Collaborator

@shrugs shrugs left a comment

Choose a reason for hiding this comment

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

LGTM!

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

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


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

@shrugs shrugs merged commit 065ecbe into main Apr 3, 2026
22 checks passed
@shrugs shrugs deleted the feat/ensindexer-logger-from-ponder branch April 3, 2026 15:51
@github-actions github-actions bot mentioned this pull request Apr 3, 2026
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