Skip to content

feat: include commit reference in stack info for each ENSNode service#2341

Merged
tk-o merged 5 commits into
mainfrom
feat/include-commit-ref
Jul 7, 2026
Merged

feat: include commit reference in stack info for each ENSNode service#2341
tk-o merged 5 commits into
mainfrom
feat/include-commit-ref

Conversation

@tk-o

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

Copy link
Copy Markdown
Member

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • Building official docker images for ENSNode services (ENSApi, ENSIndexer, ENSRainbow) requires passing the GIT_COMMIT build arg. The GIT_COMMIT arg value will be "baked" into the final docker image for each service.
  • Version info data model for each of those ENSNode services was extended with an optional commit: string field. The commit field will be optionally available in the following data models: EnsApiStackInfo, EnsIndexerStackInfo, and EnsRainbowStackInfo.

Why

  • The promote_vercel_deployment.sh script needs to know exactly what is the commit sha of the current production environment. So far, we've been relying on a query to the Railway platform to fetch that info, but having the yellow env in the production env mix requires updating the approach.

Testing

  • Ran lint, typecheck and test scripts.
  • Built docker images locally for ENSApi, ENSIndexer, and ENSRainbow apps
    • Tested both cases when GIT_COMMIT is defined and undefined. Both worked fine.

Notes for Reviewer (Optional)

  • Unblocks PR Split CI/CD workflows for ENSNode and ENSDb Playground deployments #2338
    • Makes it possible to get the commit sha of for any ENSApi/ENSIndexer/ENSRainbow instance. For example, fetching commit sha from the ENSIndexer Alpha instance running in the yellow env:
      curl \
      --silent \
      --show-error \
      --fail \
      --url "https://api.alpha.yellow.ensnode.io/api/indexing-status" | \
      jq -r '.stackInfo.ensIndexer.versionInfo.ensIndexer'

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)

Copilot AI review requested due to automatic review settings June 30, 2026 14:48
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Jul 3, 2026 2:55pm
enskit-react-example.ensnode.io Ready Ready Preview, Comment Jul 3, 2026 2:55pm
ensnode.io Ready Ready Preview, Comment Jul 3, 2026 2:55pm
ensrainbow.io Ready Ready Preview, Comment Jul 3, 2026 2:55pm

@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6a7ee26

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

@tk-o

tk-o commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

@greptile review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@tk-o, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 73ce3e17-c370-46d0-9cae-6dc60960fb82

📥 Commits

Reviewing files that changed from the base of the PR and between f95dadb and 6a7ee26.

📒 Files selected for processing (32)
  • .github/workflows/release.yml
  • .github/workflows/release_preview.yml
  • .github/workflows/release_snapshot.yml
  • apps/ensapi/Dockerfile
  • apps/ensapi/src/config/environment.ts
  • apps/ensapi/src/lib/version-info.ts
  • apps/ensindexer/Dockerfile
  • apps/ensindexer/src/config/environment.ts
  • apps/ensindexer/src/lib/public-config-builder/public-config-builder.test.ts
  • apps/ensindexer/src/lib/public-config-builder/public-config-builder.ts
  • apps/ensindexer/src/lib/version-info.ts
  • apps/ensrainbow/Dockerfile
  • apps/ensrainbow/src/config/config.schema.test.ts
  • apps/ensrainbow/src/config/environment.ts
  • apps/ensrainbow/src/config/public.ts
  • docker/README.md
  • docker/services/ensapi.yml
  • docker/services/ensindexer.yml
  • docker/services/ensrainbow.yml
  • docs/ensnode.io/ensapi-openapi.json
  • package.json
  • packages/ensnode-sdk/src/ensapi/config/types.ts
  • packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts
  • packages/ensnode-sdk/src/ensindexer/config/types.ts
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts
  • packages/ensnode-sdk/src/ensrainbow/config.ts
  • packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts
  • packages/ensnode-sdk/src/internal.ts
  • packages/ensnode-sdk/src/shared/config/environments.ts
  • packages/ensnode-sdk/src/shared/config/git-ref.test.ts
  • packages/ensnode-sdk/src/shared/config/git-ref.ts
  • packages/ensnode-sdk/src/shared/config/zod-schemas.ts
📝 Walkthrough

Walkthrough

This PR introduces a GIT_COMMIT-based commit reference throughout ENSNode's version-info contracts. GitEnvironment and buildCommitRef/GitCommitShaSchema are added to the shared SDK; ENS API, ENS indexer, and ENS rainbow version-info types, Zod schemas, and public config builders now include an optional commit field defaulting to "unknown". Dockerfiles, Compose services, package build scripts, and CI release workflows pass GIT_COMMIT as a build argument and bake it into image labels/env. Mocks, fixtures, and tests across the SDK and apps are updated accordingly, and documentation describes the new build-time behavior.

Changes

GIT_COMMIT versionInfo propagation

Layer / File(s) Summary
Version-info contracts and commit schemas
packages/ensnode-sdk/src/shared/config/environments.ts, .../zod-schemas.ts, .../git-ref.ts, .../git-ref.test.ts, packages/ensnode-sdk/src/index.ts, packages/ensnode-sdk/src/ensapi/config/types.ts, .../zod-schemas.ts, packages/ensnode-sdk/src/ensindexer/config/types.ts, .../zod-schemas.ts, packages/ensnode-sdk/src/ensrainbow/config.ts, .../zod-schemas/config.ts, apps/ensapi/src/config/environment.ts, apps/ensindexer/src/config/environment.ts, apps/ensrainbow/src/config/environment.ts, docs/ensnode.io/ensapi-openapi.json
Adds GitEnvironment.GIT_COMMIT, GitCommitShaSchema, and buildCommitRef(); adds optional commit fields (defaulting to "unknown") to ENS API, ENS indexer, and ENS rainbow version-info types/schemas; updates app environment type intersections to include GitEnvironment; extends OpenAPI schema for versionInfo.commit.
App commit helpers and public config output
apps/ensapi/src/lib/version-info.ts, apps/ensindexer/src/lib/version-info.ts, apps/ensindexer/src/lib/public-config-builder/public-config-builder.ts, apps/ensrainbow/src/config/public.ts
Adds getEnsApiCommitRef, getEnsIndexerCommitRef, and getEnsRainbowCommitRef helpers that read commit from process.env; wires the derived commit into each app's exported version-info/public config output.
Docker and CI build arg wiring
apps/ensapi/Dockerfile, apps/ensindexer/Dockerfile, apps/ensrainbow/Dockerfile, docker/services/ensapi.yml, docker/services/ensindexer.yml, docker/services/ensrainbow.yml, package.json, .github/workflows/release.yml, .github/workflows/release_preview.yml, .github/workflows/release_snapshot.yml, docker/README.md
Adds GIT_COMMIT build args to Dockerfiles/labels, Compose build args, npm docker build scripts, and CI build steps; documents the new build-time environment usage.
App fixtures and app-level tests
apps/ensindexer/src/lib/public-config-builder/public-config-builder.test.ts, apps/ensindexer/src/lib/stack-info-builder/stack-info-builder.test.ts, apps/ensrainbow/src/config/config.schema.test.ts
Updates mocks and fixtures to stub commit helpers and include commit in expected version-info objects.
SDK config contracts and validation tests
packages/ensnode-sdk/src/ensapi/config/conversions.test.ts, packages/ensnode-sdk/src/ensindexer/config/conversions.test.ts, .../zod-schemas.test.ts, packages/ensnode-sdk/src/ensindexer/client.mock.ts, packages/ensnode-sdk/src/ensnode/client.test.ts, .../metadata/indexing-metadata-context.test.ts, packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.test.ts, packages/ensdb-sdk/src/client/*.mock.ts, .../*.test.ts, packages/ensrainbow-sdk/src/client.test.ts
Updates mock configs and test fixtures with commit values and adds validation tests for missing/empty commit fields.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • namehash/ensnode#1425: Both PRs touch apps/ensrainbow/src/config/config.schema.test.ts, updating buildEnsRainbowPublicConfig test expectations for versionInfo.commit.
  • namehash/ensnode#1859: Both PRs modify the exported ensApiVersionInfo constant in apps/ensapi/src/lib/version-info.ts, this PR extending it with a commit field.

Poem

A rabbit hopped through Docker's maze,
Tagging builds with commit-shas,
"GIT_COMMIT" whispered down the pipe,
Into versionInfo, crisp and ripe.
Now every image knows its birth —
Forty hex chars of true worth! 🐇🔖

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 87.50% 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.
Title check ✅ Passed The title clearly names the main change: adding commit references to stack info for ENSNode services.
Description check ✅ Passed The PR description follows the template and covers summary, why, testing, notes, and checklist items.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/include-commit-ref

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.

@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR bakes a GIT_COMMIT build argument into the ENSApi, ENSIndexer, and ENSRainbow Docker images, exposing the commit SHA through each service's versionInfo.commit field. The implementation introduces a shared buildCommitRef utility with Zod validation and propagates the optional commit field through types, schemas, and the OpenAPI spec.

  • A new GitEnvironment interface and GitCommitShaSchema (40-char enforcement) are added to the SDK; buildCommitRef treats empty/undefined GIT_COMMIT as absent and throws on non-empty invalid values.
  • All three service Dockerfiles, CI workflows, and docker-compose service configs are updated to accept and forward GIT_COMMIT as a build arg baked into the runtime environment.

Confidence Score: 5/5

Safe to merge — the change is additive, the commit field is optional throughout, and all three services fail fast with a clear error if an invalid GIT_COMMIT is supplied.

The core change is strictly additive: an optional field is threaded through existing types and schemas. The buildCommitRef utility correctly handles the absent, empty, and invalid cases. No existing fields are modified or removed. The only gaps are documentation-level: the schema accepts any 40-char string rather than restricting to lowercase hex, and the OpenAPI spec documents minLength: 1 instead of the actual 40-char constraint — neither causes incorrect runtime behaviour.

packages/ensnode-sdk/src/shared/config/zod-schemas.ts and docs/ensnode.io/ensapi-openapi.json — the schema and spec both underspecify the SHA format.

Important Files Changed

Filename Overview
packages/ensnode-sdk/src/shared/config/git-ref.ts New buildCommitRef utility that parses and validates GIT_COMMIT from env; correctly treats empty string as undefined but delegates to GitCommitShaSchema which only checks length (not hex characters).
packages/ensnode-sdk/src/shared/config/zod-schemas.ts Adds GitCommitShaSchema enforcing 40-char length; missing a regex constraint for lowercase hex characters, so non-hex 40-char strings would pass.
packages/ensnode-sdk/src/shared/config/git-ref.test.ts Tests cover undefined, empty, valid, and wrong-length inputs, but missing a case for a 40-char non-hex string that would silently pass current validation.
apps/ensapi/src/lib/version-info.ts Adds getEnsApiCommitRef() called at module-init time (eagerly), so invalid GIT_COMMIT causes a clean startup failure; commit is included in the exported ensApiVersionInfo constant.
apps/ensindexer/src/lib/version-info.ts Adds getEnsIndexerCommitRef() export matching the import in public-config-builder.ts; resolves the missing-export issue from the previous review thread.
apps/ensrainbow/src/config/public.ts Adds commit ref into the ENSRainbow version info via getEnsRainbowCommitRef() called inside the lazy buildEnsRainbowPublicConfigFromLabelSet function; also refactors package-version lookup into a named getEnsRainbowVersion() helper.
docs/ensnode.io/ensapi-openapi.json Added commit property to all versionInfo objects across five locations; field is optional (not in required) but only specifies minLength: 1 rather than the runtime-enforced 40-char constraint.
apps/ensapi/Dockerfile Adds ARG GIT_COMMIT, exports it as ENV GIT_COMMIT, and attaches it as LABEL org.opencontainers.image.revision; identical pattern applied to ENSIndexer and ENSRainbow Dockerfiles.
packages/ensnode-sdk/src/shared/config/environments.ts New GitEnvironment interface with optional GIT_COMMIT?: string added as the shared env type mixed into all three service environments.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Docker build\n--build-arg GIT_COMMIT=sha"] --> B["Dockerfile\nARG GIT_COMMIT\nENV GIT_COMMIT"]
    B --> C["process.env.GIT_COMMIT\nat runtime"]
    C --> D["buildCommitRef(env)"]
    D -->|"empty / undefined"| E["commit: undefined\n(omitted from response)"]
    D -->|"valid 40-char hex string"| F["commit: sha\n(included in versionInfo)"]
    D -->|"non-empty, wrong length"| G["throws Error\n'invalid GIT_COMMIT value'"]
    F --> H["EnsApiVersionInfo\nEnsIndexerVersionInfo\nEnsRainbowVersionInfo"]
    H --> I["/api/indexing-status\nversionInfo.commit"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["Docker build\n--build-arg GIT_COMMIT=sha"] --> B["Dockerfile\nARG GIT_COMMIT\nENV GIT_COMMIT"]
    B --> C["process.env.GIT_COMMIT\nat runtime"]
    C --> D["buildCommitRef(env)"]
    D -->|"empty / undefined"| E["commit: undefined\n(omitted from response)"]
    D -->|"valid 40-char hex string"| F["commit: sha\n(included in versionInfo)"]
    D -->|"non-empty, wrong length"| G["throws Error\n'invalid GIT_COMMIT value'"]
    F --> H["EnsApiVersionInfo\nEnsIndexerVersionInfo\nEnsRainbowVersionInfo"]
    H --> I["/api/indexing-status\nversionInfo.commit"]
Loading

Reviews (6): Last reviewed commit: "Update OpenAPI Spec" | Re-trigger Greptile

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 bakes a Git commit reference into ENSNode service Docker images and exposes it via each service’s public config / stack info versionInfo.commit, enabling operators (and scripts like promote_vercel_deployment.sh) to identify exactly what code is running.

Changes:

  • Add versionInfo.commit across ENSApi / ENSIndexer / ENSRainbow public config models (types + Zod schemas) and update related tests/mocks.
  • Inject GIT_COMMIT into Docker builds (Dockerfiles, docker-compose service build args, and GitHub release workflows).
  • Document the build-time GIT_COMMIT behavior.

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/ensrainbow-sdk/src/client.test.ts Updates SDK client test fixture to include versionInfo.commit.
packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts Extends ENSRainbow public config Zod schema with versionInfo.commit.
packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.test.ts Adds tests validating versionInfo.commit parsing and error messaging.
packages/ensnode-sdk/src/ensrainbow/config.ts Extends ENSRainbow version-info type with commit.
packages/ensnode-sdk/src/ensnode/metadata/indexing-metadata-context.test.ts Updates stack-info test fixtures to include commit fields.
packages/ensnode-sdk/src/ensnode/client.test.ts Updates ENSNode client serialization/deserialization fixtures to include commit fields.
packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts Extends ENSIndexer version-info Zod schema with commit.
packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts Updates Zod schema tests for new commit field.
packages/ensnode-sdk/src/ensindexer/config/types.ts Extends ENSIndexer version-info type with commit.
packages/ensnode-sdk/src/ensindexer/config/conversions.test.ts Updates conversion tests to include commit fields.
packages/ensnode-sdk/src/ensindexer/client.mock.ts Updates ENSIndexer mock config response to include commit fields.
packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts Extends ENSApi version-info Zod schema with commit.
packages/ensnode-sdk/src/ensapi/config/types.ts Extends ENSApi version-info type with commit.
packages/ensnode-sdk/src/ensapi/config/conversions.test.ts Updates ENSApi config conversion tests for commit field behavior.
packages/ensdb-sdk/src/client/ensdb-writer.test.ts Updates ENSDb writer test fixtures to include commit fields.
packages/ensdb-sdk/src/client/ensdb-reader.test.ts Updates ENSDb reader test fixtures to include commit fields.
packages/ensdb-sdk/src/client/ensdb-client.mock.ts Updates ENSDb client mock public config to include commit fields.
package.json Adds --build-arg GIT_COMMIT=... to root docker build scripts.
docker/services/ensrainbow.yml Passes GIT_COMMIT build arg via Docker Compose build args.
docker/services/ensindexer.yml Passes GIT_COMMIT build arg via Docker Compose build args.
docker/services/ensapi.yml Passes GIT_COMMIT build arg via Docker Compose build args.
docker/README.md Documents GIT_COMMIT build-time behavior and defaults.
apps/ensrainbow/src/config/public.ts Adds commit to ENSRainbow public config versionInfo sourced from env.
apps/ensrainbow/src/config/config.schema.test.ts Updates ENSRainbow config schema test expectation to include commit.
apps/ensrainbow/Dockerfile Adds ARG/ENV GIT_COMMIT and OCI revision label.
apps/ensindexer/src/lib/version-info.ts Adds getCommit() helper reading process.env.GIT_COMMIT.
apps/ensindexer/src/lib/stack-info-builder/stack-info-builder.test.ts Updates stack-info builder tests to include commit fields.
apps/ensindexer/src/lib/public-config-builder/public-config-builder.ts Injects commit into validated ENSIndexer version info.
apps/ensindexer/src/lib/public-config-builder/public-config-builder.test.ts Updates mocks/expectations to cover commit injection.
apps/ensindexer/Dockerfile Adds ARG/ENV GIT_COMMIT and OCI revision label.
apps/ensapi/src/lib/version-info.ts Adds commit to ENSApi version-info using env-provided GIT_COMMIT.
apps/ensapi/src/config/config.schema.mock.ts Updates ENSApi config mock fixtures to include commit fields.
apps/ensapi/Dockerfile Adds ARG/ENV GIT_COMMIT and OCI revision label.
apps/ensadmin/src/app/mock/stack-info/stack-info.mock.ts Updates ENSAdmin mock stack info fixtures to include commit fields.
apps/ensadmin/src/app/mock/indexing-status-api.mock.ts Updates ENSAdmin indexing-status API mock fixtures to include commit fields.
.github/workflows/release.yml Adds GIT_COMMIT=${{ github.sha }} build arg for release images.
.github/workflows/release_snapshot.yml Adds GIT_COMMIT=${{ github.sha }} build arg for snapshot images.
.github/workflows/release_preview.yml Adds GIT_COMMIT=${{ github.sha }} build arg for preview images.

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

Comment thread docker/README.md Outdated
Comment thread package.json Outdated
Comment thread packages/ensnode-sdk/src/ensapi/config/types.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: 4

🤖 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/lib/version-info.ts`:
- Around line 15-16: The getCommit() helper still allows an empty string through
because process.env.GIT_COMMIT ?? "unknown" only falls back on nullish values,
so ensApiVersionInfo.commit can violate the non-empty contract. Update
getCommit() in version-info.ts to treat blank or whitespace-only GIT_COMMIT as
missing and return "unknown" in that case, so the exported commit field is
always non-empty.

In `@apps/ensindexer/src/lib/version-info.ts`:
- Around line 15-16: The getCommit helper currently treats an empty GIT_COMMIT
as a valid value, which later causes validateEnsIndexerVersionInfo(...) to fail
when public config is built. Update getCommit to normalize blank or
whitespace-only GIT_COMMIT values to "unknown" before returning, and keep the
logic localized in version-info.ts so callers like the public config path
receive a non-empty commit string.

In `@apps/ensrainbow/src/config/public.ts`:
- Around line 14-15: The getCommit helper currently falls back only when
GIT_COMMIT is undefined, so an empty string can still flow into
versionInfo.commit and violate the public config schema. Update getCommit in the
public config module to treat empty or whitespace-only values as missing and
return "unknown" in that case, keeping the commit field non-empty before it is
assigned to EnsRainbowPublicConfig.versionInfo.commit.

In `@package.json`:
- Around line 28-31: The Docker build scripts in package.json are passing a
short commit hash via GIT_COMMIT, while other build paths use the full SHA, so
standardize these scripts to use the same full commit format as the release
workflow. Update the docker:build:* entries to match the commit representation
expected by promote_vercel_deployment.sh and versionInfo.commit, using the
existing script names as the place to fix the inconsistency. If any consumer
still relies on short hashes, normalize there instead of mixing formats at build
time.
🪄 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: 7c159217-4d20-4ff3-89a9-f9b44bbe2025

📥 Commits

Reviewing files that changed from the base of the PR and between 29358f8 and 4d99974.

📒 Files selected for processing (38)
  • .github/workflows/release.yml
  • .github/workflows/release_preview.yml
  • .github/workflows/release_snapshot.yml
  • apps/ensadmin/src/app/mock/indexing-status-api.mock.ts
  • apps/ensadmin/src/app/mock/stack-info/stack-info.mock.ts
  • apps/ensapi/Dockerfile
  • apps/ensapi/src/config/config.schema.mock.ts
  • apps/ensapi/src/lib/version-info.ts
  • apps/ensindexer/Dockerfile
  • apps/ensindexer/src/lib/public-config-builder/public-config-builder.test.ts
  • apps/ensindexer/src/lib/public-config-builder/public-config-builder.ts
  • apps/ensindexer/src/lib/stack-info-builder/stack-info-builder.test.ts
  • apps/ensindexer/src/lib/version-info.ts
  • apps/ensrainbow/Dockerfile
  • apps/ensrainbow/src/config/config.schema.test.ts
  • apps/ensrainbow/src/config/public.ts
  • docker/README.md
  • docker/services/ensapi.yml
  • docker/services/ensindexer.yml
  • docker/services/ensrainbow.yml
  • package.json
  • packages/ensdb-sdk/src/client/ensdb-client.mock.ts
  • packages/ensdb-sdk/src/client/ensdb-reader.test.ts
  • packages/ensdb-sdk/src/client/ensdb-writer.test.ts
  • packages/ensnode-sdk/src/ensapi/config/conversions.test.ts
  • packages/ensnode-sdk/src/ensapi/config/types.ts
  • packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts
  • packages/ensnode-sdk/src/ensindexer/client.mock.ts
  • packages/ensnode-sdk/src/ensindexer/config/conversions.test.ts
  • packages/ensnode-sdk/src/ensindexer/config/types.ts
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts
  • packages/ensnode-sdk/src/ensnode/client.test.ts
  • packages/ensnode-sdk/src/ensnode/metadata/indexing-metadata-context.test.ts
  • packages/ensnode-sdk/src/ensrainbow/config.ts
  • packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.test.ts
  • packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts
  • packages/ensrainbow-sdk/src/client.test.ts

Comment thread apps/ensapi/src/lib/version-info.ts Outdated
Comment thread apps/ensindexer/src/lib/version-info.ts Outdated
Comment thread apps/ensrainbow/src/config/public.ts Outdated
Comment thread package.json Outdated
@tk-o

tk-o commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@greptile review

Comment thread apps/ensindexer/src/lib/public-config-builder/public-config-builder.ts Outdated
Comment thread docker/README.md 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 44 out of 44 changed files in this pull request and generated 12 comments.

Comment thread packages/ensnode-sdk/src/shared/config/zod-schemas.ts Outdated
Comment thread apps/ensindexer/src/lib/public-config-builder/public-config-builder.ts Outdated
Comment thread apps/ensindexer/src/lib/public-config-builder/public-config-builder.test.ts Outdated
Comment thread docker/services/ensindexer.yml
Comment thread docker/services/ensrainbow.yml
Comment thread package.json
Comment thread docker/README.md Outdated
Comment thread docker/README.md Outdated
Comment thread packages/ensnode-sdk/src/shared/config/zod-schemas.ts
Comment thread apps/ensindexer/src/lib/public-config-builder/public-config-builder.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: 3

🤖 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/lib/version-info.ts`:
- Around line 8-25: The getCommitRef function currently uses
OptionalGitCommitShaSchema.default("unknown").parse, which still throws for
blank or malformed GIT_COMMIT values instead of falling back. Update
getCommitRef to use safeParse on env.GIT_COMMIT and return "unknown" whenever
parsing fails, keeping the memoized commitRef behavior intact.

In `@apps/ensrainbow/src/config/public.ts`:
- Around line 11-24: The getCommitRef helper currently uses
OptionalGitCommitShaSchema.default("unknown").parse(env.GIT_COMMIT), which still
throws when GIT_COMMIT is an empty string from Compose. Update getCommitRef to
use a non-throwing fallback path, such as safeParse(), so blank or missing input
resolves to "unknown" instead of crashing; keep the behavior localized in
getCommitRef and preserve the cached commitRef logic.

In `@package.json`:
- Line 29: The docker:build:ensadmin script passes a GIT_COMMIT build-arg that
is not used anywhere. Either remove the unused build-arg from the package.json
docker:build:ensadmin command, or update apps/ensadmin/Dockerfile to consume
GIT_COMMIT if it is intended to be part of the image build.
🪄 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: d963845b-d722-4f69-a63a-113a7c75c5f1

📥 Commits

Reviewing files that changed from the base of the PR and between 4d99974 and 5a3bc56.

📒 Files selected for processing (14)
  • apps/ensapi/src/config/environment.ts
  • apps/ensapi/src/lib/version-info.ts
  • apps/ensindexer/src/config/environment.ts
  • apps/ensindexer/src/lib/version-info.ts
  • apps/ensrainbow/src/config/environment.ts
  • apps/ensrainbow/src/config/public.ts
  • docker/services/ensapi.yml
  • docker/services/ensindexer.yml
  • docker/services/ensrainbow.yml
  • docs/ensnode.io/ensapi-openapi.json
  • package.json
  • packages/ensnode-sdk/src/ensindexer/config/types.ts
  • packages/ensnode-sdk/src/shared/config/environments.ts
  • packages/ensnode-sdk/src/shared/config/zod-schemas.ts
💤 Files with no reviewable changes (1)
  • packages/ensnode-sdk/src/ensindexer/config/types.ts

Comment thread apps/ensapi/src/lib/version-info.ts Outdated
Comment thread apps/ensrainbow/src/config/public.ts Outdated
Comment thread package.json Outdated
@tk-o tk-o force-pushed the feat/include-commit-ref branch from 5a3bc56 to 5f9c6f5 Compare July 3, 2026 11:59
@tk-o

tk-o commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@greptile review

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 47 out of 47 changed files in this pull request and generated 2 comments.

Comment thread packages/ensnode-sdk/src/shared/config/zod-schemas.ts
Comment thread package.json 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: 5

♻️ Duplicate comments (3)
packages/ensnode-sdk/src/shared/config/git-ref.ts (1)

12-22: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Non-SHA sentinel values (e.g. "unknown") crash buildCommitRef at startup.

The preprocess step only coalesces ""/undefined to undefined; any other value — including a default/placeholder like "unknown" — is validated against the strict 40-char GitCommitShaSchema and throws. If GIT_COMMIT isn't set to a real SHA at build time (e.g. local/dev builds), this will crash app startup rather than falling back to undefined.

This was already flagged by a previous automated review comment on this PR and does not appear to be fixed in the current code.

🔧 Proposed fix
 export function buildCommitRef(env: GitEnvironment): string | undefined {
   const result = z
-    .preprocess((val) => (val === "" ? undefined : val), z.optional(GitCommitShaSchema))
+    .preprocess(
+      (val) => (val === "" || val === "unknown" ? undefined : val),
+      z.optional(GitCommitShaSchema),
+    )
     .safeParse(env.GIT_COMMIT);

Please verify what default value Docker/CI actually bakes into GIT_COMMIT when unset (checked via apps/*/Dockerfile, docker/services/*.yml, and CI workflows, which are outside this cohort) to confirm whether this crash is reachable.

🤖 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 `@packages/ensnode-sdk/src/shared/config/git-ref.ts` around lines 12 - 22, The
buildCommitRef helper is still treating non-SHA placeholder values like
"unknown" as invalid and throwing during startup. Update buildCommitRef in
git-ref.ts so it accepts sentinel or missing GIT_COMMIT values by mapping them
to undefined before validating against GitCommitShaSchema, and keep the strict
SHA check only for real commit values. Use the existing buildCommitRef and
GitCommitShaSchema symbols to locate the parsing logic and preserve the
string-or-undefined return shape.
apps/ensindexer/src/lib/version-info.ts (1)

15-17: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Same eager-throw risk as apps/ensapi/src/lib/version-info.ts.

getEnsIndexerCommitRef() calls buildCommitRef the same way; a malformed GIT_COMMIT will throw and crash this module's evaluation rather than degrading to "unknown". See the fuller analysis and suggested fix on apps/ensapi/src/lib/version-info.ts (same root cause, buildCommitRef in packages/ensnode-sdk/src/shared/config/git-ref.ts).

🤖 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 `@apps/ensindexer/src/lib/version-info.ts` around lines 15 - 17,
getEnsIndexerCommitRef currently delegates directly to buildCommitRef, which can
eagerly throw during module evaluation if GIT_COMMIT is malformed. Update
getEnsIndexerCommitRef to catch/handle errors from buildCommitRef and return
undefined or a safe fallback instead of crashing, matching the defensive
behavior used in the related version-info path; use the getEnsIndexerCommitRef
function and buildCommitRef in packages/ensnode-sdk/src/shared/config/git-ref.ts
to locate the change.
apps/ensrainbow/src/config/public.ts (1)

17-19: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Same buildCommitRef throw risk propagates into public config building.

getEnsRainbowCommitRef() is called from buildEnsRainbowPublicConfigFromLabelSet, so a malformed GIT_COMMIT throws here too, potentially failing public-config construction rather than degrading to "unknown". Same root cause as flagged on apps/ensapi/src/lib/version-info.ts.

Also applies to: 32-35

🤖 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 `@apps/ensrainbow/src/config/public.ts` around lines 17 - 19,
getEnsRainbowCommitRef currently passes process.env directly into
buildCommitRef, so a malformed GIT_COMMIT can throw and break public config
construction in buildEnsRainbowPublicConfigFromLabelSet. Update
getEnsRainbowCommitRef to avoid propagating that exception by catching/guarding
the buildCommitRef call and falling back to the safe unknown behavior, using the
existing buildCommitRef and getEnsRainbowCommitRef symbols to locate the fix.
🤖 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/lib/version-info.ts`:
- Around line 14-16: getEnsApiCommitRef currently lets buildCommitRef throw
during module initialization, which can crash ENSApi on a malformed GIT_COMMIT.
Update getEnsApiCommitRef in version-info.ts to catch errors from
buildCommitRef(process.env satisfies EnsApiEnvironment) and return undefined
instead, preserving startup; keep the fix localized to this helper and ensure it
still returns the parsed commit ref when valid.

In `@packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts`:
- Around line 16-18: The commit field is re-implementing the shared commit-ref
validation inline instead of reusing the new shared schema. Update the commit
schema in zod-schemas.ts to use GitCommitShaSchema from
shared/config/git-ref.ts, and pass valueLabel or otherwise preserve the existing
field-specific error text if needed. Apply the same reuse pattern wherever
commit validation is duplicated so the ENS API, ENS indexer, and ENS rainbow
schemas all share the same buildCommitRef/GitCommitShaSchema logic.

In `@packages/ensnode-sdk/src/ensrainbow/config.ts`:
- Around line 6-13: The EnsRainbowVersionInfo shape still marks commit as
optional even though makeEnsRainbowPublicConfigSchema always populates it with
"unknown". Update the EnsRainbowVersionInfo interface in config.ts so commit is
required as a string, and keep the public config type aligned with the schema
output used by makeEnsRainbowPublicConfigSchema.

In `@packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.test.ts`:
- Around line 69-83: The test in makeEnsRainbowPublicConfigSchema only checks
that parsing succeeds when versionInfo.commit is omitted, but it does not verify
the default fill behavior. Update the assertion in config.test.ts so it inspects
the parsed data from makeEnsRainbowPublicConfigSchema().safeParse and confirms
versionInfo.commit is set to "unknown" when missing, using the returned
success/data shape rather than only matching success.

In `@packages/ensnode-sdk/src/shared/config/environments.ts`:
- Around line 1-9: GitEnvironment is the only interface in environments.ts with
a full JSDoc block, which is inconsistent with sibling declarations like
EnsDbEnvironment and PortEnvironment. Remove the interface-level comment from
GitEnvironment and, if needed, keep only a minimal field-level note on
GIT_COMMIT where it is actually consumed so the file’s comment style stays
consistent.

---

Duplicate comments:
In `@apps/ensindexer/src/lib/version-info.ts`:
- Around line 15-17: getEnsIndexerCommitRef currently delegates directly to
buildCommitRef, which can eagerly throw during module evaluation if GIT_COMMIT
is malformed. Update getEnsIndexerCommitRef to catch/handle errors from
buildCommitRef and return undefined or a safe fallback instead of crashing,
matching the defensive behavior used in the related version-info path; use the
getEnsIndexerCommitRef function and buildCommitRef in
packages/ensnode-sdk/src/shared/config/git-ref.ts to locate the change.

In `@apps/ensrainbow/src/config/public.ts`:
- Around line 17-19: getEnsRainbowCommitRef currently passes process.env
directly into buildCommitRef, so a malformed GIT_COMMIT can throw and break
public config construction in buildEnsRainbowPublicConfigFromLabelSet. Update
getEnsRainbowCommitRef to avoid propagating that exception by catching/guarding
the buildCommitRef call and falling back to the safe unknown behavior, using the
existing buildCommitRef and getEnsRainbowCommitRef symbols to locate the fix.

In `@packages/ensnode-sdk/src/shared/config/git-ref.ts`:
- Around line 12-22: The buildCommitRef helper is still treating non-SHA
placeholder values like "unknown" as invalid and throwing during startup. Update
buildCommitRef in git-ref.ts so it accepts sentinel or missing GIT_COMMIT values
by mapping them to undefined before validating against GitCommitShaSchema, and
keep the strict SHA check only for real commit values. Use the existing
buildCommitRef and GitCommitShaSchema symbols to locate the parsing logic and
preserve the string-or-undefined return shape.
🪄 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: 35746cd0-7389-4686-826c-c409b3475325

📥 Commits

Reviewing files that changed from the base of the PR and between 5a3bc56 and f95dadb.

📒 Files selected for processing (40)
  • apps/ensapi/Dockerfile
  • apps/ensapi/src/config/environment.ts
  • apps/ensapi/src/lib/version-info.ts
  • apps/ensindexer/Dockerfile
  • apps/ensindexer/src/config/environment.ts
  • apps/ensindexer/src/lib/public-config-builder/public-config-builder.test.ts
  • apps/ensindexer/src/lib/public-config-builder/public-config-builder.ts
  • apps/ensindexer/src/lib/stack-info-builder/stack-info-builder.test.ts
  • apps/ensindexer/src/lib/version-info.ts
  • apps/ensrainbow/Dockerfile
  • apps/ensrainbow/src/config/environment.ts
  • apps/ensrainbow/src/config/public.ts
  • docker/README.md
  • docker/services/ensapi.yml
  • docker/services/ensindexer.yml
  • docker/services/ensrainbow.yml
  • docs/ensnode.io/ensapi-openapi.json
  • package.json
  • packages/ensdb-sdk/src/client/ensdb-client.mock.ts
  • packages/ensdb-sdk/src/client/ensdb-reader.test.ts
  • packages/ensdb-sdk/src/client/ensdb-writer.test.ts
  • packages/ensnode-sdk/src/ensapi/config/conversions.test.ts
  • packages/ensnode-sdk/src/ensapi/config/types.ts
  • packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts
  • packages/ensnode-sdk/src/ensindexer/client.mock.ts
  • packages/ensnode-sdk/src/ensindexer/config/conversions.test.ts
  • packages/ensnode-sdk/src/ensindexer/config/types.ts
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.ts
  • packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts
  • packages/ensnode-sdk/src/ensnode/client.test.ts
  • packages/ensnode-sdk/src/ensnode/metadata/indexing-metadata-context.test.ts
  • packages/ensnode-sdk/src/ensrainbow/config.ts
  • packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.test.ts
  • packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts
  • packages/ensnode-sdk/src/index.ts
  • packages/ensnode-sdk/src/shared/config/environments.ts
  • packages/ensnode-sdk/src/shared/config/git-ref.test.ts
  • packages/ensnode-sdk/src/shared/config/git-ref.ts
  • packages/ensnode-sdk/src/shared/config/zod-schemas.ts
  • packages/ensrainbow-sdk/src/client.test.ts

Comment thread apps/ensapi/src/lib/version-info.ts
Comment thread packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts Outdated
Comment thread packages/ensnode-sdk/src/ensrainbow/config.ts
Comment thread packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.test.ts Outdated
Comment thread packages/ensnode-sdk/src/shared/config/environments.ts
Comment thread apps/ensrainbow/src/config/config.schema.test.ts Outdated
tk-o added 5 commits July 3, 2026 16:47
Add indernaal functionality to build an optional git commit reference from environment variables.
This change will be reflected in the stack info data models as well.
This update allows "baking in" the provided commit reference into each ENSNode app docker image
@tk-o

tk-o commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@greptile review

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 32 out of 32 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

apps/ensrainbow/src/config/config.schema.test.ts:406

  • Switching this assertion from toStrictEqual to toMatchObject makes the test stop asserting versionInfo.commit entirely, so regressions (e.g. empty string, wrong type, unexpected value) would pass. If the goal was to avoid env-dependent flakiness, explicitly clear/restore process.env.GIT_COMMIT inside the test and assert the commit field deterministically.
  it("returns a valid ENSRainbow public config with correct structure", () => {
    const result = buildEnsRainbowPublicConfig(dbConfig);

    expect(result).toMatchObject({
      serverLabelSet: dbConfig.serverLabelSet,
      versionInfo: {
        ensRainbow: packageJson.version,
      },
    } satisfies EnsRainbowPublicConfig);
  });

Comment thread packages/ensnode-sdk/src/shared/config/zod-schemas.ts
Comment thread packages/ensnode-sdk/src/shared/config/git-ref.ts
Comment thread packages/ensnode-sdk/src/ensapi/config/zod-schemas.ts
Comment thread packages/ensnode-sdk/src/ensrainbow/zod-schemas/config.ts
Comment thread packages/ensnode-sdk/src/ensindexer/config/zod-schemas.ts
@tk-o tk-o marked this pull request as ready for review July 3, 2026 15:08
@tk-o tk-o requested a review from a team as a code owner July 3, 2026 15:08

@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.

LGTM

@tk-o tk-o merged commit 91346e8 into main Jul 7, 2026
24 checks passed
@tk-o tk-o deleted the feat/include-commit-ref branch July 7, 2026 06:24
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