Requirements
Problem
Currently, we have inconsistent handling of selectors across different flagd services:
- Sync Service (
flagd/pkg/service/flag-sync/handler.go:34): Uses req.GetSelector() from the request body
- Evaluation Service: Uses
flagd-selector header
- OFREP Service: Uses
flagd-selector header
This inconsistency can lead to confusion for users and makes the API surface less predictable.
Proposal
Normalize selector handling across all services by:
- Preferred approach: Use the
flagd-selector header as the primary method for all services
- Backward compatibility: For the sync service, continue to accept
selector in the request body as a fallback for a deprecation period
Implementation Strategy
- Update sync service to check for
flagd-selector header first
- Fall back to request body
selector field if header is not present
- Log deprecation warning when using request body selector
- Document the change and migration path
- Remove request body selector support in a future major version (e.g., v2.0.0)
Benefits
- Consistent API across all flagd services
- Easier to understand and use for developers
- Aligns with common patterns for query/filter parameters in gRPC metadata
Breaking Changes
None initially (backward compatible), but request body selector would be removed in a future major release.
Additional Context
The sync service currently processes the selector at:
selectorExpression := req.GetSelector()
selector := store.NewSelector(selectorExpression)
This should be updated to prioritize metadata/header values while maintaining backward compatibility.
Requirements
Problem
Currently, we have inconsistent handling of selectors across different flagd services:
flagd/pkg/service/flag-sync/handler.go:34): Usesreq.GetSelector()from the request bodyflagd-selectorheaderflagd-selectorheaderThis inconsistency can lead to confusion for users and makes the API surface less predictable.
Proposal
Normalize selector handling across all services by:
flagd-selectorheader as the primary method for all servicesselectorin the request body as a fallback for a deprecation periodImplementation Strategy
flagd-selectorheader firstselectorfield if header is not presentBenefits
Breaking Changes
None initially (backward compatible), but request body selector would be removed in a future major release.
Additional Context
The sync service currently processes the selector at:
This should be updated to prioritize metadata/header values while maintaining backward compatibility.