headroom/crates/headroom-proxy/tests
Yasser Sheikh b08ec15b0d
fix(proxy): add native Bedrock converse-stream route (#917)
## Description

Adds native Bedrock `POST /model/{model_id}/converse-stream` routing in
`headroom-proxy` by reusing the existing streaming handler and
preserving route-specific upstream action forwarding.

This addresses a gap where native Bedrock streaming support existed for
`invoke-with-response-stream` but not `converse-stream`, even though
both share the same EventStream transport and SSE translation path in
this proxy.

Fixes #919

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring

## Changes Made

- Add route mount in `crates/headroom-proxy/src/proxy.rs`:
- `POST /model/:model_id/converse-stream` ->
`bedrock::invoke_streaming::handle_invoke_streaming`
- Update streaming handler URL construction in
`crates/headroom-proxy/src/bedrock/invoke_streaming.rs`:
- infer action from inbound path (`invoke-with-response-stream` or
`converse-stream`)
  - build upstream URL with the resolved action
  - return structured `400` for unsupported streaming action paths
- Add unit tests in
`crates/headroom-proxy/src/bedrock/invoke_streaming.rs`:
  - action extraction coverage for both streaming paths
  - upstream URL construction coverage for `converse-stream`
- Add integration coverage in
`crates/headroom-proxy/tests/integration_bedrock_streaming.rs`:
  - `converse_stream_route_translates_to_sse`
- Add changelog entry under `Unreleased` bug fixes in `CHANGELOG.md`.

## Testing

- `cargo fmt --all`
- `cargo test -p headroom-proxy --test integration_bedrock_streaming --
--nocapture`
- `cargo test -p headroom-proxy --test integration_bedrock_metrics --
--nocapture`

## Real behavior proof

- **Setup tested on**
  - macOS (darwin)
  - Rust workspace local dev build
- `headroom-proxy` integration tests using wiremock upstream (no AWS
dependency)

- **Exact commands run after patch**
- `cargo test -p headroom-proxy --test integration_bedrock_streaming --
--nocapture`
- `cargo test -p headroom-proxy --test integration_bedrock_metrics --
--nocapture`

- **After-fix evidence + observed result**
- New integration test `converse_stream_route_translates_to_sse` passes.
  - Streaming suite result: `10 passed; 0 failed`.
  - Metrics suite result: `4 passed; 0 failed`.
- Logs show requests reaching `/model/.../converse-stream` and flowing
through Bedrock streaming path.

- **What I did not test**
  - Live AWS Bedrock calls against real credentials/models.
- End-to-end CLI/runtime behavior outside Rust integration test harness.
2026-06-12 17:18:43 -05:00
..
common fix(proxy): PR-D4 native Vertex publisher path + ADC bearer auth 2026-05-04 16:24:38 -07:00
fixtures fix(rust): PR-A1 — make /v1/messages compression a passthrough 2026-05-01 23:58:20 -07:00
e2e_real.rs ci: fix cargo fmt + maturin action invocation 2026-04-25 12:52:55 -07:00
integration_bedrock_authmode.rs fix(proxy): PR-D3 Bedrock observability + auth-mode integration 2026-05-04 11:07:47 -07:00
integration_bedrock_invoke.rs fix(proxy): PR-D1 native Bedrock InvokeModel route + SigV4 2026-05-03 16:22:32 -07:00
integration_bedrock_metrics.rs fix(proxy): PR-D3 Bedrock observability + auth-mode integration 2026-05-04 11:07:47 -07:00
integration_bedrock_streaming.rs fix(proxy): add native Bedrock converse-stream route (#917) 2026-06-12 17:18:43 -05:00
integration_body.rs test(rust): integration tests + wiremock harness (phase-1) 2026-04-24 15:52:31 -07:00
integration_body_size.rs fix: A8 — SSE delta arms, UTF-8 buffer, phase preservation, request-id, 413 2026-05-02 10:35:11 -07:00
integration_cache_control.rs fix(rust): A4 — honor cache_control markers; serde_json arbitrary_precision + raw_value 2026-05-02 08:22:10 -07:00
integration_cache_drift.rs fix: PR-E6 cache-bust drift detector telemetry (Phase E) 2026-05-04 14:54:20 -07:00
integration_chat_completions.rs fix: PR-E4 OpenAI prompt_cache_key auto-injection (Phase E) 2026-05-04 17:35:51 -07:00
integration_compression.rs fix: B3 — wire type-aware compressors into live-zone dispatcher 2026-05-02 13:52:18 -07:00
integration_conversations.rs fix: C4 — /v1/responses streaming + Conversations API in Rust 2026-05-03 00:14:55 -07:00
integration_e3_anthropic_cache_control.rs fix: PR-E3 Anthropic cache_control auto-placement (Phase E) 2026-05-04 16:34:04 -07:00
integration_e4_openai_cache_key.rs fix: PR-E4 OpenAI prompt_cache_key auto-injection (Phase E) 2026-05-04 17:35:51 -07:00
integration_headers.rs fix: A5 — strip x-headroom-* from upstream-bound headers (P5-49) 2026-05-02 09:35:27 -07:00
integration_health.rs test(rust): integration tests + wiremock harness (phase-1) 2026-04-24 15:52:31 -07:00
integration_http.rs test(rust): integration tests + wiremock harness (phase-1) 2026-04-24 15:52:31 -07:00
integration_metrics.rs fix(observability): G3 remediation — bound cardinality + wire dead metrics 2026-05-24 10:41:56 -07:00
integration_request_id.rs fix: A8 — SSE delta arms, UTF-8 buffer, phase preservation, request-id, 413 2026-05-02 10:35:11 -07:00
integration_responses.rs fix: PR-E4 OpenAI prompt_cache_key auto-injection (Phase E) 2026-05-04 17:35:51 -07:00
integration_responses_streaming.rs fix: PR-E4 OpenAI prompt_cache_key auto-injection (Phase E) 2026-05-04 17:35:51 -07:00
integration_schema_sort.rs fix: PR-E2 recursive JSON Schema key sort (Phase E) 2026-05-05 15:36:32 -07:00
integration_sse.rs test(rust): integration tests + wiremock harness (phase-1) 2026-04-24 15:52:31 -07:00
integration_tool_sort.rs fix: PR-E1 tool array deterministic sort (Phase E) 2026-05-05 15:35:27 -07:00
integration_vertex_raw_predict.rs fix(proxy): PR-D4 native Vertex publisher path + ADC bearer auth 2026-05-04 16:24:38 -07:00
integration_volatile_detector.rs fix: PR-E5 volatile-content detector + customer warning (Phase E) 2026-05-04 12:40:27 -07:00
integration_ws.rs test(rust): integration tests + wiremock harness (phase-1) 2026-04-24 15:52:31 -07:00
sse_anthropic.rs fix: C1 — byte-level SSE parser + state machines 2026-05-02 21:12:41 -07:00
sse_framing.rs fix: stabilize codex compression, stats, and proxy lifecycle 2026-05-09 13:47:53 -07:00
sse_openai_chat.rs fix: C1 — byte-level SSE parser + state machines 2026-05-02 21:12:41 -07:00
sse_openai_responses.rs fix: C4 — /v1/responses streaming + Conversations API in Rust 2026-05-03 00:14:55 -07:00