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: add flag metadata field #178

Merged
merged 9 commits into from
May 24, 2023

Conversation

james-milligan
Copy link
Contributor

@james-milligan james-milligan commented May 23, 2023

This PR

Related Issues

#177

Notes

If the flag metadata is not in the provider response, then the returned evaluation details will have a nil value, this can be updated to have an empty map, but IMO its a cleaner implementation to leave this value as nil (nil slices have length 0)

Follow-up Tasks

How to test

Signed-off-by: James Milligan <[email protected]>
Signed-off-by: James Milligan <[email protected]>
@james-milligan james-milligan requested a review from a team as a code owner May 23, 2023 09:37
@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Merging #178 (5752267) into main (e0f37d5) will increase coverage by 1.21%.
The diff coverage is 87.27%.

❗ Current head 5752267 differs from pull request most recent head 492f3e6. Consider uploading reports for the commit 492f3e6 to get more accurate results

@@            Coverage Diff             @@
##             main     #178      +/-   ##
==========================================
+ Coverage   71.25%   72.47%   +1.21%     
==========================================
  Files           8        8              
  Lines         668      723      +55     
==========================================
+ Hits          476      524      +48     
- Misses        174      180       +6     
- Partials       18       19       +1     
Impacted Files Coverage Δ
pkg/openfeature/client.go 73.24% <86.00%> (+1.38%) ⬆️
pkg/openfeature/provider.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Signed-off-by: James Milligan <[email protected]>
Signed-off-by: James Milligan <[email protected]>
Signed-off-by: James Milligan <[email protected]>
Signed-off-by: James Milligan <[email protected]>
@james-milligan james-milligan changed the title flag metadata feat!: flag metadata May 23, 2023
@toddbaert
Copy link
Member

This all makes sense to me.

I'm particularly interested in other's opinions on this:

If the flag metadata is not in the provider response, then the returned evaluation details will have a nil value, this can be updated to have an empty map, but IMO its a cleaner implementation to leave this value as nil (nil slices have length 0)

I'll defer to those with more familiarity with go semantics.

@Kavindu-Dodan
Copy link
Contributor

This all makes sense to me.

I'm particularly interested in other's opinions on this:

If the flag metadata is not in the provider response, then the returned evaluation details will have a nil value, this can be updated to have an empty map, but IMO its a cleaner implementation to leave this value as nil (nil slices have length 0)

I'll defer to those with more familiarity with go semantics.

From pure spec point of view [1]

If the flag metadata field in the flag resolution structure returned by the configured provider is set, the evaluation details structure's flag metadata field MUST contain that value. Otherwise, it MUST contain an empty record.

IMO, to be spec compliant, we should have an empty record here 🤔

[1] - https://openfeature.dev/specification/sections/flag-evaluation/#requirement-1413

@beeme1mr
Copy link
Member

How do we want to handle releasing a breaking change? If we're going to release this as a minor version, we need to make sure Release Please is configured properly and that the changes are clearly documented.

@toddbaert
Copy link
Member

toddbaert commented May 24, 2023

How do we want to handle releasing a breaking change? If we're going to release this as a minor version, we need to make sure Release Please is configured properly and that the changes are clearly documented.

I didn't notice the ! in the title. Is this actually breaking? I assumed from:

If the flag metadata is not in the provider response

That this was non-breaking? @james-milligan - can you clarify?

We can officially, break the provider contract and not consider it a major change because providers are still in hardening, but I'd like to exhaust all possible options before doing this. Alternatively, releasing a v2 would be painful, I think, based on previous experiments.

@james-milligan james-milligan changed the title feat!: flag metadata feat: flag metadata May 24, 2023
@james-milligan
Copy link
Contributor Author

yes this is non breaking, apologies should have caught this sooner!

james-milligan and others added 3 commits May 24, 2023 09:42
Signed-off-by: James Milligan <[email protected]>
Co-authored-by: Kavindu Dodanduwa <[email protected]>
Signed-off-by: James Milligan <[email protected]>
Signed-off-by: James Milligan <[email protected]>
@toddbaert toddbaert self-requested a review May 24, 2023 14:50
@toddbaert toddbaert changed the title feat: flag metadata feat: add flag metadata field May 24, 2023
@toddbaert
Copy link
Member

I've updated the title so it reads a bit better in release notes. Approved!

@beeme1mr beeme1mr self-requested a review May 24, 2023 18:43
@beeme1mr beeme1mr merged commit e3b299d into open-feature:main May 24, 2023
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.

5 participants