Embed release version in backend builds#43
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🚅 Deployed to the hyperindex-pr-43 environment in hyperindex-v2-setup
1 service not affected by this PR
|
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis pull request adds build-time version embedding to the Hyperindex application. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 56 minutes and 4 seconds.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
Dockerfile (1)
24-30: ⚡ Quick winHarden Docker version fallback when
.gitmetadata is unavailable.The current fallback only inspects version files through Git plumbing. If
.gitisn’t present in the Docker context, this silently drops to0.1.0-deveven when.changes/v*.mdexists.Proposed patch
- release_file="$(git ls-files '.changes/v*.md' 2>/dev/null | sort -V | tail -n 1 || true)"; \ + release_file="$(git ls-tree -r --name-only HEAD '.changes/v*.md' 2>/dev/null | sort -V | tail -n 1 || true)"; \ + if [ -z "$release_file" ]; then \ + release_file="$(ls -1 .changes/v*.md 2>/dev/null | sort -V | tail -n 1 || true)"; \ + fi; \ if [ -n "$release_file" ]; then \ release_name="${release_file##*/}"; \ build_version="${release_name%.md}"; \🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Dockerfile` around lines 24 - 30, The version fallback block using release_file/release_name/build_version should be hardened to handle contexts without .git by falling back to filesystem globbing when git ls-files yields nothing; update the logic in that shell block so after trying git ls-files for '.changes/v*.md' it checks for the existence of matching files in the workspace (e.g., via shell glob or find) and uses the newest match to set release_name and build_version before defaulting to "0.1.0-dev", ensuring you reference the same variables (release_file, release_name, build_version) and preserve the existing sort -V | tail -n 1 behavior.cmd/hyperindex/main_test.go (1)
17-19: ⚡ Quick winAssert against an immutable expected value instead of the mutable global.
This makes the test more robust against accidental cross-test mutation of
buildinfo.Version.Proposed patch
- previousVersion := buildinfo.Version - buildinfo.Version = "v9.9.9-test" + previousVersion := buildinfo.Version + expectedVersion := "v9.9.9-test" + buildinfo.Version = expectedVersion @@ - if body["version"] != buildinfo.Version { - t.Fatalf("version = %q, want buildinfo.Version %q", body["version"], buildinfo.Version) + if body["version"] != expectedVersion { + t.Fatalf("version = %q, want %q", body["version"], expectedVersion) }Also applies to: 37-39
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmd/hyperindex/main_test.go` around lines 17 - 19, The test currently mutates the global buildinfo.Version (saving previousVersion then restoring in t.Cleanup) and asserts against that mutable value; instead, set buildinfo.Version to the test value ("v9.9.9-test") and assert against the literal expected string in assertions (e.g., use "v9.9.9-test" directly), keeping the t.Cleanup restore of buildinfo.Version to previousVersion; update both places where this pattern appears (the block that assigns previousVersion/buildinfo.Version and the second instance at 37-39) so assertions compare to the immutable expected literal rather than the global variable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@cmd/hyperindex/main_test.go`:
- Around line 17-19: The test currently mutates the global buildinfo.Version
(saving previousVersion then restoring in t.Cleanup) and asserts against that
mutable value; instead, set buildinfo.Version to the test value ("v9.9.9-test")
and assert against the literal expected string in assertions (e.g., use
"v9.9.9-test" directly), keeping the t.Cleanup restore of buildinfo.Version to
previousVersion; update both places where this pattern appears (the block that
assigns previousVersion/buildinfo.Version and the second instance at 37-39) so
assertions compare to the immutable expected literal rather than the global
variable.
In `@Dockerfile`:
- Around line 24-30: The version fallback block using
release_file/release_name/build_version should be hardened to handle contexts
without .git by falling back to filesystem globbing when git ls-files yields
nothing; update the logic in that shell block so after trying git ls-files for
'.changes/v*.md' it checks for the existence of matching files in the workspace
(e.g., via shell glob or find) and uses the newest match to set release_name and
build_version before defaulting to "0.1.0-dev", ensuring you reference the same
variables (release_file, release_name, build_version) and preserve the existing
sort -V | tail -n 1 behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: dd1bb1d6-1608-4384-b0a2-3bca1546ee9b
📒 Files selected for processing (7)
.changes/unreleased/embed-backend-build-version.yamlDockerfileMakefilecmd/hyperindex/main.gocmd/hyperindex/main_test.gointernal/buildinfo/buildinfo.gointernal/buildinfo/buildinfo_test.go
eca967f to
fce9c54
Compare
Summary
Validation
Not yet validated
Summary by CodeRabbit