Skip to content

bug(prompts): duplicate platform groups on the prompt detail page when a model slug changes #236

Closed

Description

@gkhngyk

Problem

On the prompt detail page (/dashboard/prompts/<id>), the per-platform grouping splits one logical platform into two groups when the provider's model slug changes over time — e.g. ChatGPT showing up twice because its model went from gpt-5-5 to gpt-5-3-mini.

This is the same bug that was just fixed for the Answer Engine Insights page in #231 / #235 — the prompt detail page has its own copy of the grouping logic that was missed.

Steps to reproduce

  1. Open a prompt detail page for a prompt that has been tracked across a model-slug change (e.g. ChatGPT or Grok, whose slugs have drifted).
  2. Observe the platform groups: the same platform appears as two separate cards.

Expected: one group per platform, with the model badge reflecting the latest run.
Actual: two groups for the same platform, one per historical model slug.

Root cause

groupByPlatform() in web/src/app/[locale]/(dashboard)/dashboard/prompts/[id]/page.tsx keys groups by platform + model:

const key = `${result.platform}|${result.modelUsed ?? ''}`;

modelUsed carries whatever slug the provider returned, so each slug change spawns a phantom second group. A platform is never tracked with two models concurrently — the slug just drifts over time.

Suggested fix

Mirror the fix from #235: key the groups by platform only, and keep the group's modelUsed sourced from the latest run so the badge still shows the current model.

const key = result.platform;

The function already sets modelUsed: latest.modelUsed from the most-recent run (line ~154), so the badge keeps reflecting the current model with no further change. Genuinely distinct platforms keep distinct platform values, so they stay separate.

Acceptance criteria

  • A prompt whose platform model slug changed over time shows one group per platform (no duplicate ChatGPT / Grok cards)
  • The platform group's model badge reflects the most recent run's model
  • The previous-runs history inside a group spans runs from before and after the slug change
  • Genuinely distinct platforms remain separate groups
  • Display/grouping layer only — no data or RPC changes

Notes

The insights page now keeps this logic in a shared, unit-tested grouping.ts module (#235). This prompt-detail copy could either reuse that pattern or apply the same one-line key change locally — whichever the contributor prefers; a small Vitest case for the slug-drift scenario would be welcome.

Activity

  1. added
    bug
    good first issue
    on Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions