Skip to content

feat(net): hyper leaf buffering (BufferMode::Buffer arm)#92

Merged
NotAProfDev merged 4 commits into
mainfrom
feat/net-http-hyper-buffer
Jul 5, 2026
Merged

feat(net): hyper leaf buffering (BufferMode::Buffer arm)#92
NotAProfDev merged 4 commits into
mainfrom
feat/net-http-hyper-buffer

Conversation

@NotAProfDev

@NotAProfDev NotAProfDev commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Closes #91. Second and final PR of the hyper-backend slice (PR A was #90).

Adds the `BufferMode::Buffer` branch to `HyperLeaf::call`: when a request carries a `BufferMode::Buffer` extension, the leaf collects the `Incoming` response body into `Bytes` inside the retry boundary (mapping the collect error with the same `map_hyper_err` as the streaming arm) and returns `ResponseBody::buffered`. The default (no extension) and explicit `BufferMode::Stream` keep the PR A streaming arm unchanged.

Additive only — no change to `type Response`/`type Error`/`HyperBody`/`ConnConfig`/`hyper_leaf`/`build()` or any resilience layer.

Commits:

  • `feat(net): hyper leaf BufferMode::Buffer arm`
  • `docs(net): changelog + module doc for hyper leaf buffering`
  • `test(net): buffered error path surfaces from call()`

Tests: buffered request → `Buffered` arm carrying exact bytes; default + explicit `Stream` → `Streaming` arm; buffered mid-body failure surfaces as `Err(HttpError::Other)` from `call()` (proving retry coverage). `just ci` + `just msrv` green.

Design: docs/superpowers/specs/2026-07-05-net-http-hyper-backend-design.md
Plan: docs/superpowers/plans/2026-07-05-net-http-hyper-backend-pr-b.md

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • The net-http hyper backend now honors per-request BufferMode to control response buffering.
    • Requests that set BufferMode::Buffer receive an eagerly buffered response body; otherwise responses remain streamed.
  • Bug Fixes

    • Truncated buffered responses now fail immediately during the request call (not later during body collection).
    • Added test coverage to verify buffered vs. streaming behavior, including explicit streaming mode.

NotAProfDev and others added 3 commits July 5, 2026 17:03
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Records PR B (BufferMode::Buffer arm, landed in 805437b) in the
CHANGELOG, and refreshes the hyper leaf module doc which still said
buffering was future work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover the BufferMode::Buffer branch that collects the body inside
call() itself, so a mid-body failure returns Err from call() (and not
only from the later body-collect) — the property Retry depends on to
re-drive the whole request.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 71b6c341-fadd-4491-947f-f321a7e1a5e2

📥 Commits

Reviewing files that changed from the base of the PR and between 82cf13a and 66fc35b.

📒 Files selected for processing (1)
  • CHANGELOG.md
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

The hyper backend’s Service::call now reads BufferMode from request extensions to choose buffered or streaming response-body handling. Tests cover buffered, streaming, and truncated-body cases, and the changelog records the behavior.

Changes

BufferMode-driven Response Handling

Layer / File(s) Summary
BufferMode branching in Service::call
crates/adapter/net/http/hyper/src/leaf.rs
Service::call reads BufferMode from request extensions (defaulting to Stream) and returns either a buffered or streaming ResponseBody; updated imports and doc comments reflect the new behavior.
Tests for buffering and streaming behavior
crates/adapter/net/http/hyper/src/leaf.rs
New tests verify Buffer yields ResponseBody::Buffered with correct bytes, absent/Stream yields ResponseBody::Streaming, and truncated bodies under Buffer fail during call() itself.
Changelog documentation
CHANGELOG.md
Documents the new per-request BufferMode buffering behavior as additive with no API/type changes.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • NotAProfDev/oath#60: Introduced the BufferMode/ResponseBody contract API that this PR's hyper leaf now consumes.

Suggested labels: enhancement

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the BufferMode::Buffer hyper leaf change.
Linked Issues check ✅ Passed The changes implement #91: buffered handling for BufferMode::Buffer, while preserving default and Stream streaming behavior.
Out of Scope Changes check ✅ Passed The doc and test updates support the requested hyper leaf buffering work and do not appear unrelated to #91.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/net-http-hyper-buffer

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Around line 114-118: Replace the unresolved PR placeholder in the changelog
entry with the actual pull request number or link. Update the `CHANGELOG.md`
entry for the net-http hyper backend note so the `(#<PR-B>)` reference uses the
real PR identifier, keeping the rest of the `ResponseBody::buffered` description
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: da42b682-b6d6-4d46-a397-7904db2663ae

📥 Commits

Reviewing files that changed from the base of the PR and between d789c07 and 82cf13a.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • crates/adapter/net/http/hyper/src/leaf.rs

Comment thread CHANGELOG.md Outdated
@NotAProfDev NotAProfDev merged commit 5757100 into main Jul 5, 2026
5 checks passed
@NotAProfDev NotAProfDev deleted the feat/net-http-hyper-buffer branch July 5, 2026 17:30
NotAProfDev added a commit that referenced this pull request Jul 8, 2026
* docs(net): track the PR-B buffering plan (missed in #92)

* Merge branch 'main' into docs/track-pr-b-plan
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.

feat(net): hyper leaf buffering — BufferMode::Buffer arm (Slice, PR B)

1 participant