Skip to content

UN-2265 [FEAT] Show the running platform version on the profile page#2034

Open
athul-rs wants to merge 2 commits into
mainfrom
UN-2265-frontend-version-display
Open

UN-2265 [FEAT] Show the running platform version on the profile page#2034
athul-rs wants to merge 2 commits into
mainfrom
UN-2265-frontend-version-display

Conversation

@athul-rs

@athul-rs athul-rs commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What

  • The profile page's Organization card now shows a Platform Version field (e.g. v0.144.0) on all deployment targets — OSS docker, cloud, on-prem.

Why

UN-2265 — most apps surface their running version; users reporting issues currently have no way to tell us what version they're on, which slows down troubleshooting.

How

Version flows build → runtime → UI with no new endpoints:

  1. frontend.Dockerfile (production stage): ARG VERSION=devENV UNSTRACT_APPS_VERSION, added at the end to avoid layer-cache invalidation — the exact pattern backend.Dockerfile already uses. Production CI already passes *.args.VERSION to all services via docker bake (production-build.yaml), so published frontend images get the real version with no CI change.
  2. generate-runtime-config.sh: injects version into window.RUNTIME_CONFIG at container start (existing mechanism).
  3. config.js: exposes config.version (runtime config first, VITE_VERSION env fallback for dev).
  4. Profile.jsx: renders the field only when a version is available, using the existing field-group styling.

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No. Additive only: a new ENV in the image, one extra key in runtime config, and a conditionally rendered field. When UNSTRACT_APPS_VERSION is unset (older images, local dev server), config.version is empty and the field simply doesn't render.

Database Migrations

  • None

Env Config

  • UNSTRACT_APPS_VERSION (frontend container) — auto-populated from the VERSION build arg; can also be set at runtime (e.g. Helm env) to override.

Relevant Docs

  • N/A

Related Issues or PRs

  • Jira: UN-2265

Notes on Testing

  • Biome lint clean; vite build succeeds; sh -n passes on the runtime-config script; pre-commit hadolint passed on the Dockerfile change.
  • Manual: UNSTRACT_APPS_VERSION=v1.2.3 on the frontend container → profile page shows Platform Version: v1.2.3; unset → field hidden.

Screenshots

N/A

Checklist

I have read and understood the Contribution Guidelines.

🤖 Generated with Claude Code

Bake the build VERSION into the frontend image as
UNSTRACT_APPS_VERSION (same pattern as backend.Dockerfile), surface it
through the runtime config injected at container start, and show it as
a 'Platform Version' field on the profile page. Production CI already
passes *.args.VERSION to all images via docker bake, so published
images carry the real version on every deployment target; the field is
hidden when no version is available (e.g. local npm start).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e6a913a6-d83f-4747-b985-7a4339a97081

📥 Commits

Reviewing files that changed from the base of the PR and between aeba845 and ad1f1b2.

📒 Files selected for processing (2)
  • docker/dockerfiles/frontend.Dockerfile
  • frontend/generate-runtime-config.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • docker/dockerfiles/frontend.Dockerfile
  • frontend/generate-runtime-config.sh

Summary by CodeRabbit

  • New Features

    • Platform version is now displayed in the Organization section of a user's profile when available.
  • Chores

    • The application now surfaces a configurable platform version at runtime so deployments can provide and expose the app version to the UI.

Walkthrough

Build-time VERSION is added to the frontend Dockerfile, exposed as UNSTRACT_APPS_VERSION, escaped and injected into runtime-config.js as window.RUNTIME_CONFIG.version, surfaced in frontend/src/config.js, and conditionally shown in the profile UI as "Platform Version".

Changes

Platform Version Display

Layer / File(s) Summary
Build-time version configuration
docker/dockerfiles/frontend.Dockerfile
Adds ARG VERSION="" and ENV UNSTRACT_APPS_VERSION=${VERSION} near the end of the production stage.
Runtime config generation
frontend/generate-runtime-config.sh
Adds js_escape() helper, reads UNSTRACT_APPS_VERSION into APP_VERSION, and injects version: "${APP_VERSION}" into window.RUNTIME_CONFIG.
Config module version exposure
frontend/src/config.js
config.version added, resolving from window.RUNTIME_CONFIG.version with fallback to import.meta.env.VITE_VERSION.
Profile UI version display
frontend/src/components/profile/Profile.jsx
Imports config and conditionally renders a "Platform Version" field when config.version is truthy.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically summarizes the main change: adding a Platform Version field to the profile page's Organization card to display the running app version.
Description check ✅ Passed The PR description comprehensively covers all required template sections: What, Why, How, impact on existing features, env config, related issues, testing notes, and the contribution guidelines checklist.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 UN-2265-frontend-version-display

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.

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR surfaces the running platform version (UNSTRACT_APPS_VERSION) on the profile page's Organization card. Version flows from a Docker build arg → container env → window.RUNTIME_CONFIG (injected by generate-runtime-config.sh) → config.js → conditionally rendered in Profile.jsx.

  • Dockerfile: ARG VERSION="" / ENV UNSTRACT_APPS_VERSION=${VERSION} appended at the end of the production stage to minimise layer-cache churn, with an empty default so unset builds hide the field.
  • Shell script: A new js_escape() helper safely escapes \ and " before the version string is embedded in the JavaScript object literal; the computed value is written to window.RUNTIME_CONFIG.version.
  • UI: config.js reads runtimeConfig.version || import.meta.env.VITE_VERSION and Profile.jsx renders the field only when the value is truthy, so environments without a version set see no change.

Confidence Score: 5/5

Purely additive change — a new display-only field that renders only when a version string is available and is invisible otherwise. No existing behaviour is altered.

Every layer of the pipeline (Dockerfile, shell script, config, UI) handles the missing-version case correctly: an empty build arg keeps the env var unset, the script writes an empty string, config.js treats an empty string as falsy and tries the Vite fallback, and the JSX guard means the field simply never renders. The js_escape helper correctly neutralises the only characters that could break the JS object literal. No endpoints, auth flows, or data paths are touched.

No files require special attention.

Important Files Changed

Filename Overview
docker/dockerfiles/frontend.Dockerfile Adds ARG VERSION="" and ENV UNSTRACT_APPS_VERSION=${VERSION} at the end of the production stage; empty default correctly hides the version field when no build arg is supplied.
frontend/generate-runtime-config.sh Adds js_escape() to sanitize backslashes and double quotes before embedding the version string in the JS object literal; pre-computes APP_VERSION to avoid heredoc re-expansion issues.
frontend/src/config.js Adds version: runtimeConfig.version
frontend/src/components/profile/Profile.jsx Conditionally renders a Platform Version field in the Organization card using existing field-group styling; guarded by config.version && so the field is invisible when no version is available.

Sequence Diagram

sequenceDiagram
    participant CI as CI / Docker Build
    participant DF as frontend.Dockerfile
    participant SH as generate-runtime-config.sh
    participant RC as window.RUNTIME_CONFIG
    participant CF as config.js
    participant UI as Profile.jsx

    CI->>DF: "--build-arg VERSION=v0.144.0"
    DF->>DF: "ARG VERSION="" → ENV UNSTRACT_APPS_VERSION"
    Note over DF: Empty default hides field when arg is omitted

    Note over SH: Container start (nginx entrypoint.d)
    SH->>SH: js_escape(UNSTRACT_APPS_VERSION)
    SH->>RC: "write runtime-config.js { version: "v0.144.0" }"

    UI->>CF: import config
    CF->>RC: runtimeConfig.version
    RC-->>CF: "v0.144.0" (or "" → VITE_VERSION fallback)
    CF-->>UI: config.version

    alt config.version is truthy
        UI->>UI: render "Platform Version: v0.144.0"
    else config.version is falsy
        UI->>UI: field hidden (no render)
    end
Loading

Reviews (2): Last reviewed commit: "UN-2265 Address review: empty VERSION de..." | Re-trigger Greptile

Comment thread docker/dockerfiles/frontend.Dockerfile Outdated

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 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 `@frontend/generate-runtime-config.sh`:
- Line 13: The runtime-config write interpolates UNSTRACT_APPS_VERSION directly
into a JS string (version: "${UNSTRACT_APPS_VERSION:-}"), which can break the
resulting runtime-config.js if the env contains " or \; sanitize/escape the
value before writing. Replace occurrences of backslash and double-quote (and
newlines) in UNSTRACT_APPS_VERSION with escaped sequences (e.g. \ -> \\ and " ->
\") or produce a safe JS string using a JSON-stringifier (jq -R . or similar)
and then insert that quoted/escaped output into the version field so
runtime-config.js remains valid; update the portion of
generate-runtime-config.sh that emits the version line to use the
escaped/JSON-encoded value instead of the raw variable.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6d3b8725-fafd-4dd7-992a-783b76071583

📥 Commits

Reviewing files that changed from the base of the PR and between c14a3b3 and aeba845.

📒 Files selected for processing (4)
  • docker/dockerfiles/frontend.Dockerfile
  • frontend/generate-runtime-config.sh
  • frontend/src/components/profile/Profile.jsx
  • frontend/src/config.js

Comment thread frontend/generate-runtime-config.sh Outdated

# Capture build version at the very end so it doesn't affect layer caching
ARG VERSION=dev
ENV UNSTRACT_APPS_VERSION=${VERSION}

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.

@athul-rs does this get set during cloud builds as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes — cloud frontend builds go through docker bake with *.args.VERSION=${{ inputs.tag }} (cloud-frontend-docker-build-push.yaml), same as OSS production-build.yaml, so cloud images get the rc tag baked in automatically. On-prem frontend builds use the same workflow pattern.

@jaseemjaskp jaseemjaskp left a comment

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.

@athul From my point of view, the platform version is not particularly relevant to display in OSS or other environments.

For OSS, users already know which version they have deployed locally. For on-prem deployments, we maintain a version tracker and customers know exactly which version they are running. In cloud deployments, customers are always on the latest version, and we already know what version is currently deployed.

Because of that, I don’t think customers need to be aware of the platform version. I also don’t recall many enterprise applications exposing the platform version prominently in the UI.

@chandrasekharan-zipstack

Copy link
Copy Markdown
Contributor

@jaseemjaskp I think its useful to display the version for several reasons and we don't lose anything on attempting to do so. Its more of a convenience here

  • becomes easier to debug issues across environments
  • anyone using our dev namespace easily infers the version and can refer that while sending messages
    • faced this concern first hand when I repeatedly kept deploying different versions for testing
  • OSS users also find this hard because they'll only do a ./run-platform.sh -u (for upgrade) and they'll not immediately know what version of Unstract is being used
  • I believe most applications do show the app version within the product itself, makes it easier to convey and reason about issues

Do you see any engineering challenges or concerns in displaying this?

…e config

- ARG VERSION defaults to empty so images built without a version hide
  the field instead of showing 'dev'
- Escape backslashes/quotes before embedding the version in the
  generated JS
@github-actions

Copy link
Copy Markdown
Contributor

Frontend Lint Report (Biome)

All checks passed! No linting or formatting issues found.

@athul-rs

Copy link
Copy Markdown
Contributor Author

@jaseemjaskp fair point — taking this back to the ticket's intent rather than pushing my own view: UN-2265 was filed by @chandrasekharan-zipstack from a suggestion that surfacing the version helps support triage (when a user reports an issue, we can ask what version the UI shows instead of cross-referencing deploy trackers). The OSS docker-compose case is the strongest one IMO: latest images mean self-hosted users often genuinely don't know what they're running.

That said, this is a product call, not mine. Options as I see them:

  1. Merge as-is (field only shows where a version is baked, and it sits on the profile page rather than anywhere prominent).
  2. Gate it to OSS/on-prem only (trivial: don't pass the build-arg in cloud builds, the field auto-hides).
  3. Close the PR and mark UN-2265 as won't-do.

Happy with whichever you and Chandru align on — the change is additive and cheap to drop or gate.

@sonarqubecloud

Copy link
Copy Markdown

@athul-rs

Copy link
Copy Markdown
Contributor Author

@hari-kuriakose What should be the approach here ? Let's update the PR and ticket in jira accordingly.

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.

3 participants