Skip to content

feat(core): add automatic retry with exponential backoff#2

Merged
AllyMurray merged 2 commits intoAllyMurray:mainfrom
Andrchiamus:feat/retry
Feb 16, 2026
Merged

feat(core): add automatic retry with exponential backoff#2
AllyMurray merged 2 commits intoAllyMurray:mainfrom
Andrchiamus:feat/retry

Conversation

@Andrchiamus
Copy link

Summary

  • Add opt-in automatic retry with exponential backoff and jitter for transient failures (network errors, 429, 5xx)
  • Configurable at both constructor and per-request level with RetryOptions interface
  • Respects Retry-After header as delay floor, re-runs interceptors on each attempt
  • 35 new tests with 100% coverage maintained

Files Changed

File Change
packages/core/src/http-client/http-client.ts RetryOptions/RetryContext types, retry loop in get(), private helpers
packages/core/src/types/http-client.ts Add retry option to HttpClientContract.get()
packages/core/src/http-client/http-client.test.ts 35 new retry tests across 7 describe blocks
docs-site/src/content/docs/guides/retries.mdx New retry guide
docs-site/astro.config.mjs Add retries to sidebar
docs-site/src/content/docs/api/http-client.mdx Add retry to options tables
.changeset/add-retry-feature.md Minor changeset for core

Test plan

  • pnpm build — all packages build cleanly
  • pnpm test — 256 tests pass (223 existing + 35 new)
  • pnpm lint — no lint errors
  • pnpm test:coverage — 100% coverage maintained
  • Verify retry behavior with real HTTP endpoints (manual)

🤖 Generated with Claude Code

Andrew Carmichael and others added 2 commits February 14, 2026 15:10
Add opt-in retry mechanism for transient failures (network errors,
429, 5xx) with configurable exponential backoff and jitter.

- RetryOptions/RetryContext types with constructor + per-request config
- Retry loop wraps fetch block inside get() with full interceptor re-run
- Respects Retry-After header as delay floor
- Custom retryCondition/onRetry callbacks
- 100% test coverage maintained (35 new tests)
- New retries.mdx guide, updated API docs and sidebar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move RetryOptions/RetryContext/HttpErrorContext to types/ to fix
  circular import between types/ and http-client/
- Extract executeFetch() private method from get() to reduce nesting
  and eliminate definite assignment assertions
- Re-check enforceServerCooldown() between retry attempts
- Return RetryContext from isRetryableRequest to deduplicate construction
- Add nock.cleanAll/vi.restoreAllMocks to test setup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AllyMurray AllyMurray merged commit 65eeb40 into AllyMurray:main Feb 16, 2026
1 check 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