Skip to content

Preserve legend selections across metric changes - #746

Open
cquil11 wants to merge 1 commit into
masterfrom
fix/persist-legend-selection
Open

Preserve legend selections across metric changes#746
cquil11 wants to merge 1 commit into
masterfrom
fix/persist-legend-selection

Conversation

@cquil11

@cquil11 cquil11 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve the user's active legend subset when switching the Y-axis metric or X-axis mode.
  • Refresh the automatic Best per SKU winners when the selected metric changes.
  • Keep official and ?unofficialrun= overlay behavior aligned.
  • Continue resetting legend selections when model, scenario, precision, or official/unofficial-run scope changes.

Root cause

The legend reset key included axis controls, so every metric change reset manual selections. Removing those controls exposed a separate automatic-mode requirement: Best per SKU is metric-aware and must still refresh when the axes change. The implementation now treats manual and automatic selections independently.

Verification

  • bun run fmt
  • bun run lint
  • bun run typecheck
  • bun run test:unit (3,922 tests)
  • Focused Cypress coverage in Chrome (38 tests), including unofficial-run overlays

Note

Medium Risk
Changes inference legend state logic across context and overlay mode; behavior is nuanced but covered by expanded Cypress and unit tests rather than security-critical paths.

Overview
Legend hardware selection no longer resets when you change the Y-axis metric or X-axis mode. The reset key in InferenceContext now only tracks model, sequence, precision, and official vs unofficial scope—not axis controls—so manual hide/show subsets survive metric switches.

When Best per SKU stays enabled, winners still recompute for the new axes (metric-aware Pareto), including official series and unofficial overlay series in ScatterGraph. If no series is scoreable, selection falls back to the full in-scope set.

Overlay legend edits (toggle or remove while ?unofficialrun= is loaded) turn off Best per SKU via setBestPerSku(false, { applySelection: false }) so the restored official activeHwTypes when the overlay is dismissed are not overwritten.

Cypress and unit tests cover metric-change persistence, Best per SKU refresh, and overlay behavior.

Reviewed by Cursor Bugbot for commit 4868850. Bugbot is set up for automated code reviews on this repo. Configure here.

@cquil11
cquil11 requested a review from adibarra as a code owner August 16, 2026 19:40
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inferencemax-app Ready Ready Preview Aug 16, 2026 8:15pm

Request Review

Comment thread packages/app/src/components/inference/InferenceContext.tsx
@cquil11 cquil11 changed the title Preserve legend selection across metric changes / 切换指标时保留图例选择 Preserve legend selections across metric changes Aug 16, 2026
@cquil11
cquil11 force-pushed the fix/persist-legend-selection branch from b94daa6 to 1600fdd Compare August 16, 2026 20:07

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1600fdd. Configure here.

Comment thread packages/app/src/components/inference/ui/ScatterGraph.tsx
Comment thread packages/app/src/components/inference/ui/ScatterGraph.tsx
Preserve manual legend subsets when switching Y-axis metrics or X-axis modes. Refresh metric-aware Best per SKU selections automatically, including unofficial-run overlays, and add regression coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant