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: Flag metadata #223

Merged
merged 34 commits into from
Feb 12, 2024
Merged

feat: Flag metadata #223

merged 34 commits into from
Feb 12, 2024

Conversation

askpt
Copy link
Member

@askpt askpt commented Jan 30, 2024

Flag Metadata

  • Adds support for flag metadata

Related Issues

Fixes #192

Notes

  • Currently, an invalid flag evaluation (cast) will throw an exception. I was thinking of returning null and logging it as a warning. For that effort, I need a log source (chore: Use logging source generators #189).

Follow-up Tasks

@askpt askpt linked an issue Jan 30, 2024 that may be closed by this pull request
askpt and others added 21 commits January 30, 2024 16:38
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
…etadata property

Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: Austin Drenski <austin@austindrenski.io>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: Austin Drenski <austin@austindrenski.io>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
The linter on the docs page complains that this should be a header instead of an emphasis. This PR changes the key to use a blockquote, which works better anyway.

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: Austin Drenski <austin@austindrenski.io>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
See: #202

Signed-off-by: Austin Drenski <austin@austindrenski.io>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: Austin Drenski <austin@austindrenski.io>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: Austin Drenski <austin@austindrenski.io>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
This commit refactors the FlagMetadata class in the OpenFeature.Model namespace to use ImmutableDictionary instead of Dictionary for the _metadata field. This change ensures that the metadata dictionary is immutable, providing better thread safety and preventing unintended modifications. The GetString method is also moved to the bottom of the class for better organization.

Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
@askpt askpt force-pushed the askpt/192-feature-implement-flag-metadata branch from b245d9b to 9813d3c Compare January 30, 2024 16:38
Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d792b32) 94.28% compared to head (03db18a) 94.47%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #223      +/-   ##
==========================================
+ Coverage   94.28%   94.47%   +0.19%     
==========================================
  Files          25       27       +2     
  Lines        1067     1104      +37     
  Branches      115      119       +4     
==========================================
+ Hits         1006     1043      +37     
  Misses         37       37              
  Partials       24       24              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@askpt askpt changed the title Implement flag metadata Feat: Flag metadata Jan 30, 2024
@askpt askpt changed the title Feat: Flag metadata feat: Flag metadata Jan 30, 2024
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
@toddbaert
Copy link
Member

toddbaert commented Jan 31, 2024

@askpt FlagMetadata and EventMetadata are shaped the same in the SDK:

https://openfeature.dev/specification/types#event-metadata
https://openfeature.dev/specification/types#flag-metadata

I think for consistency, that means we should use the same type for these, which I guess would mean it should be a Dictionary<string, object>(), unless there's some way we can bring them in line with your new implementation in a non-breaking way... maybe with extension methods?

Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
@askpt
Copy link
Member Author

askpt commented Feb 2, 2024

@askpt FlagMetadata and EventMetadata are shaped the same in the SDK:

https://openfeature.dev/specification/types#event-metadata https://openfeature.dev/specification/types#flag-metadata

I think for consistency, that means we should use the same type for these, which I guess would mean it should be a Dictionary<string, object>(), unless there's some way we can bring them in line with your new implementation in a non-breaking way... maybe with extension methods?

@toddbaert I added a TODO to change the dictionary to use the BaseMetadata type. This would be a breaking change. See 5a2dcc9

Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
@toddbaert
Copy link
Member

I think the e2e tests are failing because of the change in the resolvers to include a new optional metadata param - I think the change in the signature is somehow causing an issue due to the circular dependency on flagd.

We've had an issue to remove this cycle for a while, as we have in other SDKs by adding the in-memory provider (which the spec requires anyway).

@toddbaert
Copy link
Member

@askpt merged the recent changes to remove the flagd dep and now e2e looks good!

Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com>
@askpt askpt force-pushed the askpt/192-feature-implement-flag-metadata branch from a718ba5 to 2761bff Compare February 12, 2024 08:13
@askpt askpt mentioned this pull request Feb 12, 2024
@askpt askpt marked this pull request as ready for review February 12, 2024 17:00
@askpt askpt requested a review from a team as a code owner February 12, 2024 17:00
@askpt askpt requested a review from toddbaert February 12, 2024 17:00
@askpt askpt merged commit fd0a541 into main Feb 12, 2024
16 checks passed
@askpt askpt deleted the askpt/192-feature-implement-flag-metadata branch February 12, 2024 20:51
beeme1mr pushed a commit that referenced this pull request Mar 12, 2024
🤖 I have created a release *beep* *boop*
---


##
[1.5.0](v1.4.1...v1.5.0)
(2024-03-12)


### 🐛 Bug Fixes

* Add targeting key
([#231](#231))
([d792b32](d792b32))
* Fix NU1009 reference assembly warning
([#222](#222))
([7eebcdd](7eebcdd))
* invalid editorconfig
([#244](#244))
([3c00757](3c00757))


### ✨ New Features

* Flag metadata
([#223](#223))
([fd0a541](fd0a541))
* implement in-memory provider
([#232](#232))
([1082094](1082094))


### 🧹 Chore

* bump spec version badge
([#246](#246))
([ebf5552](ebf5552))
* cleanup unused usings 🧹
([#240](#240))
([cdc1bee](cdc1bee))
* **deps:** update actions/upload-artifact action to v4.3.0
([#203](#203))
([0a7e98d](0a7e98d))
* **deps:** update actions/upload-artifact action to v4.3.1
([#233](#233))
([cfaf1c8](cfaf1c8))
* **deps:** update codecov/codecov-action action to v3.1.5
([#209](#209))
([a509b1f](a509b1f))
* **deps:** update codecov/codecov-action action to v3.1.6
([#226](#226))
([a577a80](a577a80))
* **deps:** update dependency coverlet.collector to v6.0.1
([#238](#238))
([f2cb67b](f2cb67b))
* **deps:** update dependency fluentassertions to v6.12.0
([#215](#215))
([2c237df](2c237df))
* **deps:** update dependency microsoft.net.test.sdk to v17.8.0
([#216](#216))
([4cb3ae0](4cb3ae0))
* **deps:** update dependency nsubstitute to v5.1.0
([#217](#217))
([3be76cd](3be76cd))
* **deps:** update dependency openfeature.contrib.providers.flagd to
v0.1.8 ([#211](#211))
([c1aece3](c1aece3))
* **deps:** update xunit-dotnet monorepo
([#236](#236))
([fa25ece](fa25ece))
* Enable Central Package Management (CPM)
([#178](#178))
([249a0a8](249a0a8))
* Enforce coding styles on build
([#242](#242))
([64699c8](64699c8))
* More sln cleanup
([#206](#206))
([bac3d94](bac3d94))
* SourceLink is built-in for .NET SDK 8.0.100+
([#198](#198))
([45e2c86](45e2c86))
* Sync ci.yml with contrib repo
([#196](#196))
([130654b](130654b))
* Sync release.yml with ci.yml following
[#173](#173)
([#195](#195))
([eba8848](eba8848))


### 📚 Documentation

* fix hook ecosystem link
([#229](#229))
([cc6c404](cc6c404))
* update the feature table key
([f8724cd](f8724cd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

[FEATURE] Implement flag metadata
5 participants