Add always-visible version badge on simulation result pages#2832
Open
Add always-visible version badge on simulation result pages#2832
Conversation
Implements #2831 — the plain version- identification surface (distinct from the TRACE cite-this-result flow in #2830, which is blocked on api backend work). - Adds `src/layout/VersionBadge.jsx`: small monospace strip showing `policyengine-<country>@<version> · <dataset>` with a click-to-expand popover listing the full identifiers and cross-linking to #2830 for the forthcoming TRO citation flow. - Wires the badge into policy output (`src/pages/policy/output/Display.jsx`, inline with the existing bottom text) and household output (`src/pages/household/output/HouseholdOutput.jsx`, bottom-aligned after computed panes). - Accepts optional `dataVersion` and `h5Sha` props so that once the api v4 migration (PolicyEngine/policyengine-api#3486) exposes the policyengine-<country>-data version and calibrated h5 SHA, the badge can consume those fields without further component changes. - Five jest tests covering: country-package labeling for us/uk, dataset fallback when not set, truncated h5 sha display, renders-nothing when modelVersion missing, and correct composite output when all fields are passed. Based on feedback in the 2026-04-21 meeting with Lars Vilhuber and the TRACE team: Casper explicitly distinguished version identification (what every user needs) from TRACE certification (what reviewers of papers citing runs need). This issue is the former. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an always-visible “version badge” UI element to simulation result pages so users can quickly identify the model package/version and dataset used to generate a result, with a click-to-expand popover for more detail and future TRACE integration.
Changes:
- Introduces
src/layout/VersionBadge.jsx(badge + popover; optionaldataVersion/h5Shasupport). - Wires the badge into policy output (
Display.jsx) and household output (HouseholdOutput.jsx) result pages. - Adds Jest coverage for the new component and updates
.gitignoreto ignore a Bun lockfile.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/policy/output/Display.jsx | Renders VersionBadge alongside the existing bottom text on policy result pages. |
| src/pages/household/output/HouseholdOutput.jsx | Renders a compact VersionBadge footer on household result pages once results are available. |
| src/layout/VersionBadge.jsx | New reusable badge component with antd Popover details panel. |
| src/tests/layout/VersionBadge.test.js | Tests for rendering, fallbacks, and optional identifiers (data version + truncated SHA). |
| .gitignore | Ignores Bun lockfile to avoid local tooling noise in git status. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -352,19 +353,34 @@ export function LowLevelDisplay(props) { | |||
| //eslint-disable-next-line | |||
| const bottomElements = | |||
| mobile & !embed ? null : ( | |||
| onKeyDown={(event) => { | ||
| if (event.key === "Enter" || event.key === " ") { | ||
| event.preventDefault(); | ||
| setPopoverOpen(!popoverOpen); |
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
Why
Distinct from the TRACE cite-this-result flow (#2830, blocked on backend work). Per Casper at the 2026-04-21 meeting with Lars Vilhuber, plain version identification — "which pinned rules and which pinned data produced this number?" — is what every user needs. TRACE certification is what reviewers of papers citing runs need. This issue is the former, and it ships independently of any backend change.
Fixes #2831.
Test plan
🤖 Generated with Claude Code