Repository navigation
fix: key provider state by identity, default the NoOp reason, freeze client metadata - #355
Conversation
…ider.object_id Signed-off-by: Cristian Marta <cristian@caffe-lento.com> Signed-off-by: Jose Colella <jose.colella@gusto.com>
…t error code with spec Signed-off-by: Cristian Marta <cristian@caffe-lento.com> Signed-off-by: Jose Colella <jose.colella@gusto.com>
Signed-off-by: Cristian Marta <cristian@caffe-lento.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 49 minutes. View limit details
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
=======================================
Coverage 99.67% 99.67%
=======================================
Files 32 32
Lines 927 930 +3
=======================================
+ Hits 924 927 +3
Misses 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
These localized changes have no identified blocking issues; automated tests were not run in this environment.
No open issues 🎉
What changed in this PR
Combines three focused fixes that advance the Ruby SDK’s OpenFeature specification compliance under #300.
Changes:
- Tracks provider state using object identity rather than
object_id. - Changes the NoOp evaluation reason to
DEFAULTand the default initialization error code toGENERAL. - Freezes client metadata and a defensive copy of its domain, with updated regression tests.
| File | Description |
|---|---|
spec/open_feature/sdk/provider_state_registry_spec.rb |
Removes unnecessary object_id stubs. |
spec/open_feature/sdk/provider_initialization_error_spec.rb |
Expects the GENERAL default error code. |
spec/open_feature/sdk/hooks/logging_hook_spec.rb |
Verifies logging preserves an explicit error code. |
spec/open_feature/sdk/client_spec.rb |
Checks metadata and domain are frozen. |
lib/open_feature/sdk/provider/no_op_provider.rb |
Uses the standard DEFAULT reason. |
lib/open_feature/sdk/provider_state_registry.rb |
Uses provider objects as identity-based keys. |
lib/open_feature/sdk/provider_initialization_error.rb |
Defaults to GENERAL and updates its documentation. |
lib/open_feature/sdk/client_metadata.rb |
Copies and freezes the domain, then freezes metadata. |
Review effort: Balanced
Summary
main. Supersedes fix: use provider object as hash key in ProviderStateRegistry #270, fix: align NoOpProvider reason and ProviderInitializationError default error code with spec #271 and fix: freeze ClientMetadata to satisfy spec req 4.2.2.1 #273, and each commit keeps Cristian as author.compare_by_identity) instead ofobject_id. Anobject_idcan be reused after garbage collection.DEFAULT, andProviderInitializationError's default error code isGENERAL.ClientMetadataand its domain are frozen, so hooks can't change client metadata (1.2.2, 4.2.2.2).Behavior changes worth noting
reasonis"DEFAULT"instead of"No-op".ProviderInitializationError.newwithouterror_code:defaults toGENERALinstead ofPROVIDER_FATAL. Errors the SDK raises from a failinginitstill carry that init's own code.client.metadataraisesFrozenError.How to review
main's version.Merging
Co-authored-by: Cristian Marta <cristian@caffe-lento.com>to the squash message so his authorship survives.🤖 Generated with Claude Code