Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the developer experience by significantly reducing the "cold start" time for the CLI application. It achieves this by implementing intelligent caching for Go build artifacts, pre-building the CLI binary within Docker, and optimizing the database startup process for the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly improves the make run-cli command by caching the compiled Go binary, which will speed up subsequent runs. It also adds robust health checks for the database. The implementation is solid, but I have a couple of suggestions to enhance maintainability by refactoring some duplicated code in the Makefile and removing a potentially brittle PATH override in docker-compose.yml.
docker-compose.yml
Outdated
| CGO_ENABLED: 1 | ||
| PATH: /usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
There was a problem hiding this comment.
Hardcoding the PATH variable can be brittle. If the Go installation path in the base image changes, this will break. Since other parts of the Makefile are being updated to use absolute paths to the go executable (e.g., /usr/local/go/bin/go), this explicit PATH definition seems redundant. It would be more robust to remove the PATH override and rely on the base image's PATH.
CGO_ENABLED: 1
infra/makefile/app.mk
Outdated
| if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then \ | ||
| printf "Building Docker CLI binary at $(CLI_DOCKER_BINARY_CONTAINER).\n"; \ | ||
| docker compose run --rm --no-deps api-runner sh -lc '/usr/local/go/bin/go build -o "$(CLI_DOCKER_BINARY_CONTAINER)" ./metal/cli/main.go' || status=$$?; \ | ||
| elif command -v docker-compose >/dev/null 2>&1; then \ | ||
| printf "Building Docker CLI binary at $(CLI_DOCKER_BINARY_CONTAINER).\n"; \ | ||
| docker-compose run --rm --no-deps api-runner sh -lc '/usr/local/go/bin/go build -o "$(CLI_DOCKER_BINARY_CONTAINER)" ./metal/cli/main.go' || status=$$?; \ | ||
| else \ | ||
| printf "\n$(RED)❌ Neither 'docker compose' nor 'docker-compose' is available.$(NC)\n"; \ | ||
| printf " Install Docker Compose or run the CLI locally without containers.\n\n"; \ | ||
| exit 1; \ | ||
| fi; \ |
There was a problem hiding this comment.
This if/elif block for detecting docker compose vs docker-compose contains duplicated code. You can make this more maintainable by first determining the correct command and storing it in a variable, then using that variable to execute the build command. This avoids repeating the printf and the docker compose run... lines, similar to the pattern you've used in the run-cli target.
compose_cmd=""; \
if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then \
compose_cmd="docker compose"; \
elif command -v docker-compose >/dev/null 2>&1; then \
compose_cmd="docker-compose"; \
else \
printf "\n$(RED)❌ Neither 'docker compose' nor 'docker-compose' is available.$(NC)\n"; \
printf " Install Docker Compose or run the CLI locally without containers.\n\n"; \
exit 1; \
fi; \
printf "Building Docker CLI binary at $(CLI_DOCKER_BINARY_CONTAINER).\n"; \
$$compose_cmd run --rm --no-deps api-runner sh -lc '/usr/local/go/bin/go build -o "$(CLI_DOCKER_BINARY_CONTAINER)" ./metal/cli/main.go' || status=$$?;
No description provided.