Skip to content

feat(experiments): colour lift by metric direction - #8099

Merged
Zaimwa9 merged 3 commits into
mainfrom
feat/experiment-lift-colour-metric-direction
Jul 27, 2026
Merged

feat(experiments): colour lift by metric direction#8099
Zaimwa9 merged 3 commits into
mainfrom
feat/experiment-lift-colour-metric-direction

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Jul 24, 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

Depends on #8098.

Colours experiment lift values by the primary metric's direction instead of sign only (follow-up to #8091):

  • Green when the lift moves with the metric ("higher is better" + positive, "lower is better" + negative), red when against, neutral grey for informational metrics.
  • Applies to the analysis chart, the delta bar/value in the results table, and the "Lift vs control" scorecard (now driven by a liftTone of success/danger/neutral).
  • Until feat(experiments): expose metric direction on experiment metrics API #8098 is deployed, direction is absent from the API response and metrics fall back to "higher is better" — identical to current behaviour.

How did you test this code?

Parametrised unit tests for direction → tone mapping in derive.test.ts; manually checked chart/table/scorecard colours for up and down metrics.

@Zaimwa9
Zaimwa9 requested a review from a team as a code owner July 24, 2026 13:49
@Zaimwa9
Zaimwa9 requested review from talissoncosta and removed request for a team July 24, 2026 13:49
@vercel

vercel Bot commented Jul 24, 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 Ready Ready Preview, Comment Jul 27, 2026 2:18pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jul 27, 2026 2:18pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jul 27, 2026 2:18pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ba4e5ed4-f1ef-4004-a4bf-fbc829a077e1

📥 Commits

Reviewing files that changed from the base of the PR and between 20db5e0 and 2b2c5b3.

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

📝 Walkthrough

Walkthrough

Experiment metric responses now include direction. Lift favourability, colours, and summary statistics use direction-aware logic, including neutral handling for informational metrics. Axis charts and scorecard tables pass metric direction into lift rendering, while the summary scorecard maps derived tones to text classes. Tests cover upward, downward, and informational direction outcomes.

Estimated code review effort: 3 (Moderate) | ~20 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.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 672c9bc6-7802-49be-af67-0f1b14658fea

📥 Commits

Reviewing files that changed from the base of the PR and between 80e50a2 and 36d16e6.

📒 Files selected for processing (7)
  • frontend/common/types/responses.ts
  • frontend/web/components/experiments/results/ExperimentMetricScorecard.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/__tests__/derive.test.ts
  • frontend/web/components/experiments/results/derive.ts

Comment thread frontend/common/types/responses.ts Outdated
Comment thread frontend/web/components/experiments/results/__tests__/derive.test.ts Outdated
@github-actions

github-actions Bot commented Jul 24, 2026

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

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  36.5 seconds
commit  2b2c5b3
info  🔄 Run: #18742 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  36.1 seconds
commit  2b2c5b3
info  🔄 Run: #18742 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  41.9 seconds
commit  2b2c5b3
info  🔄 Run: #18742 (attempt 1)

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

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  12.2 seconds
commit  20db5e0
info  🔄 Run: #18712 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  35 seconds
commit  20db5e0
info  🔄 Run: #18712 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  43.9 seconds
commit  20db5e0
info  🔄 Run: #18712 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  42.2 seconds
commit  20db5e0
info  🔄 Run: #18712 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 7 seconds
commit  36d16e6
info  🔄 Run: #18709 (attempt 1)

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

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  48.6 seconds
commit  36d16e6
info  🔄 Run: #18709 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.2 seconds
commit  36d16e6
info  🔄 Run: #18709 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  38.1 seconds
commit  36d16e6
info  🔄 Run: #18709 (attempt 1)

@github-actions

github-actions Bot commented Jul 24, 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: 2086e0cc-6225-41ee-b6e4-ada54e22c2c9

📥 Commits

Reviewing files that changed from the base of the PR and between 36d16e6 and 20db5e0.

📒 Files selected for processing (5)
  • frontend/common/types/responses.ts
  • frontend/web/components/experiments/results/ExperimentMetricScorecard.tsx
  • frontend/web/components/experiments/results/ExperimentResultsScorecardTable.tsx
  • frontend/web/components/experiments/results/__tests__/derive.test.ts
  • frontend/web/components/experiments/results/derive.ts

Comment thread frontend/web/components/experiments/results/__tests__/derive.test.ts Outdated

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

just one minor comment. Do you mind checking it before move forward?

Comment thread frontend/web/components/experiments/results/ExperimentSummaryScorecard.tsx Outdated
@Zaimwa9
Zaimwa9 merged commit 0668c09 into main Jul 27, 2026
29 checks passed
@Zaimwa9
Zaimwa9 deleted the feat/experiment-lift-colour-metric-direction branch July 27, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants