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

feat: update org feature flags backend #10446

Merged
merged 24 commits into from
Nov 20, 2024

Conversation

nickoferrall
Copy link
Contributor

@nickoferrall nickoferrall commented Nov 1, 2024

This PR shows all of the org feature flags in the organization settings. Org admins can view the feature flags and toggle them, updating the backend.

This PR includes migrating noAISummary feature flag to useAI on the Organization object. It does not include toggling the useAI boolean in the db. I'll add that in a subsequent PR.

Screenshot 2024-11-06 at 15 10 08

To test

  • Go to the Organization settings of an org where you're the org admin
  • Toggle the feature flags

Copy link
Contributor

github-actions bot commented Nov 4, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

github-actions bot commented Nov 5, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

github-actions bot commented Nov 5, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

@nickoferrall nickoferrall changed the base branch from master to feat/add-use-ai November 5, 2024 16:01
Copy link
Contributor

github-actions bot commented Nov 5, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

github-actions bot commented Nov 5, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

github-actions bot commented Nov 5, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

github-actions bot commented Nov 6, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

@nickoferrall nickoferrall marked this pull request as ready for review November 6, 2024 14:56
@nickoferrall nickoferrall mentioned this pull request Nov 6, 2024
1 task
@nickoferrall nickoferrall changed the base branch from feat/add-use-ai to feat/feature-flags-ui November 6, 2024 14:58
Copy link
Contributor

github-actions bot commented Nov 6, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

github-actions bot commented Nov 6, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

github-actions bot commented Nov 6, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

github-actions bot commented Nov 6, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

)
.execute()

await db.deleteFrom('FeatureFlag').where('featureName', '=', 'noAISummary').execute()
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 shouldn't this also delete cascade the 'FeatureFlagOwner' entries above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True! It does delete cascade so I can remove that FeatureFlagOwner deletion

@nickoferrall
Copy link
Contributor Author

Hey @mattkrick, bumping this review request 🙏

packages/server/dataloader/customLoaderMakers.ts Outdated Show resolved Hide resolved
packages/server/postgres/types/pg.d.ts Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

why is this here?

@@ -18,4 +23,9 @@ type FeatureFlag {
The scope of the feature flag
"""
scope: FeatureFlagScope!

"""
Whether the flag is enabled for an owner or not
Copy link
Member

Choose a reason for hiding this comment

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

-1 enabled is a property of FeatureFlagOwner, so a type like UpdateFeatureFlagSuccess that returns a FeatureFlag won't have enabled as a field. This is technically OK since enabled is optional, but it's not very expressive because we're basically using the same FeatureFlag type for 2 different types of objects (a FeatureFlag, and a FeatureFlagWithOwner). i would keep enabled off this object or make a second object like OwnedFeatureFlag to express that they're different

Copy link
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size.

Copy link
Member

Choose a reason for hiding this comment

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

this shouldn't be in version control, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed!

"""
The feature flag that was toggled
"""
featureFlag: OwnedFeatureFlag!
Copy link
Member

Choose a reason for hiding this comment

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

curious, why create a new type vs. having {enabled, featureFlag}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we need it here.

In ToggleFeatureFlagSuccess, we could do what you're suggesting, but in Organization, I think we do have to return a new type? I went with your suggestion here.

Copy link
Member

Choose a reason for hiding this comment

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

ah! that makes sense. LGTM

@nickoferrall nickoferrall merged commit 3b44d51 into feat/feature-flags-ui Nov 20, 2024
7 checks passed
@nickoferrall nickoferrall deleted the feat/org-feature-flags-dynamic branch November 20, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants