Skip to content

Conversation

@Dal-Papa
Copy link

@Dal-Papa Dal-Papa commented Nov 7, 2025

Currently, the provider doesn't work when trying to fetch a Dynamic Configuration from Split.io.

This PR makes it work by using the actual config instead of the variant name.

lzrf0cuz pushed a commit to lzrf0cuz/split-openfeature-provider-go that referenced this pull request Nov 11, 2025
Document two critical bugs that must be fixed:

1. Bug splitio#1: Dynamic Configurations don't work
   - ObjectEvaluation uses Treatment() instead of TreatmentWithConfig()
   - Tries to parse treatment name as JSON instead of config field
   - Prevents use of Split.io Dynamic Configurations feature
   - Fix: Use TreatmentWithConfig() and extract config field

2. Bug splitio#2: Attributes not passed to Split SDK
   - evaluateTreatment() passes nil for attributes parameter
   - Breaks all attribute-based targeting rules
   - Users cannot leverage Split.io targeting capabilities
   - Fix: Convert OpenFeature context to attributes map

Both bugs validated against:
- Split.io Go SDK v6.8.1 documentation
- Flashgap's PR splitio#3 (object evaluation fix)
- snap-one's fork (attribute passing enhancement)
- Official Harness/Split.io documentation

Includes:
- Root cause analysis with code references
- Impact assessment
- Detailed solution with code examples
- Test cases for validation
- Implementation priority (Phase 0 - before lifecycle)
- Estimated effort (~5 hours)

These fixes are REQUIRED before implementing the gold standard plan.
lzrf0cuz pushed a commit to lzrf0cuz/split-openfeature-provider-go that referenced this pull request Nov 11, 2025
Fix Bug splitio#1: Dynamic Configurations not working
- ObjectEvaluation now uses config field from TreatmentWithConfig()
- Previously tried to parse treatment name as JSON (incorrect)
- Now correctly uses Split.io Dynamic Configuration feature
- Maintains backward compatibility (falls back to treatment if no config)
- Add TestDynamicConfiguration to verify fix

Fix Bug splitio#2: Attributes not passed to Split SDK
- Create evaluateTreatmentWithConfig() helper function
- Extracts targeting key and builds attributes map from evalContext
- Calls TreatmentWithConfig() with attributes for targeting rules
- Update evaluateTreatment() to use new helper (backward compatible)
- Add TestAttributesPassedToSplit to verify attributes work

Implementation:
- provider.go: Add evaluateTreatmentWithConfig() with full godoc
- provider.go: Update ObjectEvaluation to use config field
- provider.go: Update evaluateTreatment to call new helper
- provider_test.go: Add TestAttributesPassedToSplit
- provider_test.go: Add TestDynamicConfiguration
- go.mod: Fix Go version from 1.25.3 to 1.21 (1.25 doesn't exist)

Results:
- All 22 tests pass (21 existing + 2 new)
- Backward compatibility maintained
- Critical functionality restored

Validates community fork fixes:
- Flashgap PR splitio#3: Object evaluation bug
- snap-one: Attribute passing enhancement

Resolves issues documented in CRITICAL_BUGS.md Phase 0.
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.

1 participant