Repository navigation
fix: keep the default HTTP transport compatible with OPA - #42
Merged
Merged
Conversation
configureProcess replaced the global http.DefaultTransport with the BackoffTransport/OriginTransport wrapper so every strategy shared 429 cooldowns and origin metrics. OPA's http.send asserts http.DefaultTransport.(*http.Transport) whenever a policy sets a TLS option such as tls_ca_cert_file, so every policy evaluation that reached http.send panicked with "interface conversion: http.RoundTripper is *httputil.BackoffTransport, not *http.Transport" and net/http dropped the client connection. Install the wrapper through httputil.SetUpstreamTransport instead, and give every client that relied on the default transport or http.DefaultClient the shared transport explicitly via httputil.UpstreamTransport / httputil.UpstreamClient. Until a transport is installed the accessor forwards to the live http.DefaultTransport, so tests that swap the global to intercept upstream traffic keep working. The regression test runs a real http.send with tls_ca_cert_file after configureProcess in a child process; it fails with the panic above on the previous code. Co-authored-by: Perplexity <noreply@perplexity.ai> Signed-off-by: dgilman-perplexity <293900578+dgilman-perplexity@users.noreply.github.com> (cherry picked from commit c5d94a3)
Keep GitHub object batches and Socket policy requests on the shared upstream transport after the global default is restored. Exercise the real client wiring so cooldown and instrumentation coverage cannot silently disappear. Co-authored-by: Perplexity <noreply@perplexity.ai>
ravi-pplx
marked this pull request as ready for review
November 14, 2026 01:49
Prune the unreachable commit so the mirror cannot serve it locally, and use an independent client so the request cannot bypass the handler. Verify the forwarded method, path and body, the upstream response, and exactly one fallback request. Co-authored-by: Perplexity <noreply@perplexity.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OPA's TLS-enabled
http.sendpanics when Cachew replaceshttp.DefaultTransportwith its backoff wrapper.Ports block/cachew#449, keeping the default transport intact and wiring upstream clients explicitly. Adapts the patch to retain zero-backoff behavior and shared transport coverage for GitHub object batches and Socket policy requests.
Created with Perplexity