Repository navigation
fix: detach replaced and shut-down providers - #341
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jose Colella <jose.colella@gusto.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jose Colella <jose.colella@gusto.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jose Colella <jose.colella@gusto.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jose Colella <jose.colella@gusto.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jose Colella <jose.colella@gusto.com>
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 30 minutes. View limit details
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #341 +/- ##
=======================================
Coverage 99.51% 99.52%
=======================================
Files 32 32
Lines 832 841 +9
=======================================
+ Hits 828 837 +9
Misses 4 4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Lifecycle races still allow initialization events during shutdown and registry entries to be recreated after provider replacement.
2 open issues
What changed in this PR
This PR improves provider lifecycle cleanup in the Ruby SDK by detaching replaced and shut-down providers and filtering events from unregistered providers, advancing the compliance work tracked in #300.
Changes:
- Detach providers after their last domain binding is removed and before shutdown.
- Add a binding check to reject late provider events.
- Add lifecycle regression tests and update the corresponding type signature.
| File | Description |
|---|---|
spec/specification/provider_spec.rb |
Verify reinitialization when a replaced provider is registered again. |
spec/specification/flag_evaluation_api_spec.rb |
Cover detachment, shared bindings, and late async initialization. |
spec/open_feature/sdk/configuration_spec.rb |
Register the provider before testing event-handler error logging. |
sig/open_feature/sdk/configuration.rbs |
Declare the new binding-check helper. |
lib/open_feature/sdk/configuration.rb |
Detach inactive providers and guard event dispatch by binding status. |
Review effort: Balanced
…roviders Signed-off-by: Jose Colella <jose.colella@gusto.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shutdown now unbinds providers before calling their shutdown, so a READY from an async init that finishes mid-shutdown no longer flips the state back from NOT_READY or reaches handlers. The binding check and state update in dispatch_provider_event now run under the provider mutex, so an event that passed the check cannot re-track a provider that was replaced in between. Signed-off-by: Jose Colella <jose.colella@gusto.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Summary
Context for reviewers
configuration.rb. The next PR, on event delivery order (Reentrant provider events reach client callbacks out of order #332), builds on the newprovider_bound?check.Behavior changes worth noting
shutdownare now dropped. Its status is already NOT_READY at that point (1.7.6).provider(domain:)andprovider_metadatareturn nil, and every event is dropped, including a late async init's READY.How to review
configuration.rb.configuration_spec.rbchange registers the provider first, because the old test dispatched an event for a provider that was never registered.🤖 Generated with Claude Code