feat(js): publish flag evaluations to window global for session recording#445
Open
nicklasl wants to merge 3 commits into
Open
feat(js): publish flag evaluations to window global for session recording#445nicklasl wants to merge 3 commits into
nicklasl wants to merge 3 commits into
Conversation
58d0a37 to
2cbd982
Compare
…ding Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Nicklas Lundin <nicklasl@spotify.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
andreas-karlsson
left a comment
Contributor
There was a problem hiding this comment.
I'm surprised to see this approach of putting the logic on the ConfidenceServerProviderLocal? It normally won't be used in the same JS engine as the session-recorder. I think we should consider moving this functionality to the react hooks.
The server provider runs where window is undefined, making the call a no-op. Moving it to useFlagDetails fires it in the browser when the hook mounts, which is where the session recorder lives. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2cbd982 to
afea10b
Compare
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
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
publishFlagEvaluationthat writes towindow.__confidence.flagson MATCH evaluations, enabling the session recorder to observe flag assignments and emitcsr:flagEvaluationplugin events.Test plan
publishFlagEvaluation(SSR safety, dedup, object preservation)hawkflagandtutorial-flagvia the WASM resolver, hydrated results towindow.__confidence.flagson the client, and confirmed a Proxy-based mock session recorder observed the writes ascsr:flagEvaluationevents. Also tested lazy mount — hid one flag behind a button to verify the global is only written when the component mounts.🤖 Generated with Claude Code