Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undo re-flipping risk for inverse metrics #2356

Merged
merged 2 commits into from
Apr 8, 2024
Merged

Undo re-flipping risk for inverse metrics #2356

merged 2 commits into from
Apr 8, 2024

Conversation

lukesonnet
Copy link
Contributor

@lukesonnet lukesonnet commented Apr 8, 2024

FE bugfix for risk for inverse metrics

Both our stats engine AND our FE after some recent refactors were flipping "risk" for inverse metrics, meaning we were flipping it, and then flipping it back.

This PR undoes this by having the FE receive risk as expected for inverse metrics from the stats engine (which is the same as how it deals with ChanceToWin, which also is returned from the stats engine depending on inverse). Users will have their FE reflect the right data as soon as they get this PR in their GrowthBook.

But note that the results data in the DB depend on metric.inverse for both chance to win and risk, which means if the metric def changes you have to refresh results to get the UI to show the right data.

Rip out unused risk code

Also noticed we had some duplicated risk logic that was never used; we only used a duplication of the business logic computing relative risk depending on inverse to check if risk existed (in the old useRiskVariations method). I simplified this to just check hasRisk which was all that method was used for anyways (presumably after ripping out the old results UI).

Screenshots

Bugged before
Screenshot 2024-04-08 at 10 09 23 AM

Fixed after (no need to re-run results).
Screenshot 2024-04-08 at 10 09 53 AM

Copy link

github-actions bot commented Apr 8, 2024

Your preview environment pr-2356-bttf has been deployed.

Preview environment endpoints are available at:

Copy link
Member

@bryce-fitzsimons bryce-fitzsimons left a comment

Choose a reason for hiding this comment

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

looks reasonable based on our convo. we'll need to tackle metric state in snapshots at some point

@lukesonnet lukesonnet merged commit 43920f1 into main Apr 8, 2024
3 checks passed
@lukesonnet lukesonnet deleted the ls/risk-fix branch April 8, 2024 18:58
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.

None yet

2 participants