Repository navigation
Retry SDK resolve requests - #1152
Draft
jonathan-conder wants to merge 1 commit into
Draft
jonathan-conder wants to merge 1 commit into
jonathan-conder wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The retry test leaves the successful response empty and discards the returned result, so it cannot detect a regression that returns an empty SDK list after a successful retry.
1 open issue
1 file not reviewed
internal/sdkstore/clock_mock_test.go: Generated file
What changed in this PR
This PR makes SDK resolution more resilient to transient network timeouts by explicitly retrying the store’s read-only POST requests.
Changes:
- Add bounded, context-aware retries to SDK resolution.
- Share network-error classification while preserving safe-method restrictions in HTTP middleware.
- Add a timeout-retry test and a generated clock mock.
| File | Description |
|---|---|
internal/sdkstore/resolve.go |
Retry transient network failures with fresh response state per attempt. |
internal/sdkstore/resolve_test.go |
Test successful resolution after a timeout. |
internal/sdkstore/package_test.go |
Add the clock mock generation directive. |
internal/sdkstore/clock_mock_test.go |
Provide a generated clock mock for retry tests. |
internal/https/middleware.go |
Export network-error classification for reuse by SDK resolution. |
Review effort: Balanced
Comment on lines
+84
to
+99
| gomock.InOrder( | ||
| restClient.EXPECT().Post(gomock.Any(), p, gomock.Any(), gomock.Any(), gomock.Any()).Return(restResponse{}, timeoutError{}), | ||
| restClient.EXPECT().Post(gomock.Any(), p, gomock.Any(), gomock.Any(), gomock.Any()).Return(restResponse{}, nil), | ||
| ) | ||
|
|
||
| clockMock := NewMockClock(ctrl) | ||
| ch := make(chan time.Time, 1) | ||
| ch <- time.Now() | ||
| clockMock.EXPECT().Now().Return(time.Now()).AnyTimes() | ||
| clockMock.EXPECT().After(defaultRetryDelay).Return(ch).Times(1) | ||
|
|
||
| client := newResolveClient(p, restClient) | ||
| client.clock = clockMock | ||
|
|
||
| _, err := client.Resolve(context.Background(), transport.ResolveRequest{}) | ||
| c.Assert(err, check.IsNil) |
In CI I often see errors like this: `Post "https://api.pkg.store/v2/revisions/resolve": net/http: TLS handshake timeout`. This API happens to be a POST request even though it doesn't change anything on the server side. So it should be safe to retry when there's a potentially transient error.
jonathan-conder
force-pushed
the
fix/store-tls-handshake-timeout
branch
from
November 12, 2026 07:43
0b186e0 to
c23ec72
Compare
This branch has not been deployed
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.

Description
In CI I often see errors like this:
Post "https://api.pkg.store/v2/revisions/resolve": net/http: TLS handshake timeout.This API happens to be a POST request even though it doesn't change anything on the server side. So it should be safe to retry when there's a potentially transient error.
Self-review quick check
Docs
Procedure:
Content:
tutorial/andhow-to/sections).docs/.coverage.yamlupdated, coverage tags added (.. artefact).Or: