Skip to content

use TryWriteAll for close session capsules - #348

Open
marten-seemann wants to merge 1 commit into
masterfrom
close-capsule-trywriteall
Open

use TryWriteAll for close session capsules#348
marten-seemann wants to merge 1 commit into
masterfrom
close-capsule-trywriteall

Conversation

@marten-seemann

@marten-seemann marten-seemann commented Jul 26, 2026

Copy link
Copy Markdown
Member

Blocked on the quic-go v0.62.0 release.

Note

Use TryWriteAll for writing close session capsules in closeSessionStream

Replaces the write deadline + Write pattern in closeSessionStream with a call to str.TryWriteAll when sending close capsules. Also updates the http3Stream interface to include TryWriteAll([]byte) error and bumps github.com/quic-go/quic-go to a pre-release version that exposes this method.

Macroscope summarized 7a002c3.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability when closing sessions by ensuring the close signal is sent promptly.
    • Added safer handling when the session close signal cannot be written, including appropriate stream cancellation.
  • Maintenance

    • Updated the QUIC transport dependency to a newer version.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.93%. Comparing base (a20ecd3) to head (7a002c3).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #348      +/-   ##
==========================================
- Coverage   72.36%   71.93%   -0.43%     
==========================================
  Files          15       15              
  Lines        1715     1714       -1     
==========================================
- Hits         1241     1233       -8     
- Misses        375      382       +7     
  Partials       99       99              

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

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The quic-go dependency is updated, http3Stream gains TryWriteAll, and session closure uses it to send WT_CLOSE_SESSION. The session test mock implements the new method.

Changes

Session close write behavior

Layer / File(s) Summary
TryWriteAll session shutdown
go.mod, session.go, session_test.go
The quic-go dependency is updated, http3Stream requires TryWriteAll, closeSessionStream uses it for the close capsule, and the test mock implements the method.

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

🚥 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 accurately summarizes the main change: using TryWriteAll when sending close-session capsules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch close-capsule-trywriteall
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch close-capsule-trywriteall

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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.

🧹 Nitpick comments (1)
session_test.go (1)

34-34: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Exercise the new write behavior in tests.

The no-op mock only satisfies the interface; it cannot verify the capsule bytes or the error path that triggers CancelWrite. Add a recording/error-injectable mock covering both successful and failed TryWriteAll calls.

🤖 Prompt for 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.

In `@session_test.go` at line 34, Add a recording, error-injectable mock
implementation for mockHTTP3Stream.TryWriteAll that captures written capsule
bytes and can return a configured error. Update the relevant tests to assert the
successful write payload and verify the failed-write path triggers CancelWrite,
while preserving the existing interface behavior.
🤖 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.

Nitpick comments:
In `@session_test.go`:
- Line 34: Add a recording, error-injectable mock implementation for
mockHTTP3Stream.TryWriteAll that captures written capsule bytes and can return a
configured error. Update the relevant tests to assert the successful write
payload and verify the failed-write path triggers CancelWrite, while preserving
the existing interface behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f3ddee7-ab51-473e-a190-0eb0b7bd2a45

📥 Commits

Reviewing files that changed from the base of the PR and between a20ecd3 and 7a002c3.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • go.mod
  • session.go
  • session_test.go

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant