-
Notifications
You must be signed in to change notification settings - Fork 2
feat: JS sticky resolve support with materialized assignments #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
nicklasl
wants to merge
12
commits into
main
Choose a base branch
from
js-sticky
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implements sticky resolve functionality to ensure consistent variant assignments even when user context changes or new assignments are paused. Key changes: - Add proto definitions for ResolveWithStickyRequest/Response - Add StickyResolveStrategy interface with MaterializationRepository and ResolverFallback implementations - Refactor evaluate() to always use sticky resolve via resolveWithStickyInternal() - Add materialization utility functions for loading/storing assignments - Make evaluate() async to support async storage operations - Add comprehensive test coverage (25 tests) The implementation matches the Java SDK pattern, with fire-and-forget storage updates and recursive retry logic for missing materializations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Implements RemoteResolverFallback which delegates to the remote Confidence API when materializations are missing. This is now the default strategy, simplifying setup for users while maintaining extensibility. Changes: - Add RemoteResolverFallback class with remote API resolution - Default stickyResolveStrategy to RemoteResolverFallback - Remove non-null assertions for stickyResolveStrategy - Export RemoteResolverFallback in public API - Add comprehensive tests (16 tests, all passing) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
nicklasl
commented
Oct 13, 2025
} from "./proto/api" | ||
|
||
export interface LocalResolver { | ||
resolveFlags(request: ResolveFlagsRequest): ResolveFlagsResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we remove resolveFlags()
since it is never used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. There's a lot we should remove from the guest interface that we never use.
…ation Refactor FileBackedMaterializationRepo to use InMemoryMaterializationRepo as backing store, reading from file only on init and writing only on close. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Remove resolveFlags method from LocalResolver interface and WasmResolver implementation. Update all tests to use resolveWithSticky instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Remove ResolverFallback interface from exports as users should use the concrete RemoteResolverFallback implementation instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Remove ResolveFlagsRequest and ResolveFlagsResponse type exports as they are only used internally by ResolverFallback which is no longer public. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Change `stickyResolveStrategy` to `materializationRepository` parameter accepting either MaterializationRepository or RemoteResolverFallback. Remove StickyResolveStrategy from public exports. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Simplify API by removing intermediate interfaces: - Remove StickyResolveStrategy base interface - Remove ResolverFallback interface and type guards - Make MaterializationRepository standalone with close() method - Rename StickyResolveStrategy.ts to MaterializationRepository.ts - Update ConfidenceServerProviderLocal to use optional MaterializationRepository - RemoteResolverFallback is now created internally when no repository provided 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements sticky resolve functionality for the JavaScript OpenFeature provider to ensure consistent variant assignments even when user context changes or new assignments are paused. This includes support for both local storage (MaterializationRepository) and remote fallback (ResolverFallback) strategies.
Changes
Core Implementation
ResolveWithStickyRequest
,ResolveWithStickyResponse
,MaterializationInfo
) toapi.proto
StickyResolveStrategy
with two implementations:MaterializationRepository
: For local storage of materialized assignments (Redis, DB, etc.)ResolverFallback
: For remote API fallback when materializations are missingisResolverFallback()
andisMaterializationRepository()
for runtime type checkingProvider Integration
ConfidenceServerProviderLocal
to always use sticky resolveresolveWithStickyInternal()
matching Java SDK patternRemoteResolverFallback
is now the default, simplifying setupRemote Fallback
https://resolver.confidence.dev/v1/flags:resolve
)Utilities
handleMissingMaterializations()
: Bulk loads materializations from repositorystoreUpdates()
: Fire-and-forget storage of new assignmentsTest Coverage
StickyResolveStrategy
(type guards, interface contracts)RemoteResolverFallback
(remote API integration)ConfidenceServerProviderLocal
API Changes
New Exports
Provider Options
Usage Examples
Default (Remote Fallback)
Custom Repository
Implementation Notes
Test Plan
🤖 Generated with Claude Code