Skip to content

feat: add SSE and HTTP streaming support#4014

Merged
slayerjain merged 87 commits intomainfrom
feat/sse-support-revert
Apr 9, 2026
Merged

feat: add SSE and HTTP streaming support#4014
slayerjain merged 87 commits intomainfrom
feat/sse-support-revert

Conversation

@officialasishkumar
Copy link
Copy Markdown
Member

@officialasishkumar officialasishkumar commented Apr 6, 2026

Describe the changes that are made

  • add SSE and HTTP streaming support across Keploy's capture, replay, and rerecord flows
  • introduce bounded request/response capture and structured stream-body handling for SSE, NDJSON, multipart, and plain text streaming responses
  • add ssePort, protocol-level port configuration, and replaceWith port mapping so replay and rerecord can route streaming traffic correctly
  • extend tests and CI coverage, including the SSE preflight workflow path

Links & References

Closes: #3811

🔗 Related PRs

  • NA

🐞 Related Issues

📄 Related Documents

  • NA

What type of PR is this? (check all applicable)

  • 📦 Chore
  • 🍕 Feature
  • 🐞 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🔁 CI
  • ⏩ Revert

Added e2e test pipeline?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added comments for hard-to-understand areas?

  • 👍 yes
  • 🙅 no, because the code is self-explanatory

Added to documentation?

  • 📜 README.md
  • 📓 Wiki
  • 🙅 no documentation needed

Are there any sample code or steps to test the changes?

  • 👍 yes, mentioned below
  • 🙅 no, because it is not needed

Sample steps to test

  • record and replay an app with SSE or HTTP streaming responses and verify the captured stream body is matched correctly during replay
  • run keploy test --port 8000 --sse-port 8047 --api-timeout 200 --delay 30 for the SSE flow covered by the workflow
  • run the added SSE preflight path from .github/workflows/test_workflow_scripts/golang/sse_preflight/golang-linux.sh
  • run the updated Go tests covering stream-body parsing, ingress capture, replay hooks, and streaming comparison logic

Self Review done?

  • ✅ yes
  • ❌ no, because I need help

Any relevant screenshots, recordings or logs?

  • NA

🧠 Semantics for PR Title & Branch Name

Please ensure your PR title and branch name follow the Keploy semantics:

📌 PR Semantics Guide
📌 Branch Semantics Guide

Examples:

  • PR Title: fix: patch MongoDB document update bug
  • Branch Name: feat/#1-login-flow (You may skip mentioning the issue number in the branch name if the change is small and the PR description clearly explains it.)

Additional checklist:

officialasishkumar and others added 30 commits February 20, 2026 01:51
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
…noise configuration handling.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
…ervice for SSE support.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
…update replay service logic.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
…ing the mock window and refine outgoing message recording logs.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
…le replay

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
- Added a new function to merge consecutive SSE data fields, allowing for proper handling of multiline data.
- Updated the `compareSSEFields` function to utilize the new merging logic.
- Introduced tests to validate the normalization of multiline SSE data in both parsing and serialization contexts.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Signed-off-by: Asish Kumar <87874775+officialasishkumar@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Signed-off-by: Asish Kumar <87874775+officialasishkumar@users.noreply.github.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
…son logic for HTTP.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/service/replay/replay.go
Comment thread pkg/service/replay/replay.go
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

pkg/service/orchestrator/rerecord.go:484

  • rerecord still simulates SSE/streaming testcases via pkg.SimulateHTTP, which reads the full response body. For SSE/long-lived HTTP streams this can block until timeout and prevent rerecord from completing/capturing the stream body. Route streaming testcases through pkg.SimulateHTTPStreaming and capture/close the stream using the new streaming comparators/stream-body model (similar to replay’s streaming path) so rerecord works reliably for SSE/HTTP streaming.
		hostToUse := o.config.Test.Host
		configPortToUse := o.config.ReRecord.Port
		if isSSERequest && o.config.ReRecord.SSEPort > 0 {
			configPortToUse = o.config.ReRecord.SSEPort
		}

		resp, err := pkg.SimulateHTTP(ctx, tc, testSet, o.logger, pkg.SimulationConfig{
			APITimeout:      o.config.Test.APITimeout,
			ConfigPort:      configPortToUse,
			KeployPath:      o.config.Path,
			ConfigHost:      hostToUse,
			URLReplacements: nil,
		})

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cli/provider/cmd.go
Comment thread pkg/service/replay/replay.go
The index field in streamingTest was set but never read. Removed the
field and the corresponding idx loop variable to eliminate dead code.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

🚀 Keploy Performance Test Results

Multi-Run Validation: Tests run 3 times, pipeline fails only if 2+ runs show regression.

Run P50 P90 P99 RPS Error Rate Status
1 2.83ms 3.75ms 5.38ms 100.00 0.00% ✅ PASS
2 2.8ms 3.99ms 5.81ms 100.00 0.00% ✅ PASS
3 3.07ms 4.43ms 6ms 100.00 0.00% ✅ PASS

Thresholds: P50 < 5ms, P90 < 15ms, P99 < 70ms, RPS >= 100 (±1% tolerance), Error Rate < 1%

Result: PASSED - Only 0 out of 3 runs failed (threshold: 2)

P50, P90, and P99 percentiles naturally filter out outliers

Copy link
Copy Markdown
Contributor

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

Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/agent/proxy/proxy.go Outdated
Switched from p.logger to the contextual logger in the outgoing record
path so connection-level fields (IDs, destination) are included in the
debug and error logs consistently.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

🚀 Keploy Performance Test Results

Multi-Run Validation: Tests run 3 times, pipeline fails only if 2+ runs show regression.

Run P50 P90 P99 RPS Error Rate Status
1 2.31ms 2.89ms 4.25ms 100.02 0.00% ✅ PASS
2 2.25ms 2.84ms 4.28ms 100.02 0.00% ✅ PASS
3 2.3ms 3.31ms 5.06ms 100.00 0.00% ✅ PASS

Thresholds: P50 < 5ms, P90 < 15ms, P99 < 70ms, RPS >= 100 (±1% tolerance), Error Rate < 1%

Result: PASSED - Only 0 out of 3 runs failed (threshold: 2)

P50, P90, and P99 percentiles naturally filter out outliers

Copy link
Copy Markdown
Contributor

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

Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

🚀 Keploy Performance Test Results

Multi-Run Validation: Tests run 3 times, pipeline fails only if 2+ runs show regression.

Run P50 P90 P99 RPS Error Rate Status
1 2.74ms 3.44ms 5.18ms 100.02 0.00% ✅ PASS
2 2.68ms 3.35ms 4.96ms 100.00 0.00% ✅ PASS
3 2.76ms 3.98ms 6.12ms 100.02 0.00% ✅ PASS

Thresholds: P50 < 5ms, P90 < 15ms, P99 < 70ms, RPS >= 100 (±1% tolerance), Error Rate < 1%

Result: PASSED - Only 0 out of 3 runs failed (threshold: 2)

P50, P90, and P99 percentiles naturally filter out outliers

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

🚀 Keploy Performance Test Results

Multi-Run Validation: Tests run 3 times, pipeline fails only if 2+ runs show regression.

Run P50 P90 P99 RPS Error Rate Status
1 3.02ms 3.84ms 5.59ms 100.02 0.00% ✅ PASS
2 2.87ms 3.8ms 6.03ms 100.00 4.53% ❌ FAIL

Thresholds: P50 < 5ms, P90 < 15ms, P99 < 70ms, RPS >= 100 (±1% tolerance), Error Rate < 1%

Result: PASSED - Only 1 out of 3 runs failed (threshold: 2)

P50, P90, and P99 percentiles naturally filter out outliers

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

🚀 Keploy Performance Test Results

Multi-Run Validation: Tests run 3 times, pipeline fails only if 2+ runs show regression.

Run P50 P90 P99 RPS Error Rate Status
1 2.85ms 3.75ms 5.49ms 100.02 0.00% ✅ PASS
2 2.9ms 3.89ms 5.89ms 100.00 0.00% ✅ PASS
3 3.09ms 4.5ms 7.62ms 100.00 0.00% ✅ PASS

Thresholds: P50 < 5ms, P90 < 15ms, P99 < 70ms, RPS >= 100 (±1% tolerance), Error Rate < 1%

Result: PASSED - Only 0 out of 3 runs failed (threshold: 2)

P50, P90, and P99 percentiles naturally filter out outliers

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@officialasishkumar officialasishkumar force-pushed the feat/sse-support-revert branch from 83d236d to 6ffa015 Compare April 9, 2026 09:50
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

🚀 Keploy Performance Test Results

Multi-Run Validation: Tests run 3 times, pipeline fails only if 2+ runs show regression.

Run P50 P90 P99 RPS Error Rate Status
1 2.35ms 2.99ms 4.18ms 100.02 0.00% ✅ PASS
2 2.26ms 2.89ms 4.32ms 100.02 0.00% ✅ PASS
3 2.3ms 3.25ms 5.04ms 100.02 0.00% ✅ PASS

Thresholds: P50 < 5ms, P90 < 15ms, P99 < 70ms, RPS >= 100 (±1% tolerance), Error Rate < 1%

Result: PASSED - Only 0 out of 3 runs failed (threshold: 2)

P50, P90, and P99 percentiles naturally filter out outliers

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

🚀 Keploy Performance Test Results

Multi-Run Validation: Tests run 3 times, pipeline fails only if 2+ runs show regression.

Run P50 P90 P99 RPS Error Rate Status
1 2.73ms 3.48ms 5.29ms 100.00 0.00% ✅ PASS
2 2.65ms 3.44ms 5.11ms 100.01 0.00% ✅ PASS
3 2.95ms 4.25ms 5.77ms 100.00 0.00% ✅ PASS

Thresholds: P50 < 5ms, P90 < 15ms, P99 < 70ms, RPS >= 100 (±1% tolerance), Error Rate < 1%

Result: PASSED - Only 0 out of 3 runs failed (threshold: 2)

P50, P90, and P99 percentiles naturally filter out outliers

@slayerjain slayerjain merged commit 6cc3fde into main Apr 9, 2026
259 of 277 checks passed
@slayerjain slayerjain deleted the feat/sse-support-revert branch April 9, 2026 19:44
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants