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

Flag variant attachment #685

Merged
merged 13 commits into from
Feb 10, 2022

Conversation

kevin-ip
Copy link
Contributor

@kevin-ip kevin-ip commented Feb 4, 2022

Extending variant to support attachment

  • Extend flipt.proto to support attachment in variant
  • Extend DB with the new column
  • Extend UI to support the new field

closes #188

kevin-ip and others added 2 commits February 3, 2022 18:07
* Extend flipt.proto to support attachment in variant
* Extend DB with the new column
* Extend UI to support the new field

Co-authored-by: Kevin Ip <kevin.ip@paradigm.co>
@kevin-ip kevin-ip force-pushed the flag-variant-attachment branch from 85e878b to c04ceb4 Compare February 4, 2022 00:07
* add json format and limit valiation for attachment
* update DB migration scripts
* add attachment column to variant table
@kevin-ip kevin-ip marked this pull request as ready for review February 5, 2022 05:14
Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

Looking good so far!

However, I think it's missing the attachment field in the EvaluationResponse to be useful.

I think you'll need to add the attachment column in this SQL statement and also add VariantAttachment and set the value to the attachment of the variant that matches during evaluation

See these screenshots where there is no attachment that comes back for the variant when there should be:

Screen Shot 2022-02-05 at 11 29 57 AM

Screen Shot 2022-02-05 at 11 29 22 AM

ui/src/components/Flags/Flag.vue Outdated Show resolved Hide resolved
ui/src/components/Flags/Flag.vue Outdated Show resolved Hide resolved
Co-authored-by: Mark Phelps <markphelps@github.com>
@kevin-ip
Copy link
Contributor Author

kevin-ip commented Feb 8, 2022

However, I think it's missing the attachment field in the EvaluationResponse to be useful.

Thanks for the promptly review. I've updated it. Please let me know if I missed anything. Thanks

Screen Shot 2022-02-07 at 11 01 00 PM

Screen Shot 2022-02-07 at 10 59 43 PM

@kevin-ip kevin-ip requested a review from markphelps February 8, 2022 04:05
@markphelps
Copy link
Collaborator

Looks awesome @kevin-ip ! Thanks for this. I'll check it out more thoroughly tonight and likely merge it and cut a release this week

@markphelps
Copy link
Collaborator

this test failure also brings up a good question, should we strip whitespace from the JSON on the server side? or UI side or both?

@kevin-ip
Copy link
Contributor Author

kevin-ip commented Feb 8, 2022

this test failure also brings up a good question, should we strip whitespace from the JSON on the server side? or UI side or both?

I like it on the server side as we don't have to do it twice (server + UI). WDYT?

@kevin-ip
Copy link
Contributor Author

kevin-ip commented Feb 8, 2022

@markphelps Just took a look and it seems the DB perform some beautification on the json.
Trying to pass an attachment with extra spaces after colon:

Screen Shot 2022-02-08 at 10 50 23 AM

Think we couple options:

  1. perform compaction when reading the attachment from the DB
  2. Don't do anything and let the DB decides.

I like option 1 for the app will have consist result across different DBs.

@markphelps
Copy link
Collaborator

@kevin-ip yeah I agree that option 1 is the cleanest approach

@jalaziz
Copy link
Contributor

jalaziz commented Feb 9, 2022

If we're comfortable saying the attachment must always be JSON, then it might be nice to have the attachment imported from / exported as YAML. It would make for more human readable/editable exports.

@markphelps
Copy link
Collaborator

If we're comfortable saying the attachment must always be JSON, then it might be nice to have the attachment imported from / exported as YAML. It would make for more human readable/editable exports.

@jalaziz good idea. I'll add this as a follow up PR before creating a release, I don't want to block the merging of this PR any longer than necessary

@kevin-ip kevin-ip requested a review from markphelps February 10, 2022 04:13
@markphelps
Copy link
Collaborator

@allcontributors please add @kevin-ip for code

@allcontributors
Copy link
Contributor

@markphelps

I've put up a pull request to add @kevin-ip! 🎉

@markphelps
Copy link
Collaborator

@allcontributors please add @amayvs for code

@allcontributors
Copy link
Contributor

@markphelps

@amayvs already contributed before to code

@markphelps
Copy link
Collaborator

This is an amazing addition @kevin-ip @amayvs ! Thank you so much for contributing. I'll create a release before the weekend. Also thank you @jalaziz for helping review

@markphelps markphelps merged commit 95674dd into flipt-io:master Feb 10, 2022
@kevin-ip kevin-ip deleted the flag-variant-attachment branch February 10, 2022 15:39
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.

Add json attribute to variants
4 participants