Skip to content

feat: transport extensions#37

Merged
WendelHime merged 7 commits into
mainfrom
feat/transport-extensions
Jun 3, 2026
Merged

feat: transport extensions#37
WendelHime merged 7 commits into
mainfrom
feat/transport-extensions

Conversation

@WendelHime
Copy link
Copy Markdown
Contributor

Slow transports (e.g. DNSTT over DNS with 135-byte MTU) need more time to complete a single request than the race transport's default budget. A TLS handshake over a DNS tunnel can take 30-60 seconds, and a small POST body adds more. The fixed 80s (GET) / 3min (POST) timeout killed requests before the tunnel could finish.
Similarly, transports need to declare a maximum body size so the race transport can skip them for oversized payloads (e.g. 1.4MB issue report protobufs through a DNS tunnel).

Add RequestTimeout() to the Transport interface so slow transports
(like DNSTT at 135-byte MTU) can request a longer time budget from
the race transport. Default (0) keeps existing behaviour.

namedTransport stores and preserves the value through
ReplaceTransport. WithDNSTunnel uses a type assertion to extract
the timeout from the underlying DNSTT instance if it provides one.
Allows DNSTT transports to set a body size cap that the race transport
uses to skip the transport for oversized requests (same pattern as AMP's
6000-byte limit). Type-asserts the optional MaxLength() int interface
on the underlying DNSTT transport.
Adds reqTimeout field to mockTransport and two test cases:
- TransportOverridesBase: a transport's 5-min timeout beats the 80s GET default
- TakesMaxAcrossTransports: max of {2min, 5min, 3min} = 5min for POST body
@WendelHime WendelHime marked this pull request as ready for review June 2, 2026 19:58
Copilot AI review requested due to automatic review settings June 2, 2026 19:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends Kindling transports so the race transport can (a) increase its per-request timeout budget for slow transports and (b) better accommodate transports that need to declare constraints (notably around request body size/time).

Changes:

  • Adds RequestTimeout() time.Duration to the exported Transport interface and threads this through raceTransport timeout budgeting.
  • Updates race transport timeout logic/tests to account for transport-provided timeout overrides.
  • Extends WithDNSTunnel to pick up optional RequestTimeout() and MaxLength() capabilities from the provided DNSTT implementation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
race_transport.go Uses a transport-aware request timeout budget for the race context deadline.
race_transport_test.go Extends the test transport and adds coverage for timeout override/max selection.
kindling.go Extends the public Transport interface with RequestTimeout and plumbs timeout through transport wrappers (including DNSTT).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kindling.go
Comment thread kindling.go
Comment thread race_transport_test.go Outdated
Comment thread kindling.go Outdated
Comment thread race_transport.go Outdated
Comment thread kindling.go
Align RequestTimeout doc comment with actual behavior (body-based
not method-based). Align requestTimeout doc comment with
implementation (all configured transports, not just eligible).
Normalize gofmt spacing in kindling.go and race_transport_test.go.
Adds TestWithDNSTunnelOverrides with stubDNSTT mock. Verifies:
- Defaults: no override → RequestTimeout and MaxLength both 0
- RequestTimeout: 5-minute value propagates to namedTransport
- MaxLength: 10000 value propagates to namedTransport
- Both: both overrides propagate together
@WendelHime WendelHime requested a review from garmr-ulfr June 2, 2026 20:10
Copy link
Copy Markdown
Contributor

@garmr-ulfr garmr-ulfr left a comment

Choose a reason for hiding this comment

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

Just one comment, otherwise LGTM.

Comment thread race_transport.go Outdated
WendelHime and others added 2 commits June 3, 2026 10:39
Compute the race budget after filterTransports and over only the
eligible transports, so a transport dropped for this request (by
MaxLength/IsStreamable) no longer inflates the timeout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@WendelHime WendelHime merged commit 3bab85a into main Jun 3, 2026
1 check 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.

3 participants