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: in-process offline flagd resolver #74

Merged
merged 27 commits into from
Apr 11, 2024

Conversation

colebaileygit
Copy link
Contributor

@colebaileygit colebaileygit commented Mar 30, 2024

This PR

  • Adds in-memory resolver for the flagd provider which watches a local JSON file to retrieve flag configurations
  • Implements fractional, semver, stringcomp custom operators
  • Integrates and passes gherkin test suite

Related Issues

open-feature/flagd#1264

Notes

Follow-up Tasks

  • Add gRPC sync source option when using in-process provider
  • Add schemas as submodule to verify flags against expected schema during parsing

How to test

cd providers/openfeature-provider-flagd
hatch run test

@colebaileygit colebaileygit requested a review from a team as a code owner March 30, 2024 14:43
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
@colebaileygit colebaileygit force-pushed the feat/flagd-in-process branch from ac107d6 to 4b9b12d Compare March 30, 2024 14:45
Copy link

codecov bot commented Mar 30, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 32 lines in your changes are missing coverage. Please review.

Project coverage is 91.87%. Comparing base (d8e10c7) to head (ebec505).
Report is 27 commits behind head on main.

Files Patch % Lines
...rib/provider/flagd/resolvers/process/custom_ops.py 86.95% 12 Missing ⚠️
...enfeature/contrib/provider/flagd/resolvers/grpc.py 84.05% 11 Missing ⚠️
...b/provider/flagd/resolvers/process/file_watcher.py 93.84% 4 Missing ⚠️
...ure/contrib/provider/flagd/resolvers/in_process.py 94.33% 3 Missing ⚠️
...src/openfeature/contrib/provider/flagd/provider.py 88.23% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
+ Coverage   90.55%   91.87%   +1.31%     
==========================================
  Files           8       12       +4     
  Lines         180      443     +263     
==========================================
+ Hits          163      407     +244     
- Misses         17       36      +19     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@beeme1mr
Copy link
Member

Amazing, thank you! I'll review this as soon as possible.

Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
@federicobond
Copy link
Member

This is great work @colebaileygit, thank you! Will review as soon as possible too.

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

This looks great! I left a few comments but the logic matches other implementations.

I really appreciate you working on this. It's exciting to see the Python SDK and providers maturing.

Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
@beeme1mr
Copy link
Member

beeme1mr commented Apr 2, 2024

Hey @colebaileygit, would you be interested in joining the org? It makes it easier to coordinate on issues and is an initial step towards becoming a maintainer if that's a goal. I would be happy to sponsor you, but there's certainly no obligation.

Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
@colebaileygit
Copy link
Contributor Author

Had a small battle with CI, but the test suite should be robust now finally 🎉
As a bonus I made it so the pre-commit hook evaluates using python 3.8 instead of your version so that we can catch those errors offline too

@beeme1mr
Copy link
Member

beeme1mr commented Apr 3, 2024

I'll give @federicobond a chance to review since he has much more Python experience but it looks good to me.

Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
@colebaileygit
Copy link
Contributor Author

Shall I add this small change into this PR, or keep the two separate since the fractional update is a WIP breaking change? https://github.com/colebaileygit/open-feature-python-sdk-contrib/pull/1/files

Now that test-harness is merged this seems cleaner to include

@beeme1mr
Copy link
Member

beeme1mr commented Apr 8, 2024

Feel free to include it while we chip away at merging in all the other PRs. I still need to work on the JS implementation.

@colebaileygit
Copy link
Contributor Author

@federicobond @beeme1mr Anything else pending? We are starting to use this internally so being able to have an official versioned release would be amazing.

The CI error looks unrelated to the PR and some issue with codecov, so don't know what I can do to solve it unfortunately

@beeme1mr
Copy link
Member

I'll review it today and schedule a release if everything looks good.

@beeme1mr beeme1mr merged commit 8cea506 into open-feature:main Apr 11, 2024
17 checks passed
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.

3 participants