Repository navigation
Conversation
…lity, docs say 95% / 5% Call a winner only when a variant's chance to beat control is over 95%, or control when every variant is under 5%, as the experimentation docs describe. In between, the results page shows a neutral "Not enough evidence yet" banner, the scorecard shows "No winner yet", and the complete-experiment dialog keeps control pre-selected. Closes Flagsmith#9133
|
@NadyKor15 is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
1 issue found across 6 files
Confidence score: 4/5
- In
ExperimentRecommendation.tsx, an exact 95% result is inconclusive, but the copy says the probability is below 95%. Say it has not exceeded the 95% threshold so the boundary case is accurate.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/web/components/experiments/results/ExperimentRecommendation.tsx">
<violation number="1" location="frontend/web/components/experiments/results/ExperimentRecommendation.tsx:55">
P2: An exact 95% result is inconclusive, but this copy says its probability is below 95%. Say it has not exceeded the 95% threshold so the boundary case is described accurately.</violation>
</file>
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Re-trigger cubic
| below the {formatChancePct(WINNING_CHANCE_THRESHOLD)} needed to | ||
| call a winner. |
There was a problem hiding this comment.
P2: An exact 95% result is inconclusive, but this copy says its probability is below 95%. Say it has not exceeded the 95% threshold so the boundary case is described accurately.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At frontend/web/components/experiments/results/ExperimentRecommendation.tsx, line 55:
<comment>An exact 95% result is inconclusive, but this copy says its probability is below 95%. Say it has not exceeded the 95% threshold so the boundary case is described accurately.</comment>
<file context>
@@ -21,6 +27,45 @@ const ExperimentRecommendation: FC<ExperimentRecommendationProps> = ({
+ leads with a lift of {summary.liftValue} over{' '}
+ <VariantName name='Control' colour={summary.controlColour} /> and{' '}
+ {summary.chanceToBest} probability of being the best variant,
+ below the {formatChancePct(WINNING_CHANCE_THRESHOLD)} needed to
+ call a winner.
+ </>
</file context>
| below the {formatChancePct(WINNING_CHANCE_THRESHOLD)} needed to | |
| call a winner. | |
| which has not exceeded the {formatChancePct(WINNING_CHANCE_THRESHOLD)} | |
| threshold needed to call a winner. |
There was a problem hiding this comment.
Fixed in 164df6b. The no-winner banner now reads "Variant_1 has a 64% chance of beating Control, with a lift of +20.3%. A winner needs a chance over 95%.", which stays true at exactly 95%. A chance that rounds to 95% but is above it now shows as "> 95%", so a declared winner never reads as a plain "95%".
…e chances as beating control Control now wins when every variant is under 5%, checked against each variant's own chance, so it also holds with many variants. The banner, summary cards, results table and complete-experiment dialog all use the same conclusive winner. The banners describe a variant's number as its chance of beating control. With several variants the control figure is a lower bound and shows as "≥ N%". Chances that round to 95% or 5% but sit on the deciding side show as "> 95%" or "< 5%". Without a winner the summary card reads "Leading variation", and the banner wording follows the experiment status.
There was a problem hiding this comment.
1 issue found across 7 files (changes from recent commits).
Confidence score: 4/5
- In
frontend/web/components/experiments/results/derive.ts, green styling no longer follows the existing >90% probability cutoff: a 92% inconclusive lead can lose green, while a conclusive control with a displayed lower bound of at least 2% can gain it. Keep the established cutoff if this styling change wasn’t intentional.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/web/components/experiments/results/derive.ts">
<violation number="1" location="frontend/web/components/experiments/results/derive.ts:386">
P2: This ties green styling to whether a winner is conclusive instead of the existing >90% probability cutoff: a 92% inconclusive lead loses green, while a conclusive control with a displayed lower bound of ≥2% turns green. Keep this flag based on `winner.chanceToWin > 0.9` to preserve the existing probability-based styling.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| chanceToBest: winner.isControl | ||
| ? formatControlChancePct(winner.chanceToWin, identities.length - 1) | ||
| : formatChancePct(winner.chanceToWin), | ||
| chanceToBestHigh: !!conclusiveWinner, |
There was a problem hiding this comment.
P2: This ties green styling to whether a winner is conclusive instead of the existing >90% probability cutoff: a 92% inconclusive lead loses green, while a conclusive control with a displayed lower bound of ≥2% turns green. Keep this flag based on winner.chanceToWin > 0.9 to preserve the existing probability-based styling.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At frontend/web/components/experiments/results/derive.ts, line 386:
<comment>This ties green styling to whether a winner is conclusive instead of the existing >90% probability cutoff: a 92% inconclusive lead loses green, while a conclusive control with a displayed lower bound of ≥2% turns green. Keep this flag based on `winner.chanceToWin > 0.9` to preserve the existing probability-based styling.</comment>
<file context>
@@ -340,8 +380,10 @@ export const deriveSummary = (
+ chanceToBest: winner.isControl
+ ? formatControlChancePct(winner.chanceToWin, identities.length - 1)
+ : formatChancePct(winner.chanceToWin),
+ chanceToBestHigh: !!conclusiveWinner,
controlColour: controlIdentity?.colour ?? '',
controlWins: winner.isControl,
</file context>
| chanceToBestHigh: !!conclusiveWinner, | |
| chanceToBestHigh: winner.chanceToWin > 0.9, |
There was a problem hiding this comment.
This one is intentional. With this PR, green on the summary card and on the results table means the result is conclusive. Keeping the 90% cut-off would show a green 92% next to a banner that says there is no winner yet, which is the mixed signal #9133 is about. For a control win with many variants the figure reads "≥ 2%" because it is only a lower bound; the win itself comes from every variant being under 5%. Happy to go back to the 90% cut-off if you prefer it.
|
I ran an A/A simulation on This PR only makes the banner follow the documented 95%/5% rule. It does not address peeking: with the PR, stopping at the first named winner across the 30 looks still gives 45.8%, which is the problem raised in #9135. Stricter thresholds would lower both rates but need more data per experiment; that choice is up to the maintainers and outside this PR. Code, parameters and expected outputs are at https://github.com/NadyKor15/flagsmith-experiment-banner-evidence/tree/main/aa-simulation, and |
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature. (Not needed: the docs already describe this rule.)Changes
Closes #9133
The results page names a winner and suggests a rollout at any probability. The docs only call a result above 95% (winning) or below 5% (losing): "Over 95% → winning; under 5% → losing; in between → inconclusive." (Statistics), and "When a variation reaches a 95% chance of beating control, a recommendation banner suggests rolling it out." (Analyse an experiment). This PR applies that rule wherever the page names a winner. The statistics and the backend are unchanged.
1 - Σbound for control can be small.chance_to_winis. With several variants the control figure is the1 - Σlower bound, so the card and the table now show it as "≥ N%". Chances that round to 95% or 5% but sit on the deciding side show as "> 95%" or "< 5%".The thresholds are two constants in
derive.ts, and the new no-winner state uses the DSBanner. Exactly 95% and exactly 5% count as inconclusive, following "over 95%" and "under 5%" on the statistics page. The analyse page says "reaches a 95% chance", so if you would rather include the boundaries, it means switching>and<to>=and<=.I left the "Chance to be best" card label as it is, although for a variant it shows the chance of beating control. Happy to rename it here or in a follow-up.
Review effort: 2/5
How did you test this code?
Unit tests:
npx jest web/components/experimentspasses 191 tests in 9 suites (145 on main before this change).results/__tests__/derive.test.ts:getConclusiveWinnerat 98%, just over 95%, exactly 95%, 64%, two variants tied at 60% and at 97%, control ahead at 62%, variants either side of 5%, exactly 5%, every variant under or just under 5%, one variant, missing inference, and 20 variants at 4.9% (control wins) or 5% (no winner).deriveSummarycoversisConclusive, the "Chance to be best" text and its highlight, including one, two, three, 20 and 21 variants.formatChancePctandformatControlChancePctcover the 95%/5% hedges and the lower bound.getNoWinnerCopycovers running, paused and completed.CompleteExperimentModal/__tests__/utils.test.ts: the old "leading treatment" case at 0.7 now expects control to be pre-selected, and the old "control leads" case (both variants at 5%) now uses 3% and 2%, since exactly 5% is inconclusive. New cases cover 98%, exactly 95%, every variant under 5%, a variant at exactly 5%, and 20 variants under 5%.npx eslinton the changed files reports no errors.npm run typecheckreports the same errors per file as on main, none of them in the experiments folder.Screenshots come from a local Storybook story (not part of this PR) that renders
ExperimentRecommendationandExperimentSummaryScorecardwith mocked results for one variant. The probabilities match the three cases in #9133, which also has screenshots of the current behaviour on Flagsmith Cloud.