client: surface last-response details after retries are exhausted#2796
Merged
bobcallaway merged 1 commit intosigstore:mainfrom Apr 22, 2026
Merged
client: surface last-response details after retries are exhausted#2796bobcallaway merged 1 commit intosigstore:mainfrom
bobcallaway merged 1 commit intosigstore:mainfrom
Conversation
When retryablehttp exhausts retries, its default failure message is just "<METHOD> <URL> giving up after N attempt(s)". If the final failure was a transport error that detail survives via %w wrapping, but if the server returned a non-retryable error response (e.g. 5xx with a body explaining the failure) the response is drained and discarded, so users see no root cause — the exact scenario sigstore#2640 describes. Install a custom retryablehttp.ErrorHandler that includes: * the wrapped error when a transport error is present * the final status code and a bounded body snippet when the response is available Adds TestRetryErrorHandlerSurfacesServerResponse asserting that a run against a server returning 500 with body "database unavailable" produces an error containing both "status 500" and the body text. Fixes sigstore#2640 Signed-off-by: Ali <alliasgher123@gmail.com>
bobcallaway
approved these changes
Apr 22, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2796 +/- ##
===========================================
- Coverage 66.46% 25.22% -41.24%
===========================================
Files 92 191 +99
Lines 9258 25382 +16124
===========================================
+ Hits 6153 6402 +249
- Misses 2359 18151 +15792
- Partials 746 829 +83
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
When retryablehttp exhausts retries, its default failure message is just:
If the last failure was a transport error the detail survives via
%wwrapping, but if the server returned a non-retryable error response (e.g. 5xx with a body explaining the problem), retryablehttp drains and discards the body — users see no root cause. That's the exact scenario reported in #2640.This PR installs a custom
retryablehttp.ErrorHandleron the Rekor client so the final error includes:Fixes #2640
Test plan
go test ./pkg/client/gofmtcleanTestRetryErrorHandlerSurfacesServerResponse: runs the client against a test server returning500+ body"database unavailable"; asserts the final error contains bothstatus 500and the body text.Signed-off-by: Ali alliasgher123@gmail.com