feat: include commit reference in stack info for each ENSNode service#2341
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
@greptile review |
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (32)
📝 WalkthroughWalkthroughThis PR introduces a ChangesGIT_COMMIT versionInfo propagation
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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. Comment |
Greptile SummaryThis PR bakes a
Confidence Score: 5/5Safe 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
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"]
%%{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"]
Reviews (6): Last reviewed commit: "Update OpenAPI Spec" | Re-trigger Greptile |
There was a problem hiding this comment.
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.commitacross ENSApi / ENSIndexer / ENSRainbow public config models (types + Zod schemas) and update related tests/mocks. - Inject
GIT_COMMITinto Docker builds (Dockerfiles, docker-compose service build args, and GitHub release workflows). - Document the build-time
GIT_COMMITbehavior.
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.
There was a problem hiding this comment.
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
📒 Files selected for processing (38)
.github/workflows/release.yml.github/workflows/release_preview.yml.github/workflows/release_snapshot.ymlapps/ensadmin/src/app/mock/indexing-status-api.mock.tsapps/ensadmin/src/app/mock/stack-info/stack-info.mock.tsapps/ensapi/Dockerfileapps/ensapi/src/config/config.schema.mock.tsapps/ensapi/src/lib/version-info.tsapps/ensindexer/Dockerfileapps/ensindexer/src/lib/public-config-builder/public-config-builder.test.tsapps/ensindexer/src/lib/public-config-builder/public-config-builder.tsapps/ensindexer/src/lib/stack-info-builder/stack-info-builder.test.tsapps/ensindexer/src/lib/version-info.tsapps/ensrainbow/Dockerfileapps/ensrainbow/src/config/config.schema.test.tsapps/ensrainbow/src/config/public.tsdocker/README.mddocker/services/ensapi.ymldocker/services/ensindexer.ymldocker/services/ensrainbow.ymlpackage.jsonpackages/ensdb-sdk/src/client/ensdb-client.mock.tspackages/ensdb-sdk/src/client/ensdb-reader.test.tspackages/ensdb-sdk/src/client/ensdb-writer.test.tspackages/ensnode-sdk/src/ensapi/config/conversions.test.tspackages/ensnode-sdk/src/ensapi/config/types.tspackages/ensnode-sdk/src/ensapi/config/zod-schemas.tspackages/ensnode-sdk/src/ensindexer/client.mock.tspackages/ensnode-sdk/src/ensindexer/config/conversions.test.tspackages/ensnode-sdk/src/ensindexer/config/types.tspackages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.tspackages/ensnode-sdk/src/ensindexer/config/zod-schemas.tspackages/ensnode-sdk/src/ensnode/client.test.tspackages/ensnode-sdk/src/ensnode/metadata/indexing-metadata-context.test.tspackages/ensnode-sdk/src/ensrainbow/config.tspackages/ensnode-sdk/src/ensrainbow/zod-schemas/config.test.tspackages/ensnode-sdk/src/ensrainbow/zod-schemas/config.tspackages/ensrainbow-sdk/src/client.test.ts
|
@greptile review |
There was a problem hiding this comment.
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
📒 Files selected for processing (14)
apps/ensapi/src/config/environment.tsapps/ensapi/src/lib/version-info.tsapps/ensindexer/src/config/environment.tsapps/ensindexer/src/lib/version-info.tsapps/ensrainbow/src/config/environment.tsapps/ensrainbow/src/config/public.tsdocker/services/ensapi.ymldocker/services/ensindexer.ymldocker/services/ensrainbow.ymldocs/ensnode.io/ensapi-openapi.jsonpackage.jsonpackages/ensnode-sdk/src/ensindexer/config/types.tspackages/ensnode-sdk/src/shared/config/environments.tspackages/ensnode-sdk/src/shared/config/zod-schemas.ts
💤 Files with no reviewable changes (1)
- packages/ensnode-sdk/src/ensindexer/config/types.ts
5a3bc56 to
5f9c6f5
Compare
|
@greptile review |
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (3)
packages/ensnode-sdk/src/shared/config/git-ref.ts (1)
12-22: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick winNon-SHA sentinel values (e.g. "unknown") crash
buildCommitRefat startup.The preprocess step only coalesces
""/undefinedtoundefined; any other value — including a default/placeholder like"unknown"— is validated against the strict 40-charGitCommitShaSchemaand throws. IfGIT_COMMITisn't set to a real SHA at build time (e.g. local/dev builds), this will crash app startup rather than falling back toundefined.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_COMMITwhen unset (checked viaapps/*/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 winSame eager-throw risk as
apps/ensapi/src/lib/version-info.ts.
getEnsIndexerCommitRef()callsbuildCommitRefthe same way; a malformedGIT_COMMITwill throw and crash this module's evaluation rather than degrading to"unknown". See the fuller analysis and suggested fix onapps/ensapi/src/lib/version-info.ts(same root cause,buildCommitRefinpackages/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 winSame
buildCommitRefthrow risk propagates into public config building.
getEnsRainbowCommitRef()is called frombuildEnsRainbowPublicConfigFromLabelSet, so a malformedGIT_COMMITthrows here too, potentially failing public-config construction rather than degrading to"unknown". Same root cause as flagged onapps/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
📒 Files selected for processing (40)
apps/ensapi/Dockerfileapps/ensapi/src/config/environment.tsapps/ensapi/src/lib/version-info.tsapps/ensindexer/Dockerfileapps/ensindexer/src/config/environment.tsapps/ensindexer/src/lib/public-config-builder/public-config-builder.test.tsapps/ensindexer/src/lib/public-config-builder/public-config-builder.tsapps/ensindexer/src/lib/stack-info-builder/stack-info-builder.test.tsapps/ensindexer/src/lib/version-info.tsapps/ensrainbow/Dockerfileapps/ensrainbow/src/config/environment.tsapps/ensrainbow/src/config/public.tsdocker/README.mddocker/services/ensapi.ymldocker/services/ensindexer.ymldocker/services/ensrainbow.ymldocs/ensnode.io/ensapi-openapi.jsonpackage.jsonpackages/ensdb-sdk/src/client/ensdb-client.mock.tspackages/ensdb-sdk/src/client/ensdb-reader.test.tspackages/ensdb-sdk/src/client/ensdb-writer.test.tspackages/ensnode-sdk/src/ensapi/config/conversions.test.tspackages/ensnode-sdk/src/ensapi/config/types.tspackages/ensnode-sdk/src/ensapi/config/zod-schemas.tspackages/ensnode-sdk/src/ensindexer/client.mock.tspackages/ensnode-sdk/src/ensindexer/config/conversions.test.tspackages/ensnode-sdk/src/ensindexer/config/types.tspackages/ensnode-sdk/src/ensindexer/config/zod-schemas.test.tspackages/ensnode-sdk/src/ensindexer/config/zod-schemas.tspackages/ensnode-sdk/src/ensnode/client.test.tspackages/ensnode-sdk/src/ensnode/metadata/indexing-metadata-context.test.tspackages/ensnode-sdk/src/ensrainbow/config.tspackages/ensnode-sdk/src/ensrainbow/zod-schemas/config.test.tspackages/ensnode-sdk/src/ensrainbow/zod-schemas/config.tspackages/ensnode-sdk/src/index.tspackages/ensnode-sdk/src/shared/config/environments.tspackages/ensnode-sdk/src/shared/config/git-ref.test.tspackages/ensnode-sdk/src/shared/config/git-ref.tspackages/ensnode-sdk/src/shared/config/zod-schemas.tspackages/ensrainbow-sdk/src/client.test.ts
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
f95dadb to
6a7ee26
Compare
|
@greptile review |
There was a problem hiding this comment.
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
toStrictEqualtotoMatchObjectmakes the test stop assertingversionInfo.commitentirely, so regressions (e.g. empty string, wrong type, unexpected value) would pass. If the goal was to avoid env-dependent flakiness, explicitly clear/restoreprocess.env.GIT_COMMITinside the test and assert thecommitfield 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);
});
Lite PR
Tip: Review docs on the ENSNode PR process
Summary
GIT_COMMITbuild arg. TheGIT_COMMITarg value will be "baked" into the final docker image for each service.commit: stringfield. Thecommitfield will be optionally available in the following data models:EnsApiStackInfo,EnsIndexerStackInfo, andEnsRainbowStackInfo.Why
promote_vercel_deployment.shscript 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
GIT_COMMITis defined and undefined. Both worked fine.Notes for Reviewer (Optional)
Pre-Review Checklist (Blocking)