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

Add PERSISTED_FEATURE_FLAGS env #5273

Merged
merged 7 commits into from
Jul 22, 2021
Merged

Add PERSISTED_FEATURE_FLAGS env #5273

merged 7 commits into from
Jul 22, 2021

Conversation

mariusandra
Copy link
Collaborator

@mariusandra mariusandra commented Jul 21, 2021

Changes

  • This adds an env, PERSIST_FEATURE_FLAGS that overrides feature flags in the frontend, at least the ones in the featureFlagLogic.
  • We can hardcode a value into this env inside settings.py to burn some flags into a release.
  • Running with the env PERSIST_FEATURE_FLAGS=4267-taxonomic-property-filter,4535-funnel-bar-viz and not having those flags in the system, I had the new filter and the new funnels working.
  • All other flags (those not in the env/setting, but still coming in with /decide) are passed through as they are.

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests
  • Migrations are safe to run at scale (e.g. PostHog Cloud) – present proof if not obvious
  • New/changed UI is decent on smartphones (viewport width around 360px)

@mariusandra mariusandra requested review from timgl and paolodamico July 21, 2021 23:57
@timgl timgl temporarily deployed to posthog-pr-5273 July 21, 2021 23:59 Inactive
@macobo
Copy link
Contributor

macobo commented Jul 22, 2021

Q: What is this solving?

@mariusandra
Copy link
Collaborator Author

mariusandra commented Jul 22, 2021

We want to enable code that's behind flags 4267-taxonomic-property-filter and 4535-funnel-bar-viz in the next release. We can either make a PR to remove the flags altogether, or hardcode them in, so we could eventually remove them on app and not worry about breaking old deployments running 1.27.

So "what is this solving"? Literally the issue you opened with the fix you suggested 😁

The idea is that in a release branch before pushing it out, we edit the hardcoded list in settings.py.

@mariusandra
Copy link
Collaborator Author

Two questions I'd have here:

  1. Do we want to force-enable only certain flags like we do now in this PR... and leave everything else dynamic (via /decide).... or do we want to completely ignore whatever /decide returns.
  2. Naming things. PERSIST?

@timgl
Copy link
Collaborator

timgl commented Jul 22, 2021

I think this is a decent solution. I wonder if it would be cleaner to before a release just remove all feature flags instead but I don't feel strongly about it.

Do you want to add 4267-taxonomic-property-filter,4535-funnel-bar-viz to this PR?

@mariusandra mariusandra temporarily deployed to posthog-pr-5273 July 22, 2021 11:32 Inactive
@mariusandra mariusandra temporarily deployed to posthog-pr-5273 July 22, 2021 11:37 Inactive
@mariusandra
Copy link
Collaborator Author

Actually, yes, let's just really release it. Updates:

  • I added 4267-taxonomic-property-filter, 4535-funnel-bar-viz and save-cohort-on-modal (new one that I found, wasn't in a constant, fixed in Fix persons modal load more people #5271) to settings.
  • If this is merged, then these will now be released on cloud as well to everyone.
  • I also found a bunch of non-constant feature flags and moved them to constants.tsx. Except for save-cohort-on-modal which will be added in that PR.

Copy link
Contributor

@paolodamico paolodamico left a comment

Choose a reason for hiding this comment

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

Some comments/suggestions, but lgtm!

frontend/src/types.ts Outdated Show resolved Hide resolved
posthog/settings.py Outdated Show resolved Hide resolved
frontend/src/lib/logic/featureFlagLogic.ts Show resolved Hide resolved
@mariusandra mariusandra temporarily deployed to posthog-pr-5273 July 22, 2021 11:56 Inactive
@mariusandra
Copy link
Collaborator Author

Of course now that the flags are force-enabled, all cypress tests fail because we never developed test with the flags on. Probably the taxonomic filter is causing issues here 😅.

@mariusandra mariusandra changed the title Add PERSIST_FEATURE_FLAGS env Add PERSISTEd_FEATURE_FLAGS env && release funnels and filter flags Jul 22, 2021
@mariusandra mariusandra changed the title Add PERSISTEd_FEATURE_FLAGS env && release funnels and filter flags Add PERSISTED_FEATURE_FLAGS env && release funnels and taxonomic filter feature flags Jul 22, 2021
@mariusandra mariusandra changed the title Add PERSISTED_FEATURE_FLAGS env && release funnels and taxonomic filter feature flags Add PERSISTED_FEATURE_FLAGS env Jul 22, 2021
@mariusandra mariusandra temporarily deployed to posthog-pr-5273 July 22, 2021 12:48 Inactive
@mariusandra
Copy link
Collaborator Author

mariusandra commented Jul 22, 2021

On second thought, I will remove the released features themselves from this PR. Releasing them will require bigger changes to the tests and I fear this PR will get way too messy then.

Any objections to merging it in as is? I have 1 approval from @paolodamico , so merging when tests pass. I'll create separate a new PR for the actual flags.

Edit: here it is #5282

@mariusandra mariusandra enabled auto-merge (squash) July 22, 2021 12:50
@mariusandra mariusandra merged commit 9d5dd47 into master Jul 22, 2021
@mariusandra mariusandra deleted the persist-flags branch July 22, 2021 13:12
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.

4 participants