Skip to content

fix(client): precisely capture raw response streams - #85

Merged
lightsofapollo merged 4 commits into
gpu-cli:mainfrom
adriendellagaspera:fix/raw-stream-precise-capture
Sep 28, 2026
Merged

lightsofapollo merged 4 commits into
gpu-cli:mainfrom
adriendellagaspera:fix/raw-stream-precise-capture

Conversation

@adriendellagaspera

@adriendellagaspera adriendellagaspera commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Raw SSE/live response methods can return an opaque stream that implicitly captures the receiver and borrowed request inputs under Rust 2024 lifetime-capture rules. Downstream consumers therefore cannot prove that the stream is independently owned after the async call resolves.

Reuse the existing precise-capture request-parameter path for every raw response stream and emit:

impl futures_util::Stream<Item = Result<bytes::Bytes, reqwest::Error>>
    + 'static
    + use<...>

The capture list still includes the generic type parameters required by the hidden type; the explicit 'static bound proves the returned stream does not borrow request inputs or &self.

Generated compatibility

  • Generated model or method signatures:
    • Raw SSE/live-stream return types gain explicit 'static + use<...> bounds.
    • Request parameters used by the hidden opaque type may be emitted through the existing generic impl AsRef<str> capture path.
    • No model shapes change.

Validation

  • Added or updated a focused fixture and behavioral regression test.
  • Reviewed every changed snapshot; no unrelated churn is included.
  • cargo fmt --check
  • cargo clippy --all-features -- -D warnings
  • cargo test --all-features
  • Ran scripts/install-smoke.sh for packaging/dependency changes.
  • Ran a targeted or full scripts/spec-compile.sh for generator changes.
  • Updated README, rustdoc, or changelog for user-visible behavior.

The regression test generates an SSE-only operation with a borrowed query parameter and requires the returned stream to be boxable as an owned 'static stream after the async request resolves.

The corpus manifest was refreshed for the resulting signature-only changes.

Notes for reviewers

The smallest useful review path is:

  • src/client_generator.rs: two small changes make all raw response streams use precise capture and add the explicit 'static bound.
  • tests/client_transport_variants_test.rs: the focused Rust 2024 regression demonstrating that the returned stream no longer borrows request inputs.
  • tests/corpus-manifest.txt: expected signature-only corpus updates.

There is no intended change to HTTP behavior, response parsing, request serialization, generated models, dependencies, or configuration semantics.

@vercel

vercel Bot commented Sep 27, 2026

Copy link
Copy Markdown

@adriendellagaspera is attempting to deploy a commit to the lbl-rd Team on Vercel.

A member of the Team first needs to authorize it.

@lightsofapollo
lightsofapollo merged commit 7d2c2a8 into gpu-cli:main Sep 28, 2026
12 of 13 checks passed
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