Skip to content

Make retry implementation compliant with SEP spec#1188

Merged
sugmanue merged 2 commits into
smithy-lang:mainfrom
sugmanue:sugmanue/validate-sep-retry
May 19, 2026
Merged

Make retry implementation compliant with SEP spec#1188
sugmanue merged 2 commits into
smithy-lang:mainfrom
sugmanue:sugmanue/validate-sep-retry

Conversation

@sugmanue
Copy link
Copy Markdown
Contributor

Description of changes:

Changes made to the original implementation of retries to make sure it's compliant with the retries SEP.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

sugmanue added 2 commits May 18, 2026 20:45
- Add throttling-specific backoff base delay (1000ms) per SEP requirement
  that throttling errors use x=1 vs x=0.05 for non-throttling errors
- Use x-amz-retry-after header (integer ms) instead of standard Retry-After
  header, which the SEP says MUST be ignored
- Add upper bound clamping (5s + t_i) for x-amz-retry-after suggested delay
- Fix long-polling: backoff then return error when quota exhausted instead
  of retrying without cost
- Change jitter from nextInt(bound) to nextDouble()*delay for precise SEP
  formula compliance (t_i = b * min(x * r^i, MAX_BACKOFF) where b in [0,1])
- Refactor CUBIC functions to use shared static methods
- Add SEP Appendix A test cases for standard mode and CUBIC calculations
@sugmanue sugmanue requested a review from mtdowling May 19, 2026 17:57
}
return maxOf(suggested, backoff);
// Clamp suggested delay: min bound is t_i, max bound is 5s + t_i
var maxBound = backoff.plus(Duration.ofSeconds(5));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit - might be nice to make 5 a constant so it's easier to know about in the future

@sugmanue sugmanue merged commit b7970aa into smithy-lang:main May 19, 2026
3 checks 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.

2 participants