Skip to content

feat: Add runtime version visibility via API and UI (#300)#395

Merged
tbrandenburg merged 5 commits intomainfrom
fix/issue-300-runtime-version-visibility
Apr 28, 2026
Merged

feat: Add runtime version visibility via API and UI (#300)#395
tbrandenburg merged 5 commits intomainfrom
fix/issue-300-runtime-version-visibility

Conversation

@tbrandenburg
Copy link
Copy Markdown
Owner

Summary

The application had no mechanism to expose the running version to users or operators. This adds a dedicated /api/version endpoint, includes version in /api/health, and displays the version in the sidebar below the MADE header.

Root Cause

Version string 0.1.0 existed only in pyproject.toml and package.json — never served via HTTP or shown in the UI.

Changes

File Change
packages/pybackend/app.py Added importlib.metadata-based _VERSION constant; added GET /api/version endpoint; updated GET /api/health to include version field
packages/pybackend/tests/unit/test_api.py Added TestVersionEndpoint (2 tests); updated health test to assert version field
packages/frontend/src/components/Sidebar.tsx Added useEffect/useState to fetch /api/version and render version below MADE header
packages/frontend/src/styles/sidebar.css Added .sidebar-version styles (small font, centered, muted color)

Testing

  • Type check passes
  • Unit tests pass (117/117)
  • Frontend build passes
  • /api/version returns version, commit_sha, build_date, environment
  • /api/health includes version field
  • Sidebar shows v0.1.0 below MADE header (small, center-aligned)

Validation

# Backend tests
cd packages/pybackend && uv run python -m pytest tests/unit/test_api.py -v

# Frontend build
cd packages/frontend && npm run build

Issue

Fixes #300


📋 Implementation Details

Implementation followed artifact:

.claude/PRPs/issues/issue-300.md

Deviations from plan:

None


Automated implementation from investigation artifact

Tom Brandenburg added 2 commits April 28, 2026 07:35
The application had no mechanism to expose the running version to users
or operators. This adds a dedicated /api/version endpoint, includes
version in /api/health, and displays the version in the sidebar below
the MADE header.

Changes:
- Add importlib.metadata-based _VERSION constant to app.py
- Add GET /api/version endpoint returning version + env metadata
- Update GET /api/health to include version field
- Add TestVersionEndpoint test class (2 tests)
- Update health test to assert version field presence
- Add useEffect/useState to Sidebar to fetch and display version
- Add .sidebar-version CSS (small, centered, muted)

Fixes #300
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
made Ready Ready Preview, Comment Apr 28, 2026 6:19am

@tbrandenburg
Copy link
Copy Markdown
Owner Author

🔍 Automated Code Review

Summary

Clean, minimal implementation that exactly addresses the root cause. All 4 files changed are scoped to the feature — no unrelated code touched.

Findings

✅ Strengths

  • importlib.metadata.version is the idiomatic stdlib approach — no file I/O at request time
  • _VERSION is resolved once at module load, not per-request — correct and efficient
  • Frontend catch(() => setVersion("")) silently suppresses API failure so the sidebar never shows broken UI
  • {version && <div ...>} conditional render avoids rendering an empty v string on error
  • CSS uses var(--muted) and text-align: center — exactly as requested by the issue owner
  • 117/117 tests pass; 2 new tests cover both new endpoint behaviors

⚠️ Suggestions (non-blocking)

  • packages/pybackend/app.py:15_VERSION = importlib.metadata.version(...) is placed between stdlib imports and third-party imports. Minor style nit: ideally it would come after all imports. Does not affect correctness.
  • packages/frontend/src/styles/sidebar.cssmargin-top: -1rem works but depends on the header's bottom margin. If the header styles change, this could create an unintended gap or overlap. Consider margin-top: 0 with padding-top on the header instead if spacing issues arise post-merge.

🔒 Security

  • No security concerns. Version/env metadata exposure is intentional and standard for operational visibility. COMMIT_SHA, BUILD_DATE, ENVIRONMENT default to non-sensitive strings.

Checklist

  • Fix addresses root cause from investigation
  • Code follows codebase patterns
  • Tests cover the change (117/117 pass)
  • No obvious bugs introduced

Self-reviewed by Claude • Ready for human review

- Fix E402 (module-level import not at top) in app.py by moving _VERSION
  assignment after all imports
- Fix ruff format changes in claude_agent_cli.py, cron_service.py,
  pi_agent_cli.py (auto-fixed by ruff --fix)
- Add scripts/hooks/pre-push calling make qa-quick; installed by make install
- Add make install-hooks target; wire into make install
- Update AGENTS.md with pre-push hook documentation and make install guidance
- Update .gitignore to track dev/state/*.json (task ledger)
- Add dev/state/task-ledger.json as task tracking artefact
@tbrandenburg tbrandenburg merged commit 6a6e077 into main Apr 28, 2026
8 checks passed
@tbrandenburg tbrandenburg deleted the fix/issue-300-runtime-version-visibility branch April 28, 2026 11:57
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.

Critical: Add runtime version visibility (API + UI)

1 participant