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: Pick from list of real variations #420

Merged

Conversation

mike-zorn
Copy link
Contributor

@mike-zorn mike-zorn commented Sep 6, 2024

This adds better UX for multivariate flags. Previously, you just had the ability to edit the raw json values. Now you can pick from the available variations already defined in the LD service or you can create your own "local override". This is implemented by fetching all flags from the flag list API and writing the variations to the sqlite db. The data written to SQLite is then used to serve subsequent requests. I took this approach because it means that the pulled flag state should be in-sync with the available variations and it enables offline work. It does mean that add project & sync project operations take significantly longer in projects with large amounts of flags.

Some other changes are along for the ride because this branch was longer lived than ideal.

  • search bar for flags
  • display source environment
  • dark mode
  • fix patch endpoint so that the side-effect resync causes the observers to fire

mike-zorn and others added 28 commits August 29, 2024 15:29
It will proxy the request to real launchdarkly, applying the access
token.
It was a bad idea. No auth + prod credz = security nightmares
* Do a whole lot of stuff

* PR feedback
The fetchFlagState is only called from within the Project, so the tests
were extraneous: tests of other public methods already covered the function.
Equivalent to UpdateProject wo/items. This fixed an issue where we
didn't do the same thing when updating vs. syncing
Wanted better cohesion between state declarations and the data fetching.
@@ -70,7 +72,16 @@ func (s Sqlite) UpdateProject(ctx context.Context, project model.Project) (bool,
return false, errors.Wrap(err, "unable to marshal flags state when updating project")
}

result, err := s.database.ExecContext(ctx, `
tx, err := s.database.BeginTx(ctx, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

sqllite has transactions???

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. SQLite is kinda incredible. It's one of the best tested and widely used pieces of software you'll find.

@mike-zorn mike-zorn merged commit 91e8cbf into main Sep 6, 2024
9 checks passed
@mike-zorn mike-zorn deleted the mikezorn/sc-254693/validate-overrides-against-what-s-in-the branch September 6, 2024 16:55
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.

2 participants