feat(#926): version chip + git build provenance in NavBar/Settings - #931
Merged
Merged
Conversation
Contributor
Author
Operators couldn't tell which commit was running without SSH'ing to the host or `docker inspect`. `GET /api/version` only had the semver string plus an optional `BUILD_DATE` env var — no commit/branch surface, no in-app build info. This bakes the local git state into the backend image at build time and renders it in two places: Backend: - `_build_version_payload()` extracted from the `/api/version` handler as a pure helper so unit tests can drive it without main.py's full router graph (opentelemetry, slack_sdk, twilio, …). - Endpoint now returns `git_commit`, `git_commit_short` (first 8), `git_commit_subject`, `git_commit_timestamp`, `git_branch`, `build_date`. Everything defaults to `"unknown"` when build args are absent (local volume-mount workflows). - Endpoint stays JWT-authenticated (SEC-180). Build wiring: - `docker/backend/Dockerfile` accepts `GIT_COMMIT`, `GIT_COMMIT_SUBJECT`, `GIT_COMMIT_TIMESTAMP`, `GIT_BRANCH`, `BUILD_DATE` as `ARG`s and re-exports each as `ENV`. - `docker-compose.yml` `backend.build.args` block forwards the shell vars from the environment so `docker compose build` picks them up without explicit `--build-arg` flags. - `scripts/deploy/start.sh` exports the args from the local repo via `git rev-parse HEAD` / `git log -1 --pretty=%cI` / etc., gated on `git rev-parse --is-inside-work-tree` so CI tarball installs still build cleanly. Frontend: - `composables/useBuildInfo.js` — singleton fetch of `/api/version` cached in module scope; build metadata never changes at runtime. - `NavBar.vue` renders a small muted version chip (`v0.9.0 · abcd1234`). Click opens a modal with full commit/branch/build-date details. - `Settings.vue` General tab gets a "Build Info" section with the same payload rendered as a dl grid. Tests: `tests/unit/test_926_version_endpoint.py` — 3 pass. Exercises `_build_version_payload` directly with patched env vars to verify (a) all five new fields present when ENV set, (b) "unknown" fallback when ENV missing, (c) pre-#926 fields preserved. Live-verified: `curl /api/version` against the rebuilt backend returns the new fields, frontend chip + Settings panel render correctly. Related to #926. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
vybe
force-pushed
the
feature/926-version-build-info
branch
from
May 26, 2026 12:02
e9370fd to
ffb6e58
Compare
vybe
approved these changes
May 26, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Rebased on dev (resolved §35 numbering collision with #929 — now §36 Build Info Surface) and force-pushed.
Approval gated on CI re-run. One follow-up nit (not blocking): extract _build_version_payload into src/backend/version_info.py so tests/unit/test_926_version_endpoint.py can import it cleanly instead of source-slicing on \n\n\n. Works today but couples the test to PEP 8 spacing inside the helper.
This was referenced May 26, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Operators couldn't tell which commit was running without SSH'ing to the host or
docker inspect.GET /api/versiononly returned the semver string plus an optionalBUILD_DATEenv var — no commit/branch surface, no in-app build info. This bakes the local git state into the backend image at build time and renders it in NavBar + Settings.Changes
Backend
_build_version_payload()from the/api/versionhandler as a pure helper so unit tests can drive it without main.py's full router graph (opentelemetry, slack_sdk, twilio, …)./api/versionnow returnsgit_commit,git_commit_short(first 8),git_commit_subject,git_commit_timestamp,git_branch,build_date. Everything defaults to"unknown"when build args are absent (local volume-mount workflows).Build wiring
docker/backend/DockerfileacceptsGIT_COMMIT,GIT_COMMIT_SUBJECT,GIT_COMMIT_TIMESTAMP,GIT_BRANCH,BUILD_DATEasARGs and re-exports each asENV.docker-compose.ymlbackend.build.argsblock forwards the shell vars from the environment sodocker compose buildpicks them up without explicit--build-argflags.scripts/deploy/start.shexports the args from the local repo viagit rev-parse HEAD/git log -1 --pretty=%cI/ etc., gated ongit rev-parse --is-inside-work-treeso CI tarball installs still build cleanly.Frontend
composables/useBuildInfo.js— singleton fetch of/api/versioncached in module scope; build metadata never changes at runtime.NavBar.vuerenders a small muted version chip (v0.9.0 · abcd1234). Click opens a modal with full commit/branch/build-date details.Settings.vueGeneral tab gets a "Build Info" section with the same payload rendered as adlgrid.Tests
tests/unit/test_926_version_endpoint.py— 3 pass. Exercises_build_version_payloaddirectly with patched env vars to verify:"unknown"fallback when ENV missingTest extracts the helper by slicing the source (no full main.py import) so it stays venv-light. Sys.modules lint baseline unchanged.
Live verification
NavBar chip + Settings panel render correctly via Vite hot-reload.
Test plan
Files
src/backend/main.py— extracted_build_version_payload, extended/api/version(+35/-5)docker/backend/Dockerfile— ARG/ENV block (+17)docker-compose.yml—backend.build.args(+10)scripts/deploy/start.sh— export git vars (+13)src/frontend/src/composables/useBuildInfo.js— singleton cache (new, +45)src/frontend/src/components/NavBar.vue— version chip + modal (+73)src/frontend/src/views/Settings.vue— Build Info section (+56)docs/memory/architecture.md—/api/versionrow updateddocs/memory/requirements.md— §35 Build Info Surface (+58)tests/unit/test_926_version_endpoint.py— 3 tests (new)Out of scope (per issue body)
Closes will be set on merge.
Related to #926.
🤖 Generated with Claude Code