Skip to content

chore: show build info in UI#1146

Merged
adityachoudhari26 merged 1 commit into
mainfrom
show-build-info-ui
May 19, 2026
Merged

chore: show build info in UI#1146
adityachoudhari26 merged 1 commit into
mainfrom
show-build-info-ui

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

@adityachoudhari26 adityachoudhari26 commented May 19, 2026

fixes #1122

Summary by CodeRabbit

  • New Features
    • Added a version badge to the application sidebar displaying API and Workspace Engine version information. Users can now easily view the versions of running services directly from the interface.

Review Change Stack

Copilot AI review requested due to automatic review settings May 19, 2026 18:33
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

This PR implements a version information display feature across the stack. The Workspace Engine exposes its version via the /healthz endpoint; the API aggregates the API and engine versions and serves them at /api/version; and the web frontend displays both versions in a sidebar badge with dialog details.

Changes

Version Information Display

Layer / File(s) Summary
Workspace Engine version endpoint
apps/workspace-engine/svc/http/server/server.go
Imports the version package and extends /healthz response to include a version field.
API version configuration and endpoint
apps/api/src/config.ts, apps/api/src/routes/version.ts, apps/api/src/server.ts
Adds CTRLPLANE_VERSION env var with default "dev", creates versionHandler that reads the API version and fetches the Workspace Engine version from /healthz with a 2000ms timeout, and registers the /api/version route while excluding it from OpenAPI validation.
Web version badge component and integration
apps/web/app/components/VersionBadge.tsx, apps/web/app/routes/ws/_layout.tsx
Implements VersionBadge component that reads VITE_CTRLPLANE_VERSION from build env and fetches /api/version using React Query; integrates badge into workspace sidebar footer to display API and Workspace Engine versions in a dialog.

Sequence Diagram

sequenceDiagram
  participant User as User
  participant Web as Web App
  participant API
  participant Engine as Workspace Engine
  User->>Web: Load workspace
  Web->>Web: VersionBadge reads VITE_CTRLPLANE_VERSION
  Web->>Web: useServiceVersions hook mounts
  Web->>API: GET /api/version
  API->>API: read env.CTRLPLANE_VERSION
  API->>Engine: fetch /healthz (2000ms timeout)
  Engine-->>API: { version, status, service }
  API-->>Web: { api, workspaceEngine }
  Web->>User: Render version badge with dialog
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • ctrlplanedev/ctrlplane#1145: Both PRs wire the "build/version" value through Docker/env into the same version variables (CTRLPLANE_VERSION for the API and VITE_CTRLPLANE_VERSION for the web), which this PR then exposes via /api/version and displays in VersionBadge.

Poem

🐰 The versions align, from engine to app,
A badge in the sidebar, no need to check the map,
Build info flows freely through layers below,
Now everyone sees what's deployed and will know! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'chore: show build info in UI' accurately summarizes the main objective of displaying build/version information in the UI.
Linked Issues check ✅ Passed The PR implementation meets the requirement from issue #1122 by exposing version information through API endpoints and displaying it in the UI via the VersionBadge component.
Out of Scope Changes check ✅ Passed All changes directly support the objective of showing build/version info in the UI; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch show-build-info-ui

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/app/components/VersionBadge.tsx`:
- Around line 22-23: Replace the direct fetch call in VersionBadge (the function
that currently does `const response = await fetch("/api/version"); return
response.json();`) with the shared OpenAPI client: import and call createClient
from `~/api/openapi-client`, instantiate the client (e.g., `const client =
createClient()`), then call the appropriate generated operation (the REST
endpoint for version) on the client instead of `fetch`, and return/handle its
typed response; update any local types/await handling to match the client's
return shape.
- Around line 22-24: The code calls response.json() unconditionally after
fetch("/api/version") which can throw on non-2xx responses; update the fetch
logic in VersionBadge (the function that performs fetch("/api/version")) to
check response.ok before parsing, and if not OK either throw a descriptive error
or return a safe fallback (e.g., null) so the caller/query doesn't enter an
unexpected error state; reference the response variable and the response.json()
call when making this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aa4a23dd-1bf9-4b00-8b22-d1313fb41c1a

📥 Commits

Reviewing files that changed from the base of the PR and between e308cef and bfe7950.

📒 Files selected for processing (6)
  • apps/api/src/config.ts
  • apps/api/src/routes/version.ts
  • apps/api/src/server.ts
  • apps/web/app/components/VersionBadge.tsx
  • apps/web/app/routes/ws/_layout.tsx
  • apps/workspace-engine/svc/http/server/server.go

Comment on lines +22 to +23
const response = await fetch("/api/version");
return response.json();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Use the shared OpenAPI client for this REST call.

This direct fetch("/api/version") bypasses the web app’s REST client convention and can drift from shared request behavior.

As per coding guidelines, "Use createClient from ~/api/openapi-client for REST-only endpoints".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/app/components/VersionBadge.tsx` around lines 22 - 23, Replace the
direct fetch call in VersionBadge (the function that currently does `const
response = await fetch("/api/version"); return response.json();`) with the
shared OpenAPI client: import and call createClient from `~/api/openapi-client`,
instantiate the client (e.g., `const client = createClient()`), then call the
appropriate generated operation (the REST endpoint for version) on the client
instead of `fetch`, and return/handle its typed response; update any local
types/await handling to match the client's return shape.

Comment on lines +22 to +24
const response = await fetch("/api/version");
return response.json();
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Guard non-OK responses before JSON parsing.

response.json() is called unconditionally; on non-2xx responses this can throw and put the query into an error state unnecessarily.

Proposed fix
     queryFn: async (): Promise<ServiceVersions> => {
       const response = await fetch("/api/version");
-      return response.json();
+      if (!response.ok) {
+        return { api: "—", workspaceEngine: null };
+      }
+      return (await response.json()) as ServiceVersions;
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const response = await fetch("/api/version");
return response.json();
},
queryFn: async (): Promise<ServiceVersions> => {
const response = await fetch("/api/version");
if (!response.ok) {
return { api: "—", workspaceEngine: null };
}
return (await response.json()) as ServiceVersions;
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/app/components/VersionBadge.tsx` around lines 22 - 24, The code
calls response.json() unconditionally after fetch("/api/version") which can
throw on non-2xx responses; update the fetch logic in VersionBadge (the function
that performs fetch("/api/version")) to check response.ok before parsing, and if
not OK either throw a descriptive error or return a safe fallback (e.g., null)
so the caller/query doesn't enter an unexpected error state; reference the
response variable and the response.json() call when making this change.

Copy link
Copy Markdown
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

Adds runtime/build version visibility across Ctrlplane services and exposes it in the web UI to address #1122 (“show build info in the UI like argo does”).

Changes:

  • Workspace-engine /healthz now includes a version field.
  • API adds a public /api/version endpoint that returns API version plus workspace-engine version (queried via /healthz).
  • Web app adds a VersionBadge in the workspace sidebar footer that opens an “About Ctrlplane” dialog showing web/api/workspace-engine versions.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/workspace-engine/svc/http/server/server.go Adds version to the workspace-engine health check response.
apps/web/app/routes/ws/_layout.tsx Renders the new VersionBadge in the sidebar footer.
apps/web/app/components/VersionBadge.tsx New UI component + react-query fetch to display versions in a dialog.
apps/api/src/server.ts Registers /api/version and excludes it from OpenAPI request validation.
apps/api/src/routes/version.ts Implements /api/version handler and workspace-engine version fetch w/ timeout.
apps/api/src/config.ts Introduces CTRLPLANE_VERSION env var (default dev).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return useQuery({
queryKey: ["version"],
queryFn: async (): Promise<ServiceVersions> => {
const response = await fetch("/api/version");
@adityachoudhari26 adityachoudhari26 merged commit 1de3d28 into main May 19, 2026
20 checks passed
@adityachoudhari26 adityachoudhari26 deleted the show-build-info-ui branch May 19, 2026 19:29
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.

Ctrlplane should show build info in the UI like argo does

2 participants