Skip to content

Conversation

@andrewm4894
Copy link
Owner

@andrewm4894 andrewm4894 commented Aug 23, 2025

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:

  • The fly-build-test target in the Makefile now captures the git commit hash and passes it as a build argument (ANOMSTACK_BUILD_HASH) to Docker, improving traceability of builds.
  • The Fly.io deployment script (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]
  • The Dockerfile for Fly (docker/Dockerfile.fly) now accepts the ANOMSTACK_BUILD_HASH argument and sets it as an environment variable in the container, making the commit hash available at runtime.

Dashboard UI Changes:

  • The version string display (previously shown using get_version_string) has been removed from the dashboard homepage, and the import of get_version_string has been deleted, simplifying the UI. [1] [2]

Summary by CodeRabbit

  • New Features

    • Container images now include the app’s build identifier for runtime visibility.
  • Style

    • Dashboard header simplified by removing the adjacent version text.
  • Chores

    • Build and deployment flows now pass the build identifier into image builds for both rebuild and standard deploy paths.
    • Build process logs and warnings added around build identifier resolution.
  • Tests

    • Removed a documentation-related test that validated a specific docs section.

- 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]>
@andrewm4894 andrewm4894 requested a review from Copilot August 23, 2025 21:24
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 23, 2025

Note

Other AI code review bot(s) detected

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

Walkthrough

Adds 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

Cohort / File(s) Summary of changes
Build orchestration
Makefile
Compute short Git commit hash (fallback "unknown"), echo it, and invoke docker build with --build-arg ANOMSTACK_BUILD_HASH="<hash>" (replaces prior single-line build invocation).
Docker image
docker/Dockerfile.fly
Add ARG ANOMSTACK_BUILD_HASH and set ENV ANOMSTACK_BUILD_HASH=${ANOMSTACK_BUILD_HASH} so the build hash is available at runtime.
Deployment script
scripts/deployment/deploy_fly.sh
Capture Git short commit hash (fallback empty), log presence/absence, and pass --build-arg ANOMSTACK_BUILD_HASH="${GIT_COMMIT_HASH}" into Fly deploy in both FORCE_REBUILD and normal paths.
Dashboard UI
dashboard/routes/index.py
Remove get_version_string import/fallback and remove version display from the main header rendering.
Tests
tests/test_docs_links.py
Remove test_architecture_grpc_section_exists() and its manual invocation; retain other tests unchanged.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I hop through commits, collecting a hash,
Tucked into builds in a neat little stash.
Docker hums, the image wakes,
Env holds the trace each release makes.
Quiet header now—no version sash. 🥕

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2cdfd01 and 443c051.

📒 Files selected for processing (1)
  • tests/test_docs_links.py (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/test_docs_links.py
⏰ 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
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch app-version-cleanup

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Copilot AI left a 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.

Comment on lines +237 to +244
# 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
Copy link

Copilot AI Aug 23, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 91 to 94
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(
Copy link

Copilot AI Aug 23, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 traceability

Avoid 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 debugging

You’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 build

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

📥 Commits

Reviewing files that changed from the base of the PR and between ab304cf and 2cdfd01.

📒 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 endpoint

The scan shows that the only lingering import of version helpers in the dashboard layer is in dashboard/app.py—the /version endpoint still calls from anomstack.version import get_version_info (lines 88–89). All other dashboard code paths no longer reference get_version_string, get_version_info, or version_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): /version endpoint remains and imports get_version_info.
• No other get_version_string / get_version_info usages in dashboard/**/*.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 /version endpoint.

- 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]>
@github-actions
Copy link

📊 Test Coverage Report

Coverage: 55% (yellow)

✅ Coverage maintained or improved!

💡 See detailed coverage report in the tests README

@andrewm4894 andrewm4894 merged commit 089df72 into main Aug 23, 2025
3 checks passed
@andrewm4894 andrewm4894 deleted the app-version-cleanup branch August 23, 2025 22:06
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.

2 participants