-
Notifications
You must be signed in to change notification settings - Fork 10
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
Re-write Rust SDK #15
Conversation
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Hey @sheepduke, could you please sign off your commits? It's a requirement from the CNCNF before we can merge. To add your Signed-off-by line to every commit in this branch:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! As a follow-up, please update the readme to match the new package name and structure.
renovate.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the renovate config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that this needs to be fixed before merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please kindly explain to me what does this file do? I googled it but did not see anywhere related. Plus no usage in the code...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm biased b/c I wrote this code, but you might like the pattern we used in the java-sdk where each test is annotated with a specification that it covers. It helps uncover which areas we're not covering yet.
renovate.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that this needs to be fixed before merge.
Signed-off-by: YUE Daian <[email protected]>
Co-authored-by: Justin Abrahms <[email protected]> Signed-off-by: YUE Daian <[email protected]> Signed-off-by: YUE Daian <[email protected]>
Co-authored-by: Justin Abrahms <[email protected]> Signed-off-by: YUE Daian <[email protected]> Signed-off-by: YUE Daian <[email protected]>
@justinabrahms My apologies. Your request changes have been overwritten by my force-update to resolve the signing issue. :-( Could you please kindly re-request it, or let me know what have you changed? I am rather curious that how did you add the specification to the tests. |
Signed-off-by: YUE Daian <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main thing we need to change is the renovate file being deleted.
As for spec tests, there's a python script in the repo which parses them and validates. Something for later, but you could probably make your life easier by commenting the relevant spec until we get something statically verifiable.
Signed-off-by: YUE Daian <[email protected]>
Thanks for sharing the info. I have added this JSON file back and created an issue to track it: I have re-requested your review. :-) |
Ahh. Bit of confusion. I'll update the ticket. Renovate keeps our dependencies up to date. The json thing I mentioned was something else. |
This PR
Re-writes the OpenFeature Rust SDK based on the spec.
This PR brings the following major improvements compared to existing code:
A singleton of
OpenFeature
is implemented as per spec 1.1.1. The application author should callget_client
to get an instance. No more manual creation.EvaluationDetails
andResolutionsDetails
has been refined to useenum
to store the reason and error code, per spec.Evaluation functions is now strongly typed. Meaning the user should call
get_int_value
to get ani64
value. This is required by the spec 1.3.1.Evaluation functions
get_xx_value
becomesasync
as suggested by the spec 1.4.11.Meaningful doc strings for public types and traits. Content selectively copied from the spec.
See Follow-up tasks for what has not been done.
Related Issues
Fixes:
ResolutionDetails
#13Notes
Why re-writing?
I tried to patch existing code but ended up re-writing it. The main reason was that too much code needed to be changed to make both spec and Rust compiler happy.
For example, the old
resolution
function takes a type parameterT: Clone
that makes it non object safe, which breaks the requirements of singleton (lazy_static
),async
and more. The provider author can never put thisT
value in a cache because it hasClone
constraint that impliesSized
etc etc.There are some other pain points and I cannot recall now. Still, the existing code inspired me in a lot of ways. Just I was a bit lazy to patch everything and re-writing would be easier.
Follow-up Tasks
get_xx_details
.