Skip to content

feat: stream vardata #176

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
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

feat: stream vardata #176

wants to merge 14 commits into from

Conversation

zhukaihan
Copy link
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 Copilot, bgiori and tyiuhc and removed request for Copilot and bgiori April 21, 2025 08:52
Copy link

@Copilot Copilot AI left a comment

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

@zhukaihan zhukaihan force-pushed the stream-vardata branch 4 times, most recently from 8e10fe0 to 1417d7c Compare April 25, 2025 23:10
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.

2 participants