feat: stream vardata - #176
Draft
zhukaihan wants to merge 23 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds vardata streaming functionality to the Amplitude Experiment Javascript Client SDK. Key changes include:
- Introducing the SSEStream and related streaming components in the core package.
- Implementing the SdkStreamEvaluationApi for streaming variant data and updating tests accordingly.
- Integrating streaming functionality into the ExperimentClient with accompanying updates in configuration and updaters.
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/experiment-core/test/utils.ts | Added a sleep utility for test timing. |
| packages/experiment-core/test/transport/stream.test.ts | New tests for verifying SSEStream connection, keepalive, and error handling. |
| packages/experiment-core/test/api/evaluation-stream-api.test.ts | New tests for stream-based variant evaluation; note duplicate test descriptions. |
| packages/experiment-core/src/transport/stream.ts | Added SSEStream implementation with keepalive and automatic reconnection logic. |
| packages/experiment-core/src/api/evaluation-stream-api.ts | Implements the streaming evaluation API using SSEStream. |
| packages/experiment-core/src/index.ts | Re-exports new streaming components. |
| packages/experiment-browser/test/util/misc.ts | Added sleep utility for browser tests. |
| packages/experiment-browser/test/client.test.ts | Updated tests to cover the new stream variants integration. |
| packages/experiment-browser/src/util/updaters.ts | Added updaters for handling streaming and fallback for variant updates. |
| packages/experiment-browser/src/transport/stream.ts | Introduces defaultSseProvider using EventSource. |
| packages/experiment-browser/src/experimentClient.ts | Updated ExperimentClient to support streamVariants with new updater integration. |
| packages/experiment-browser/src/config.ts | Added configuration options for streamVariants and its server URL. |
Files not reviewed (1)
- packages/experiment-browser/package.json: Language not supported
Comments suppressed due to low confidence (1)
packages/experiment-core/test/api/evaluation-stream-api.test.ts:140
- Duplicate test description 'stream error stops api' detected in evaluation-stream-api tests; consider renaming one test to clarify different error scenarios.
test('stream error stops api', async () => {
bgiori
approved these changes
Apr 23, 2025
zhukaihan
force-pushed
the
stream-vardata
branch
4 times, most recently
from
April 25, 2025 23:10
8e10fe0 to
1417d7c
Compare
zhukaihan
force-pushed
the
stream-vardata
branch
from
April 25, 2025 23:14
1417d7c to
5a8f7e2
Compare
zhukaihan
force-pushed
the
stream-vardata
branch
from
April 26, 2025 22:23
ad264c3 to
d1d1ea8
Compare
zhukaihan
force-pushed
the
stream-vardata
branch
from
April 26, 2025 22:28
d1d1ea8 to
3e38058
Compare
tyiuhc
force-pushed
the
main
branch
2 times, most recently
from
June 13, 2025 18:09
9b7ade3 to
228cc23
Compare
tyiuhc
force-pushed
the
main
branch
6 times, most recently
from
November 20, 2025 14:09
6d36199 to
fc10097
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
Adds vardata streaming feature.
Checklist