Skip to content

feat: stream vardata - #176

Draft
zhukaihan wants to merge 23 commits into
mainfrom
stream-vardata
Draft

feat: stream vardata#176
zhukaihan wants to merge 23 commits into
mainfrom
stream-vardata

Conversation

@zhukaihan

Copy link
Copy Markdown
Collaborator

Summary

Adds vardata streaming feature.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: no

@zhukaihan
zhukaihan requested review from bgiori, Copilot and tyiuhc and removed request for bgiori and Copilot April 21, 2025 08:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 () => {

Comment thread packages/experiment-browser/src/experimentClient.ts Outdated
Comment thread packages/experiment-browser/src/experimentClient.ts
@zhukaihan
zhukaihan force-pushed the stream-vardata branch 4 times, most recently from 8e10fe0 to 1417d7c Compare April 25, 2025 23:10
@tyiuhc
tyiuhc force-pushed the main branch 2 times, most recently from 9b7ade3 to 228cc23 Compare June 13, 2025 18:09
@tyiuhc
tyiuhc force-pushed the main branch 6 times, most recently from 6d36199 to fc10097 Compare November 20, 2025 14:09
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.

3 participants