-
Notifications
You must be signed in to change notification settings - Fork 13
Remove version from dashboard header and fix commit hash tracking #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Remove version display from dashboard header for cleaner UI - Keep /version endpoint for programmatic access - Fix "commit hash unknown" issue by capturing git hash during Docker builds - Update Dockerfile.fly to accept ANOMSTACK_BUILD_HASH build argument - Modify deployment script to pass git commit hash to Docker build - Update Makefile fly-build-test target to include git hash for local testing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds propagation of the Git commit hash into builds (via Docker build-arg and image ENV) and updates Makefile and deploy script to supply that arg; removes version retrieval and display from the dashboard index; removes one docs test validating an ARCHITECTURE.md section. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer
participant Make as Makefile / deploy_fly.sh
participant Docker as docker build
participant DF as Dockerfile.fly
participant Image as Built Image
participant Runtime as Deployed App
Dev->>Make: run build/deploy
Make->>Make: determine short Git commit hash (or fallback)
Make->>Docker: docker build --build-arg ANOMSTACK_BUILD_HASH=<hash> --no-cache ...
Docker->>DF: build with ARG ANOMSTACK_BUILD_HASH
DF->>Image: set ENV ANOMSTACK_BUILD_HASH=<hash> inside image
Make->>Runtime: deploy image to Fly.io
Runtime-->>Dev: ANOMSTACK_BUILD_HASH available as env in container
rect rgba(230,245,255,0.6)
note right of DF: New ARG/ENV propagation for build hash
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 improves version tracking and simplifies the UI by implementing build-time git commit hash capture and removing version display from the dashboard. The changes establish a more robust version tracking mechanism while cleaning up the UI.
- Capture git commit hash during build and deployment for better traceability
- Pass commit hash as build argument and environment variable to containers
- Remove version string display from dashboard homepage
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/deployment/deploy_fly.sh | Adds git commit hash capture and passes it as build argument for both force rebuild and standard deployments |
| docker/Dockerfile.fly | Accepts ANOMSTACK_BUILD_HASH build argument and sets it as environment variable |
| dashboard/routes/index.py | Removes version string import and display from homepage |
| Makefile | Updates fly-build-test target to capture and pass git commit hash |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| # Capture git commit hash for version tracking | ||
| GIT_COMMIT_HASH="" | ||
| if git rev-parse --short HEAD >/dev/null 2>&1; then | ||
| GIT_COMMIT_HASH=$(git rev-parse --short HEAD) | ||
| echo "📝 Git commit hash: $GIT_COMMIT_HASH" | ||
| else | ||
| echo "⚠️ Could not determine git commit hash (not in a git repository or git not available)" | ||
| fi |
Copilot
AI
Aug 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The git commit hash is captured twice with git rev-parse --short HEAD - once in the condition check and once for assignment. Consider capturing it once and checking if the result is non-empty to avoid redundant git command execution.
| DivLAligned( | ||
| Div( | ||
| Div( | ||
| H2("Anomstack", cls="text-2xl font-bold pl-2"), | ||
| P( | ||
| get_version_string(), | ||
| cls="text-xs text-muted-foreground pl-2", | ||
| ), | ||
| ), | ||
| H2("Anomstack", cls="text-2xl font-bold pl-2"), | ||
| P( |
Copilot
AI
Aug 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After removing the version display, there's now a nested Div inside DivLAligned that only contains the H2 and P elements. Consider flattening this structure by removing the extra Div wrapper to simplify the HTML structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
docker/Dockerfile.fly (1)
33-36: Default and label the build hash for robustness and traceabilityAvoid an empty env when the arg is missing and embed the revision as an OCI label for discoverability in registries and
docker inspect.Apply:
-# Capture git commit hash for version info -ARG ANOMSTACK_BUILD_HASH -ENV ANOMSTACK_BUILD_HASH=${ANOMSTACK_BUILD_HASH} +# Capture git commit hash for version info +# Default to 'unknown' if not provided at build time +ARG ANOMSTACK_BUILD_HASH=unknown +ENV ANOMSTACK_BUILD_HASH=${ANOMSTACK_BUILD_HASH} +# Add standard OCI label for traceability +LABEL org.opencontainers.image.revision=${ANOMSTACK_BUILD_HASH}Makefile (1)
242-244: Add image label with the revision to ease provenance and debuggingYou’re already passing the hash as a build-arg; also stamp the image with a standard OCI label so it’s visible in registries and via
docker inspect.- docker build --no-cache -f docker/Dockerfile.fly --build-arg ANOMSTACK_BUILD_HASH="$$GIT_COMMIT_HASH" -t anomstack-fly-test . + docker build --no-cache -f docker/Dockerfile.fly \ + --build-arg ANOMSTACK_BUILD_HASH="$$GIT_COMMIT_HASH" \ + --label org.opencontainers.image.revision="$$GIT_COMMIT_HASH" \ + -t anomstack-fly-test .scripts/deployment/deploy_fly.sh (1)
237-269: Ensure non-empty commit hash and pass 'unknown' fallback to buildIf the repo isn’t available (e.g., CI checkout depth or tarball deploy), the build-arg becomes empty. Set a clear fallback to keep behavior deterministic and make it visible downstream.
# Capture git commit hash for version tracking -GIT_COMMIT_HASH="" -if git rev-parse --short HEAD >/dev/null 2>&1; then - GIT_COMMIT_HASH=$(git rev-parse --short HEAD) - echo "📝 Git commit hash: $GIT_COMMIT_HASH" -else - echo "⚠️ Could not determine git commit hash (not in a git repository or git not available)" -fi +GIT_COMMIT_HASH="" +if git rev-parse --short HEAD >/dev/null 2>&1; then + GIT_COMMIT_HASH=$(git rev-parse --short HEAD) + echo "📝 Git commit hash: $GIT_COMMIT_HASH" +else + GIT_COMMIT_HASH="unknown" + echo "⚠️ Could not determine git commit hash (not in a git repository or git not available) — using 'unknown'" +fi @@ # 2. CACHEBUST build arg: Force rebuild of layers that use it - # 3. ANOMSTACK_BUILD_HASH build arg: Include git commit hash in container + # 3. ANOMSTACK_BUILD_HASH build arg: Include git commit hash in container # 4. --dockerfile: Explicit dockerfile path to avoid confusion fly deploy \ --no-cache \ --build-arg CACHEBUST="$CACHEBUST_VALUE" \ - --build-arg ANOMSTACK_BUILD_HASH="$GIT_COMMIT_HASH" \ + --build-arg ANOMSTACK_BUILD_HASH="$GIT_COMMIT_HASH" \ --dockerfile docker/Dockerfile.fly \ -a "$APP_NAME" else echo "⚡ Standard deployment (with caching)..." - fly deploy \ - --build-arg ANOMSTACK_BUILD_HASH="$GIT_COMMIT_HASH" \ - --dockerfile docker/Dockerfile.fly \ - -a "$APP_NAME" + fly deploy \ + --build-arg ANOMSTACK_BUILD_HASH="$GIT_COMMIT_HASH" \ + --dockerfile docker/Dockerfile.fly \ + -a "$APP_NAME"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
Makefile(1 hunks)dashboard/routes/index.py(1 hunks)docker/Dockerfile.fly(1 hunks)scripts/deployment/deploy_fly.sh(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Use Ruff for linting with a maximum line length of 100 characters for Python code
Files:
dashboard/routes/index.py
dashboard/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Star imports are allowed in dashboard modules
Files:
dashboard/routes/index.py
🧬 Code graph analysis (2)
dashboard/routes/index.py (1)
dashboard/app.py (1)
version_info(85-91)
scripts/deployment/deploy_fly.sh (1)
scripts/deployment/preview_fly_secrets.sh (1)
preview_env_vars_from_file(24-148)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
🔇 Additional comments (1)
dashboard/routes/index.py (1)
93-93: Please confirm intent for remaining version endpointThe scan shows that the only lingering import of version helpers in the dashboard layer is in
dashboard/app.py—the/versionendpoint still callsfrom anomstack.version import get_version_info(lines 88–89). All other dashboard code paths no longer referenceget_version_string,get_version_info, orversion_info.Additionally, the build hash environment variable (
ANOMSTACK_BUILD_HASH) is being set and consumed in your Dockerfiles and compose configs (e.g.,docker-compose.yaml,docker/Dockerfile.anomstack_dashboard), but not used by the UI layer itself.• dashboard/app.py (lines 85–91):
/versionendpoint remains and importsget_version_info.
• No otherget_version_string/get_version_infousages indashboard/**/*.py.
• Build-hash env var is only referenced in Docker and scripts, not in dashboard code.If the goal is solely to remove the version badge from the header and retain an API-accessible version endpoint, then no further code changes are needed here. If you intend to fully hide version info from the dashboard service (not just the UI), consider removing or securing the
/versionendpoint.
- Remove test_architecture_grpc_section_exists since gRPC code server is no longer the default architecture - This aligns with recent changes to use gRPC-free architecture by default 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
📊 Test Coverage ReportCoverage: 55% (yellow) ✅ Coverage maintained or improved!
|
This pull request introduces improvements to version tracking and display by capturing the git commit hash during build and deployment, and passing it into the container environment. It also removes the version string display from the dashboard UI. The main changes are grouped below:
Build and Deployment Version Tracking:
fly-build-testtarget in theMakefilenow captures the git commit hash and passes it as a build argument (ANOMSTACK_BUILD_HASH) to Docker, improving traceability of builds.scripts/deployment/deploy_fly.sh) captures the git commit hash before deploying and passes it as a build argument, ensuring the deployed container is tagged with the correct version. [1] [2]docker/Dockerfile.fly) now accepts theANOMSTACK_BUILD_HASHargument and sets it as an environment variable in the container, making the commit hash available at runtime.Dashboard UI Changes:
get_version_string) has been removed from the dashboard homepage, and the import ofget_version_stringhas been deleted, simplifying the UI. [1] [2]Summary by CodeRabbit
New Features
Style
Chores
Tests