Spork: add bounded retry policy for transient step-content download failures#301
Conversation
|
|
일시적 실패 재시도 로직의 분류 정확도를 높이고, "재시도하지 않을 종류가 실제로 재시도되지 않는지"를 루프 동작 수준까지 검증한다. 분류기(StepsPlayer.IsTransientDownloadException) - 소켓 수준 오류를 명시적으로 처리: 래핑되지 않은 SocketException도 일시적으로 취급 (HttpClient는 보통 HttpRequestException[StatusCode 없음]/IOException으로 래핑하지만, 다른 다운로드 계층 대비). - 상태 코드 기준 실패 판정을 정밀화: 기존 "모든 5xx 재시도"에서 재시도 대상 코드만 선별(408/429/500/502/503/504). 501(Not Implemented)·505 등 영구성 5xx는 재시도하지 않고 즉시 실패로 건너뛴다(IsRetryableStatusCode 헬퍼로 분리). 테스트(Spork.Test) - StepsPlayerSocketFailureTests: 순수 SocketException 6종(리셋/거부/중단/타임아웃/ 도달불가/DNS) + 래핑 형태가 재시도 대상으로 분류되는지 검증. - StepsPlayerStatusCodeClassificationTests: 재시도 대상 vs 건너뜀(4xx + 영구성 5xx) 상태 코드, 그리고 비일시적 예외 타입이 건너뛰어지는지 검증. - StepsPlayerRetryLoopTests: 실제 재시도 루프 시도 횟수 검증 — 영구성 코드/비일시적 예외는 1회(재시도 없음), 일시적 오류는 최대 3회, 중간 성공 시 즉시 중단. 빌드 경고 0, Spork.Test 42개 통과. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a bounded retry policy to Spork step-content downloading so transient network/IO failures don’t fail fast, and introduces targeted unit tests to validate transient classification + retry-loop behavior.
Changes:
- Route
StepsPlayer.DownloadContentAsyncthrough a new retry wrapper with fixed backoff delays (1s, then 3s; max 3 total attempts). - Add centralized transient-failure detection (
IsTransientDownloadException+ status code classification). - Add unit tests covering retryable/non-retryable status codes, socket/IO-level failures, and retry-loop attempt counts.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Spork.App/Steps/Implementations/StepsPlayer.cs | Implements retry loop + transient exception/status-code classification for step content downloads. |
| src/Spork.Test/StepsPlayerRetryLoopTests.cs | Verifies retry loop attempt limits and stop-on-success behavior. |
| src/Spork.Test/StepsPlayerStatusCodeClassificationTests.cs | Tests HTTP status code-based transient classification. |
| src/Spork.Test/StepsPlayerSocketFailureTests.cs | Tests socket/IO failure classification including inner-exception recursion. |
| src/Spork.Test/StepsPlayerTransientDownloadTests.cs | Adds basic transient classification tests for a few representative exception types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [TestClass] | ||
| public class StepsPlayerRetryLoopTests |
Step-content downloads in Spork currently fail fast on transient network conditions. This change adds bounded retries with jitter-free fixed backoff aligned to the requirement: up to 2 extra attempts after the first try, waiting 1s then 3s.
Retry orchestration in download stage
StepsPlayer.DownloadContentAsyncnow routes content fetches through a retry wrapper.initial + 2 retries) with delays[1s, 3s].Transient error classification
StepsPlayer:HttpRequestExceptionwith408,429, or5xxTaskCanceledException,TimeoutException,IOExceptionCancellation behavior
OperationCanceledExceptionis propagated directly (no retry), including during retry-delay windows.Targeted unit coverage