Skip to content

test: No CI test checks that a mid-stream upstream failure reaches the client as an error #1552

Closed

Description

@huang195

Problem

No test checks that a response broken mid-stream reaches the client as an error. #1543 slipped through this gap: the forward proxy ends a reset SSE stream as a clean, complete 200.

What exists today

  • TestForwardProxy_TruncatedResponse_RecordsUpstreamFailure and TestReverseProxy_TruncatedResponse_RecordsUpstreamFailure cover the buffered path only: a body promised by Content-Length and cut short, which becomes a 502.
  • TestForwardProxy_FallbackBuffered_BufferingFailures covers the buffered SSE fallback.
  • Nothing covers a failure after headers are sent on the streaming relay, the passthrough copy, or the skip-hosts copy.

Measured on main (43cf553)

Upstream sends one SSE event, then resets the connection:

Listener Arm Client sees
reverse proxy no plugins unexpected EOF (correct)
reverse proxy streaming responder unexpected EOF (correct)
forward proxy no plugins clean EOF (wrong)
forward proxy streaming responder clean EOF (wrong)

So the two proxies already disagree. That is the kind of difference core/listener/parity exists to catch.

Proposed test

One table test, ideally in core/listener/parity or beside upstreamfailure_test.go.

  • Failures: reset after the first event, close without the final chunk, the idle cutoff, and a clean end (the control case).
  • Arms: forward-proxy streaming relay, forward-proxy passthrough, skip-hosts copy, the TLS-bridged versions (h1 and h2), and reverse-proxy streaming.
  • Assert: the client's body read errors exactly when the upstream failed, and the response row carries error in the same cases.

Upstreams like this already exist in the tree (truncatingBackend), so the fixture is small.

How to land

The forward-proxy rows fail until #1543 is fixed. Land the test with the fix, or land it first with those rows skipped and pointing at #1543.


Found while checking why the bugs from an experiment-driven audit (#1541–#1547) got past CI. Grounded on main at 43cf553.

Assisted-By: Claude (Anthropic AI) [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgo

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions