-
Notifications
You must be signed in to change notification settings - Fork 10
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
IS-577: Move site privatisation to growth book #1529
IS-577: Move site privatisation to growth book #1529
Conversation
src/types/featureFlags.ts
Outdated
// Example usage: const gb = useGrowthBook<FeatureFlags>(); | ||
export interface FeatureFlags { | ||
[FEATURE_FLAGS.STYLING_REVAMP]: boolean | ||
[FEATURE_FLAGS.REPO_PRIVATISATION]: PrivatisationWhitelist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm why are we not using a boolean value like styling revamp? This way we are exposing info to the client on which sites use this feature, which seems something that we can avoid by switching to boolean type instead, would this be feasible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to gate the rollout slowly. See Slack convo for more info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's what you meant! I wanted to be explicit, but actually you have a very good point. We can off-load the conditional part to growthbook and client side doesn't need to know about the whitelist at all! Let me try this approach 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/layouts/Settings/Settings.tsx
Outdated
growthbook?.getFeatureValue( | ||
FEATURE_FLAGS.REPO_PRIVATISATION, | ||
fallbackWhitelist | ||
) || fallbackWhitelist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm abit a bit confused here, why would growthbook be undefined ah?
- how do we reason about
fallbackWhiteList
? if this list does not contain anything, should this still live in production line ya?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return of useGrowthbook is this:
useGrowthBook<FeatureFlags>(): GrowthBook<FeatureFlags> | undefined
It can be undefined because under the hood it uses a react context and growthbook if not yet initialised will return undefined
The fallbackWhitelist helps in 2 scenarios:
- If the useGrowthbook call returns undefined
- If growthbook is initialised but the fetching from growthbook fails
Hence, it should be there for defensiveness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So moving forward we are going to maintain 2 sot arh? more in favour of just || [], and we expect growthbook to work most of the time, but if it doesnt we have a sane value to prevent app from crashing rather than maintaining 2 sot!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, how did you get 2 sot? There is still 1 sot on growthbook. The fallback value here is already the mechanism for preventing the app from crashing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm w nit
Co-authored-by: Kishore <[email protected]>
Problem
Site privatisation is feature-flagged via env var now with just a boolean. We want to move this to growthbook and to allow site-level whitelist.
Closes IS-577
Solution
Moved to growthbook with new feature flag and json response of all the whitelisted sites for repo privatisation feature.
Breaking Changes
Tests
npm run tests
)!run e2e
)dev
stage only or if on staging, forstaging
onlyDeploy Notes
Removed environment variables:
REACT_APP_IS_SITE_PRIVATISATION_ACTIVE
: removed in favour of new feature flag on GB