Skip to content

[OPIK-6838] [FE] fix: show prompt name + version instead of commit hash in experiment views#7031

Merged
awkoy merged 2 commits into
mainfrom
fix/opik-6838-prompt-version-labels
Jun 12, 2026
Merged

[OPIK-6838] [FE] fix: show prompt name + version instead of commit hash in experiment views#7031
awkoy merged 2 commits into
mainfrom
fix/opik-6838-prompt-version-labels

Conversation

@awkoy

@awkoy awkoy commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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's null for masks). No backend, data-layer, migration, or v1 changes.

  • Experiments table (GeneralDatasetsTab): rename the Prompt commit column to Prompt and render <name> (<version>) via a computed version_label.
  • Single-experiment Configuration tab (ConfigurationTab): build the prompt NavigationTag label from version_number ?? commit instead of commit (keeps the existing name).
  • Dashboard Experiments leaderboard (ExperimentsLeaderboardWidget): same column fix — caught during code review; it had the identical commit-hash issue on a third live surface.
  • The Prompt Library → Prompt → Experiments tab already displayed the version correctly and is unchanged. The Prompt Library Commits tab keeps the commit label, since that view is specifically about commits.

Change checklist

  • User facing
  • Documentation update

Issues

  • OPIK-6838

AI-WATERMARK

AI-WATERMARK: yes

  • If yes:
    • Tools: Claude Code
    • Model(s): claude-opus-4-8
    • Scope: All files
    • Human verification: Yes — confirmed Experiment.PromptVersionLink.versionNumber is returned by the backend (format v<N>, null only for masks), so the version_number ?? commit fallback 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 --check on the 3 changed files — pass

Scope/regressions:

  • Swept apps/opik-frontend/src/v2 for remaining nameKey: "commit" / label: "Prompt commit" prompt surfaces; the only matches left are the Prompt Library Commits tab, where the commit label is intended.
  • No unit tests exist for these display components (table-column config only); behavior is verified via type-checking + the shared MultiResourceCell contract (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

@awkoy
awkoy requested a review from a team as a code owner June 11, 2026 14:13
Comment on lines +260 to +271
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} (${

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.

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?

Severity

Want Baz to fix this for you? Activate Fixer

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.

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>
@awkoy
awkoy force-pushed the fix/opik-6838-prompt-version-labels branch from 8de71a4 to 5d71509 Compare June 11, 2026 14:24
Comment on lines +191 to +202
{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}

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.

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?

Severity

Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

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.

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.

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.

Comment on lines +259 to +270
{
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})`,

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.

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?

Severity

Want Baz to fix this for you? Activate Fixer

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.

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>
Comment on lines 261 to 272
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,

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.

prompt duplicates the prompt_versionsversion_label/MultiResourceCell setup from helpers.ts; should we extract a shared column builder so both tables reuse the same prompt config?

Severity

Want Baz to fix this for you? Activate Fixer

@aadereiko aadereiko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@awkoy
awkoy merged commit 67323ad into main Jun 12, 2026
10 checks passed
@awkoy
awkoy deleted the fix/opik-6838-prompt-version-labels branch June 12, 2026 10:33
jverre pushed a commit that referenced this pull request Jun 12, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants