Skip to content

Decouple response processing out of transparent proxy#3216

Merged
dmjb merged 2 commits intoproxy-headerfrom
refactor-sse-processor
Jan 7, 2026
Merged

Decouple response processing out of transparent proxy#3216
dmjb merged 2 commits intoproxy-headerfrom
refactor-sse-processor

Conversation

@dmjb
Copy link
Copy Markdown
Contributor

@dmjb dmjb commented Jan 7, 2026

In order to minimize the amount of transport-specific logic in the transparent proxy, create a response processor interface and put the new SSE rewrite logic behind that interface. Create a no-op implementation for HTTP streamable.

In order to minimize the amount of transport-specific logic in the
transparent proxy, create a response processor interface and put the new
SSE rewrite logic behind that interface. Create a no-op implementation
for HTTP streamable.
@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Jan 7, 2026
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Jan 7, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 81.10236% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.31%. Comparing base (20d1d2b) to head (2c07466).
⚠️ Report is 1 commits behind head on proxy-header.

Files with missing lines Patch % Lines
...nsport/proxy/transparent/sse_response_processor.go 80.18% 12 Missing and 9 partials ⚠️
.../transport/proxy/transparent/response_processor.go 83.33% 2 Missing ⚠️
...g/transport/proxy/transparent/transparent_proxy.go 88.88% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           proxy-header    #3216      +/-   ##
================================================
+ Coverage         57.29%   57.31%   +0.02%     
================================================
  Files               347      349       +2     
  Lines             34567    34594      +27     
================================================
+ Hits              19805    19829      +24     
- Misses            13119    13123       +4     
+ Partials           1643     1642       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmjb dmjb merged commit ff38c51 into proxy-header Jan 7, 2026
26 checks passed
@dmjb dmjb deleted the refactor-sse-processor branch January 7, 2026 18:16
amirejaz added a commit that referenced this pull request Jan 8, 2026
* Add X-Forwarded-Prefix support for SSE endpoint URL rewriting

Implement SSE endpoint URL rewriting in the TransparentProxy to support
path-based ingress routing that strips path prefixes.

Changes:
- Add endpointPrefix and trustProxyHeaders fields to TransparentProxy
- Add sseRewriteConfig type for holding rewrite configuration
- Add getSSERewriteConfig() to determine rewrite config with priority:
  1. Explicit endpointPrefix (highest priority)
  2. X-Forwarded-Prefix header (when trustProxyHeaders is true)
  3. No rewriting (default)
- Add rewriteEndpointURL() to handle both relative and absolute URLs
- Refactor SSE response processing with sseLineProcessor struct
- Only rewrite "event: endpoint" events, pass others unchanged
- Preserve existing session ID extraction functionality

Fixes #3071

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add EndpointPrefix to transport and runner config structs

Wire the endpointPrefix configuration through the transport layer:
- Add EndpointPrefix to transport.Config struct
- Add EndpointPrefix to runner.RunConfig struct
- Update HTTPTransport to accept and pass endpointPrefix to proxy
- Update factory.go to pass EndpointPrefix from config
- Update runner.go to include EndpointPrefix in transport config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add --endpoint-prefix CLI flag to thv run command

Add CLI support for specifying the SSE endpoint URL prefix:
- Add EndpointPrefix field to RunFlags struct
- Add --endpoint-prefix flag with help text
- Add validation to ensure prefix starts with '/' when provided
- Add WithEndpointPrefix builder option in config_builder.go

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add endpointPrefix field to MCPServer and MCPRemoteProxy CRDs

Add Kubernetes CRD support for configuring SSE endpoint URL prefix:
- Add EndpointPrefix field to MCPServerSpec and MCPRemoteProxySpec
- Wire field through controllers to runner config
- Regenerate CRD manifests with operator-generate/operator-manifests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add documentation for SSE endpoint URL rewriting feature

- Regenerate CLI docs with new --endpoint-prefix flag
- Add SSE Endpoint URL Rewriting section to transport architecture doc
- Document priority order, CLI usage, and Kubernetes CRD examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* bump chart version

* add an e2e test case

* fix lint/compiler issue

* Decouple response processing out of transparent proxy (#3216)

In order to minimize the amount of transport-specific logic in the
transparent proxy, create a response processor interface and put the new
SSE rewrite logic behind that interface. Create a no-op implementation
for HTTP streamable.

* oeprator crd version bump

---------

Co-authored-by: Jakub Hrozek <jakub@stacklok.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: amirejaz <amir@stacklok.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants