docs: update README with hooks, shutdown, tracking, and hook development#228
Conversation
- Update features table: Hooks ✅, Shutdown ✅, Extending ✅, add Tracking ✅ - Replace Hooks "Coming Soon" with full documentation and code examples - Replace Shutdown "Coming Soon" with API.shutdown documentation - Add Tracking section with usage examples per spec section 6 - Replace "Develop a hook" placeholder with Hook module documentation - Add optional track method to provider duck type example Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Jose Colella <jose.colella@gusto.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the documentation within the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request provides a comprehensive update to the README, documenting several new features like hooks, shutdown, and tracking. The new sections are well-written with clear code examples. I have one minor suggestion to improve the hook registration example to promote a more efficient coding practice.
Note: Security Review has been skipped due to the limited scope of the PR.
| # Register at the API (global) level | ||
| OpenFeature::SDK.hooks << MyHook.new | ||
|
|
||
| # Register at the client level | ||
| client = OpenFeature::SDK.build_client | ||
| client.hooks << MyHook.new | ||
|
|
||
| <!-- TODO: code example of setting hooks at all levels --> | ||
| # Register at the invocation level | ||
| client.fetch_boolean_value( | ||
| flag_key: "my-flag", | ||
| default_value: false, | ||
| hooks: [MyHook.new] | ||
| ) |
There was a problem hiding this comment.
For stateless hooks like the example MyHook, it's more efficient and a better practice to instantiate the hook once and reuse the same object for all registrations. This avoids creating unnecessary objects and is a good pattern to demonstrate in documentation.
| # Register at the API (global) level | |
| OpenFeature::SDK.hooks << MyHook.new | |
| # Register at the client level | |
| client = OpenFeature::SDK.build_client | |
| client.hooks << MyHook.new | |
| <!-- TODO: code example of setting hooks at all levels --> | |
| # Register at the invocation level | |
| client.fetch_boolean_value( | |
| flag_key: "my-flag", | |
| default_value: false, | |
| hooks: [MyHook.new] | |
| ) | |
| # Instantiate the hook once | |
| my_hook_instance = MyHook.new | |
| # Register at the API (global) level | |
| OpenFeature::SDK.hooks << my_hook_instance | |
| # Register at the client level | |
| client = OpenFeature::SDK.build_client | |
| client.hooks << my_hook_instance | |
| # Register at the invocation level | |
| client.fetch_boolean_value( | |
| flag_key: "my-flag", | |
| default_value: false, | |
| hooks: [my_hook_instance] | |
| ) |
Summary
Updates the README to reflect all spec compliance work completed in the recent sprint. Replaces "Coming Soon" placeholders with full documentation and code examples.
Changes
OpenFeature::SDK.shutdownand provider shutdown lifecycleHookmodule usagetrackmethod to provider exampleTest plan
bundle exec standardrb— no offenses🤖 Jose's AI agent