Skip to content

fix: experiment results polish - #8166

Open
Zaimwa9 wants to merge 8 commits into
mainfrom
fix/experiment-results-polish
Open

fix: experiment results polish#8166
Zaimwa9 wants to merge 8 commits into
mainfrom
fix/experiment-results-polish

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

UI/UX fixes for the experiment results page:

  • When control wins, the summary card becomes "Control vs best variant" and shows the best treatment's lift negated (e.g. +65.1%) instead of "Baseline".
  • Control's win probability is inferred from the treatments' chances instead of showing an em dash.
  • Long variant names in the axis chart truncate with an ellipsis instead of overflowing the chart edge.
  • Narrower Delta column, wider Variant column; delta track hidden below 1264px.
  • Delta and win-probability tracks use a clearer surface colour in dark mode.
  • Summary card values use the same typography as usage stats; winning variation shows its colour swatch; "Chance to be best" is green above 90%.
  • VariantName takes a fontSize prop and vertically centres its swatch without disturbing the text baseline.
  • Header metric name bumped by 2px.

How did you test this code?

Manually.

Swatch + variant alignment
image

Increased text + ellipsis + reduced Delta column width + winning control version
image

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Building Building Preview Aug 4, 2026 9:28am
flagsmith-frontend-staging Ready Ready Preview Aug 4, 2026 9:28am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 4, 2026 9:28am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Experiment result derivation now calculates control win probability separately, selects winners using treatment and control probabilities, and exposes revised lift summary fields. Scorecards consume these values for control and treatment rows, while summary cards use formatted winner, chance, and lift displays. Variant names, stat markup, chart labels, metric typography, track colours, and responsive lift visibility were also updated.

Estimated code review effort: 4 (Complex) | ~45 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Zaimwa9

Zaimwa9 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@themis-blindfold review

@Zaimwa9
Zaimwa9 marked this pull request as ready for review July 30, 2026 14:48
@Zaimwa9
Zaimwa9 requested a review from a team as a code owner July 30, 2026 14:48
@Zaimwa9
Zaimwa9 requested review from kyle-ssg and talissoncosta and removed request for a team and kyle-ssg July 30, 2026 14:48
@github-actions github-actions Bot removed the fix label Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-8166 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-8166 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-8166 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8166 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8166 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-8166 Finished ✅ Results

@github-actions github-actions Bot added the fix label Jul 30, 2026
@themis-blindfold

Copy link
Copy Markdown
Contributor

⚖️ Themis review: ✅ Ship it

Clean visual polish across the experiment results page. The refactoring of getWinningVariant into getControlChanceToWin + getBestTreatment is well-structured; the new helpers are independently testable and each has clear, single-purpose semantics. Control's inferred win probability (Bonferroni bound 1 - Σ chance_to_win) is now surfaced in both the scorecard table and the summary card, and the "control wins" summary card correctly shows the best treatment's lift negated so users see the magnitude of control's advantage rather than a blank "Baseline". CSS truncation on axis chart labels (overflow: hidden + text-overflow: ellipsis inside a flex child with constrained maxWidth) is spec-compliant since overflow: hidden resolves min-width: auto to 0 on flex items. Column width redistribution keeps the same 86% total. All CI checks pass.

Area Score
🎯 Correctness 5/5
🧪 Test coverage 4/5
📐 Code quality 5/5
🚀 Product impact 3/5
📝 Walkthrough
  • derive.ts refactorgetWinningVariant split into getControlChanceToWin (Bonferroni bound for control) and getBestTreatment (highest-chance treatment). deriveSummary now computes a negated lift when control wins, adds chanceToBestHigh, liftLabel, and renames liftVsControlliftValue.
  • Scorecard table — Control row now shows an inferred win probability instead of an em dash; column widths rebalanced (wider Variant, narrower Delta); delta track hidden below 1264px.
  • Summary scorecard — Winning variation renders a VariantName with colour swatch at 24px; "Chance to be best" turns green above 90%; lift card label dynamically switches between "Lift vs control" and "Control vs best variant".
  • Axis chart — Variant labels truncate with ellipsis via a maxWidth keyed to ciLeft%; title attribute added for hover access to full name.
  • Visual tweaksStatCard value wrapper changed from div.fs-3 to h4; VariantName accepts fontSize prop; delta and win-probability tracks use --color-surface-emphasis for dark-mode clarity; swatch vertical alignment uses precise calc() offsets.
🧪 How to verify
  1. Load an experiment where a treatment wins — confirm the summary card shows the treatment name with colour swatch, positive lift, and the lift label reads "Lift vs control".
  2. Load an experiment where control wins — confirm the summary card reads "Control vs best variant" with a positive lift percentage (the negated treatment lift), and the scorecard table's control row shows a non-zero win probability.
  3. Give a variant a very long name (30+ chars) and confirm the axis chart label truncates with an ellipsis and shows the full name on hover.
  4. Resize the viewport below 1264px and confirm the delta track bar disappears, leaving only the percentage value.
  5. Toggle dark mode and verify the delta and win-probability track backgrounds are visible against the card surface.

Product take: Solid UX polish for experiment results — the "control wins" scenario now gives users an actionable number (how much control leads by) instead of a blank baseline, and inferred control win probability fills a visible data gap. This is a meaningful clarity improvement for anyone interpreting experiment outcomes, though it doesn't unlock new capability.

🧭 Assumptions & unverified claims

No unverified assumptions or claims.

The experiment results just got a full spa day — polished, aligned, and ready for their close-up. · reviewed at da4ff38

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18987 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  38.4 seconds
commit  03ab110
info  🔄 Run: #18987 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #18987 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  32.4 seconds
commit  03ab110
info  🔄 Run: #18987 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #18987 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.6 seconds
commit  03ab110
info  🔄 Run: #18987 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #18987 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.7 seconds
commit  03ab110
info  🔄 Run: #18987 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18897 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  37.2 seconds
commit  bcf2d40
info  🔄 Run: #18897 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #18897 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  32.2 seconds
commit  bcf2d40
info  🔄 Run: #18897 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #18897 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.3 seconds
commit  bcf2d40
info  🔄 Run: #18897 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #18897 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  40.9 seconds
commit  bcf2d40
info  🔄 Run: #18897 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #18890 (attempt 2)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  44.6 seconds
commit  6a5f304
info  🔄 Run: #18890 (attempt 2)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18890 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  38.8 seconds
commit  6a5f304
info  🔄 Run: #18890 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #18890 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  32 seconds
commit  6a5f304
info  🔄 Run: #18890 (attempt 1)

❌ oss · depot-ubuntu-latest-arm-16 — run #18890 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

failed  1 failed

Details

stats  1 test across 1 suite
duration  21.8 seconds
commit  6a5f304
info  📦 Artifacts: View test results and HTML report
🔄 Run: #18890 (attempt 1)

Failed tests

firefox › tests/segment-test.pw.ts › Segment test 1 - Create, update, and manage segments with multivariate flags @oss

@coderabbitai coderabbitai 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.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6d30ae96-6c47-4e21-9eff-3dfe0d7315e6

📥 Commits

Reviewing files that changed from the base of the PR and between b372dc1 and da4ff38.

📒 Files selected for processing (10)
  • frontend/web/components/experiments/results/ExperimentDetailHeader.tsx
  • frontend/web/components/experiments/results/ExperimentRecommendation.tsx
  • frontend/web/components/experiments/results/ExperimentResultsAxisChart.tsx
  • frontend/web/components/experiments/results/ExperimentResultsScorecardTable.tsx
  • frontend/web/components/experiments/results/ExperimentSummaryScorecard.tsx
  • frontend/web/components/experiments/results/StatCard.tsx
  • frontend/web/components/experiments/results/VariantName.tsx
  • frontend/web/components/experiments/results/__tests__/derive.test.ts
  • frontend/web/components/experiments/results/derive.ts
  • frontend/web/components/experiments/results/results.scss

Comment thread frontend/web/components/experiments/results/derive.ts
Comment thread frontend/web/components/experiments/results/StatCard.tsx Outdated
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 46ac368a-d860-44f1-9fc9-c21d36d9881c

📥 Commits

Reviewing files that changed from the base of the PR and between da4ff38 and e188239.

📒 Files selected for processing (2)
  • frontend/web/components/experiments/results/__tests__/derive.test.ts
  • frontend/web/components/experiments/results/derive.ts

@github-actions github-actions Bot added fix and removed fix labels Jul 30, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/web/components/experiments/results/results.scss (1)

200-203: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Constrain the label width for ellipsis to work.

Line 200 only hides overflow; without a width or max-width, the inline-flex label retains its intrinsic width and long variant names will still not truncate. Define the available label width and add min-width: 0 if this text node is a flex item.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a799db9e-63ae-4c28-b06a-f47056cc969d

📥 Commits

Reviewing files that changed from the base of the PR and between 9008fa7 and 25e517b.

📒 Files selected for processing (3)
  • frontend/web/components/experiments/results/ExperimentSummaryScorecard.tsx
  • frontend/web/components/experiments/results/VariantName.tsx
  • frontend/web/components/experiments/results/results.scss

Comment thread frontend/web/components/experiments/results/VariantName.tsx

@talissoncosta talissoncosta left a comment

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.

Looks good, just some suggestions.

Comment thread frontend/web/components/experiments/results/VariantName.tsx Outdated
Comment thread frontend/web/components/experiments/results/VariantName.tsx Outdated
Comment thread frontend/web/components/experiments/results/StatCard.tsx Outdated
Comment thread frontend/web/components/experiments/results/derive.ts Outdated
talissoncosta
talissoncosta previously approved these changes Jul 31, 2026

@talissoncosta talissoncosta left a comment

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.

Much cleaner, comments addressed. Just the hook location nit.

Comment thread frontend/common/hooks/useFitText.ts
- Move useFitText alongside the rest of the hooks in common/hooks.
- Floor the axis row label's max-width so an interval starting near the
  axis edge ellipsises the variant name instead of collapsing it.
- Let the label text shrink below its intrinsic width so the ellipsis
  applies.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kyle-ssg

kyle-ssg commented Aug 4, 2026

Copy link
Copy Markdown
Member

@talissoncosta I've resolved these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants