feat(web): display app version in the sidebar, sourced from version.txt - #459
Conversation
Closes #458. Fixes a latent bug along the way: web/src/api/errorReport.ts has always read import.meta.env.VITE_APP_VERSION for crash reports, but nothing ever set it — in CI or the Dockerfile — so every crash report, including from production, silently sent appVersion: undefined. - web/.env.production (new, .gitignore negated — VITE_APP_VERSION is a public string baked into the client bundle regardless of whether it's committed) carries VITE_APP_VERSION, loaded automatically by Vite for a production build. No Dockerfile/CI plumbing needed beyond the file itself existing. - release-please-config.json gains an extra-files entry (the `generic` updater, anchored by an x-release-please-version marker on the line above the value — not a trailing comment, since dotenv-style parsers don't strip inline # comments) so future release PRs bump this file in the same PR as version.txt/the manifest. - AppLayout.tsx renders "v{{version}}" in the sidebar footer, alongside the theme toggle/sign-out — absent entirely in dev/test builds (the var is unset there), rather than showing a broken "v" or "vundefined". Verified end-to-end via a real `npm run build`: the built bundle contains `0.0.2` baked into both errorReport.ts's appVersion and AppLayout.tsx's APP_VERSION, confirming the whole pipeline works, not just the unit test. New test mutation-checked: the guard against a missing VITE_APP_VERSION was verified against the ACTUAL i18next behavior (a bare "v" — i18next renders a missing interpolation as empty, not string-concatenated "vundefined" as first assumed and tested for, which would have silently passed against the real bug). Could not verify the release-please extra-files wiring itself against a real release-please dry run (no network access to test the action) — this is the one part of the change that needs confirming on the next actual release PR: that web/.env.production's version line moves in lockstep with version.txt.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1a52a66e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…eview) version.txt/the manifest moved to 0.0.3 on main since this branch was cut; 0.0.2 would have shipped in every image built from this commit until a later release PR happened to correct it (affects CI's per-merge images, not just a local build).
|
@codex address that feedback |
Summary
Testing
|
|
Reopening: the extra-files sync this issue shipped didn't actually fire on the first real release (#461, v0.0.4). Root cause: release-please's generic updater matches a semver pattern only on the same line as the |
release-please's generic updater only matches a semver pattern on the same line as the x-release-please-version marker, not the line below it. #459 placed the marker above the value, so it silently never matched — v0.0.4 (#461) bumped version.txt but left web/.env.production at 0.0.3, caught by review. Move the marker to a trailing comment on the value's own line. dotenv (Vite's env loader) strips inline # comments on unquoted values, so the runtime value stays clean — verified via a real npm run build and a grep of the bundled output. Fixes #458 Co-authored-by: mforce <>
Closes #458.
Problem
No visible version identifier anywhere in the app — no way to say "which build am I on" from a screenshot or support conversation.
A latent bug found along the way
web/src/api/errorReport.tshas always readimport.meta.env.VITE_APP_VERSIONfor crash reports (the comment there says "set at build time... absent in dev builds"), but nothing ever actually set it — not in CI'snpm run build, not in the Dockerfile'sRUN npm run build. So every crash report, including from production, has been silently sendingappVersion: undefined. Fixed as part of this change, not separately, since the fix is the same plumbing.Design
Per discussion: extend release-please rather than invent new CI plumbing.
web/.env.production(new) carriesVITE_APP_VERSION=0.0.2. Vite loads.env.productionautomatically for a production-mode build (vite builddefaults tomode: production) — no Dockerfile/CI changes needed beyond the file existing;COPY web/ ./in the Dockerfile already picks it up, and it isn't excluded by.dockerignore(**/.envmatches only the exact filename.env)..gitignorenegates it (!web/.env.production) — the root.gitignore's.env.*pattern would otherwise block committing it.VITE_APP_VERSIONis a public string baked into the client bundle regardless of whether it's committed, not a secret.release-please-config.jsongains anextra-filesentry using release-please'sgenericupdater, anchored by anx-release-please-versionmarker comment on the line above the value (not a trailing same-line comment — dotenv-style.envparsing doesn't strip inline#comments the way YAML/generic key:value formats do, so a trailing marker would have become part of the value). This makes future release PRs bumpweb/.env.productionin lockstep withversion.txt/the manifest, same PR, same commit.AppLayout.tsxrendersv{{version}}in the sidebar footer, next to the theme toggle/sign-out — the existing.sidebar-footchrome. Absent entirely when the var is unset (dev/test builds), rather than rendering something broken.Verification
npm run typecheck/npm run i18n:scan(COUNT: 3, unchanged baseline) /npm test(1412/1412, +1 new) all green.npm run build, not just the unit test: grepped the built bundle and confirmed0.0.2is correctly baked into botherrorReport.ts'sappVersionandAppLayout.tsx'sAPP_VERSION— proves the whole.env.production→ Vite substitution pipeline actually works, not just that the code compiles.{{version}}interpolation as"vundefined"(JS string-concat style) — wrong. Printed the actual DOM and found i18next renders it as a bare"v"(empty interpolation). Rewrote the test against the real behavior, then mutation-tested it (temporarily removed theAPP_VERSION &&guard) and confirmed it now correctly goes red.What's unverified
I could not test the
release-please-config.jsonextra-fileswiring against a real release-please dry run (no network access to invoke the action here). This is the one part of the change that needs confirming on the next actual release PR — thatweb/.env.production's version line moves in lockstep withversion.txt. If it doesn't, the marker-comment placement is the first thing to check.Docs
Added a short note to
docs/decisions/351-releases.mddocumenting theextra-filesaddition and why the marker comment is placed where it is (dotenv inline-comment gotcha).