[OPIK-6838] [FE] fix: show prompt name + version instead of commit hash in experiment views#7031
Conversation
| id: "prompt", | ||
| label: "Prompt commit", | ||
| label: "Prompt", | ||
| type: COLUMN_TYPE.list, | ||
| accessorFn: (row) => get(row, ["prompt_versions"], []), | ||
| // Show the prompt name plus its version. Unlike the Prompt Library | ||
| // experiments tab (where the prompt is implied by the page context), | ||
| // this global table needs the name too. Fall back to the commit hash | ||
| // only when no version number is available (OPIK-6838). | ||
| accessorFn: (row) => | ||
| (get(row, ["prompt_versions"], []) as ExperimentPromptVersion[]).map( | ||
| (v) => ({ | ||
| ...v, | ||
| version_label: `${v.prompt_name} (${ |
There was a problem hiding this comment.
The prompt column duplicates the leaderboard widget helper’s version_label/MultiResourceCell setup, so future formatting tweaks need two updates — should we extract a shared helper or column config?
Want Baz to fix this for you? Activate Fixer
There was a problem hiding this comment.
Commit 8f34024 addressed this comment by extracting formatPromptVersionLabel into a साझा helper in src/lib/experiments.ts and reusing it in both the prompt column and the leaderboard widget. That removes the duplicated version_label formatting logic and keeps the cells/labels consistent across the pages.
Follow-up to PR #7017. Review feedback on the prompt-linkage work flagged that experiment surfaces show the raw prompt commit hash, which users don't recognize. Show the human-readable version (version_number, e.g. v3) next to the prompt name, mirroring the already-approved Prompt Library experiments tab, and fall back to the commit hash only when no version number is available (null for masks). Surfaces updated (all v2, display-only — no data-layer/BE change): - ExperimentsPage/GeneralDatasetsTab: "Prompt commit" column -> "Prompt", rendering "<name> (<version>)" via version_label. - CompareExperimentsPage/ConfigurationTab: NavigationTag label built from version_number ?? commit instead of commit. - dashboards/ExperimentsLeaderboardWidget: same column fix (caught in review; identical commit-hash issue on the dashboard leaderboard). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
8de71a4 to
5d71509
Compare
| {promptVersions.map((pv) => { | ||
| // Prefer the human-readable version label; fall back to the commit | ||
| // hash only when the version number is unavailable (OPIK-6838). | ||
| const versionLabel = pv.version_number ?? pv.commit; | ||
| return ( | ||
| <NavigationTag | ||
| key={pv.id} | ||
| id={pv.prompt_id} | ||
| name={`${pv.prompt_name}${ | ||
| versionLabel ? ` (${versionLabel})` : "" | ||
| }`} | ||
| resource={RESOURCE_TYPE.prompt} |
There was a problem hiding this comment.
versionLabel / ${pv.prompt_name} (${versionLabel}) duplicates the version_label logic in GeneralDatasetsTab, should we extract a shared helper like formatPromptVersionLabel(...) so the display text stays consistent?
Want Baz to fix this for you? Activate Fixer
Other fix methods
Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
apps/opik-frontend/src/v2/pages/CompareExperimentsPage/ConfigurationTab/ConfigurationTab.tsx
around lines 191-205, the inline computation of `versionLabel` (using `pv.version_number
?? pv.commit`) and the resulting `name` string for `NavigationTag` is duplicated
elsewhere. Refactor by extracting a shared helper in an appropriate shared utilities
location (e.g., a formatter/util module) that takes a prompt version object (or the
needed fields) and returns the correctly formatted label string; then replace the inline
logic in ConfigurationTab with a call to that helper. Also update
apps/opik-frontend/src/v2/pages/ExperimentsPage/GeneralDatasetsTab/GeneralDatasetsTab.tsx
around lines 268-271 where `version_label` is built for `MultiResourceCell` to use the
same helper, so future formatting changes are made in one place.
There was a problem hiding this comment.
Commit 8f34024 addressed this comment by extracting formatPromptVersionLabel(...) into src/lib/experiments.ts and replacing the inline label construction in ConfigurationTab with that helper. It also updates GeneralDatasetsTab to use the same helper for version_label, centralizing the shared formatting logic.
| { | ||
| id: "prompt", | ||
| label: "Prompt commit", | ||
| label: "Prompt", | ||
| type: COLUMN_TYPE.list, | ||
| accessorFn: (row) => get(row, ["prompt_versions"], []), | ||
| // Show the prompt name plus its version. Unlike the Prompt Library | ||
| // experiments tab (where the prompt is implied by the page context), | ||
| // this global table needs the name too. Fall back to the commit hash | ||
| // only when no version number is available (OPIK-6838). | ||
| accessorFn: (row) => | ||
| (row.prompt_versions ?? []).map((v) => ({ | ||
| ...v, | ||
| version_label: `${v.prompt_name} (${v.version_number ?? v.commit})`, |
There was a problem hiding this comment.
prompt's version_label logic duplicates apps/opik-frontend/src/v2/pages-shared/dashboards/widgets/ExperimentsLeaderboardWidget/helpers.ts, should we extract a shared formatPromptVersionLabel/column helper so display rule changes only happen once?
Want Baz to fix this for you? Activate Fixer
There was a problem hiding this comment.
Commit 8f34024 addressed this comment by extracting formatPromptVersionLabel into src/lib/experiments.ts and reusing it in both the leaderboard widget and the experiments table. It also updated the compare/configuration UI to use the same helper, so the prompt display rule now lives in one place.
…lper Address review feedback (baz): the "<name> (<version>)" formatting was duplicated across the three surfaces. Centralize it in a single tested helper in lib/experiments.ts and reuse it from the Experiments table column, the single-experiment Configuration tab, and the dashboard leaderboard widget so the display rule changes in one place. Also adds unit tests for the version-number/commit fallback and the no-version case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| id: "prompt", | ||
| label: "Prompt commit", | ||
| label: "Prompt", | ||
| type: COLUMN_TYPE.list, | ||
| accessorFn: (row) => get(row, ["prompt_versions"], []), | ||
| // Show the prompt name plus its version (OPIK-6838). Unlike the Prompt | ||
| // Library experiments tab, where the prompt is implied by the page | ||
| // context, this global table needs the name too. | ||
| accessorFn: (row) => | ||
| (row.prompt_versions ?? []).map((v) => ({ | ||
| ...v, | ||
| version_label: formatPromptVersionLabel(v), | ||
| })), | ||
| cell: MultiResourceCell as never, |
There was a problem hiding this comment.
prompt duplicates the prompt_versions → version_label/MultiResourceCell setup from helpers.ts; should we extract a shared column builder so both tables reuse the same prompt config?
Want Baz to fix this for you? Activate Fixer
…sh in experiment views (#7031) * [OPIK-6838] [FE] fix: show prompt name + version instead of commit hash Follow-up to PR #7017. Review feedback on the prompt-linkage work flagged that experiment surfaces show the raw prompt commit hash, which users don't recognize. Show the human-readable version (version_number, e.g. v3) next to the prompt name, mirroring the already-approved Prompt Library experiments tab, and fall back to the commit hash only when no version number is available (null for masks). Surfaces updated (all v2, display-only — no data-layer/BE change): - ExperimentsPage/GeneralDatasetsTab: "Prompt commit" column -> "Prompt", rendering "<name> (<version>)" via version_label. - CompareExperimentsPage/ConfigurationTab: NavigationTag label built from version_number ?? commit instead of commit. - dashboards/ExperimentsLeaderboardWidget: same column fix (caught in review; identical commit-hash issue on the dashboard leaderboard). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * [OPIK-6838] [FE] refactor: extract shared formatPromptVersionLabel helper Address review feedback (baz): the "<name> (<version>)" formatting was duplicated across the three surfaces. Centralize it in a single tested helper in lib/experiments.ts and reuse it from the Experiments table column, the single-experiment Configuration tab, and the dashboard leaderboard widget so the display rule changes in one place. Also adds unit tests for the version-number/commit fallback and the no-version case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Details
Follow-up to #7017. Review feedback flagged that the prompt-linkage work surfaces the raw prompt commit hash in experiment views — a value users don't recognize. This frontend-only change shows the human-readable version (
version_number, e.g.v3) alongside the prompt name, mirroring the already-approved Prompt Library experiments tab, and falls back to the commit hash only when no version number is available (it'snullfor masks). No backend, data-layer, migration, orv1changes.GeneralDatasetsTab): rename thePrompt commitcolumn toPromptand render<name> (<version>)via a computedversion_label.ConfigurationTab): build the promptNavigationTaglabel fromversion_number ?? commitinstead ofcommit(keeps the existing name).ExperimentsLeaderboardWidget): same column fix — caught during code review; it had the identical commit-hash issue on a third live surface.commitlabel, since that view is specifically about commits.Change checklist
Issues
AI-WATERMARK
AI-WATERMARK: yes
Experiment.PromptVersionLink.versionNumberis returned by the backend (formatv<N>, null only for masks), so theversion_number ?? commitfallback is exercised correctly. Display-only label change reviewed against the approved Prompt Library experiments-tab pattern.Testing
Commands (from
apps/opik-frontend):npx tsc --project tsconfig.json --noEmit— clean (project-wide)npx eslint src --max-warnings=0— 0 warnings (project-wide)npx prettier --checkon the 3 changed files — passScope/regressions:
apps/opik-frontend/src/v2for remainingnameKey: "commit"/label: "Prompt commit"prompt surfaces; the only matches left are the Prompt Library Commits tab, where the commit label is intended.MultiResourceCellcontract (nameKey/idKey/getSearch).Not run: live UI screenshots — manual verification of the rendered labels is being confirmed by re-running an experiment from the Playground (reporter follow-up on the ticket).
Documentation
N/A — no user-facing docs change.
🤖 Generated with Claude Code