Skip to content

test(core): add comprehensive RetryManager test suite#1159

Open
abueide wants to merge 4 commits intotapi/retry-managerfrom
tapi/retry-manager-tests
Open

test(core): add comprehensive RetryManager test suite#1159
abueide wants to merge 4 commits intotapi/retry-managerfrom
tapi/retry-manager-tests

Conversation

@abueide
Copy link
Contributor

@abueide abueide commented Mar 10, 2026

Summary

  • Add comprehensive RetryManager test suite covering all states and transitions
  • 38 tests total, all passing:
    • canRetry: READY/RATE_LIMITED/BACKING_OFF states, wait expiry transitions, disabled configs
    • handle429: retry count, lazy consolidation, clamping, negative/zero retry-after, max count/duration limits with limit_exceeded return verification, 429-overrides-BACKING_OFF, Retry-After authority
    • handleTransientError: retry count, exponential backoff, max backoff clamping, max count/duration limits with limit_exceeded return verification
    • reset: count and state reset
    • retryStrategy: lazy (default), eager, applies to transient errors
    • autoFlush: timer fires, no-callback safety, clear on reset/destroy, timer replacement
    • return values: undefined when configs disabled
    • jitter: additive jitter formula with non-zero jitterPercent, zero jitter adds no randomness
    • isPersistedStateValid: clock skew detection (firstFailureTime in future)
    • mixed errors: 429 wait time takes precedence over shorter transient backoff

PR 4 of 5 in the TAPI backoff/retry stack. Depends on #1158.

Test plan

  • All 38 RetryManager tests pass
  • All 454 total tests pass

🤖 Generated with Claude Code

@abueide abueide force-pushed the tapi/retry-manager branch 2 times, most recently from 3371651 to 0c85b0f Compare March 12, 2026 14:57
@abueide abueide force-pushed the tapi/retry-manager-tests branch 2 times, most recently from ba89956 to aac6169 Compare March 12, 2026 14:57
@abueide abueide force-pushed the tapi/retry-manager branch from 0c85b0f to 8f21c88 Compare March 12, 2026 15:30
@abueide abueide force-pushed the tapi/retry-manager-tests branch from aac6169 to cf2abd2 Compare March 12, 2026 15:36
@abueide abueide force-pushed the tapi/retry-manager branch from 8f21c88 to 225e64a Compare March 12, 2026 16:11
@abueide abueide force-pushed the tapi/retry-manager-tests branch from cf2abd2 to 23ae940 Compare March 12, 2026 16:11
@abueide abueide force-pushed the tapi/retry-manager branch from 225e64a to f51911b Compare March 12, 2026 16:40
@abueide abueide force-pushed the tapi/retry-manager-tests branch from 23ae940 to 9f2575b Compare March 12, 2026 16:40
@abueide abueide force-pushed the tapi/retry-manager branch from f51911b to fcdc491 Compare March 12, 2026 16:48
@abueide abueide force-pushed the tapi/retry-manager-tests branch from 9f2575b to 6981059 Compare March 12, 2026 16:48
abueide and others added 4 commits March 12, 2026 12:38
Add 29 tests covering all RetryManager states and transitions:
canRetry, handle429 rate limiting, handleTransientError backoff,
reset, retry strategies (eager/lazy), autoFlush callbacks, and
mixed error scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updated test to verify that 429 now correctly overrides BACKING_OFF state
rather than being silently ignored. The 429's retry-after takes precedence.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add test verifying 429 Retry-After overrides long transient backoff
- Track RetryManager instances in autoFlush tests and destroy in
  afterEach to prevent timer leaks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update log assertions for consolidated limit-exceeded message. Add tests
for: RetryResult return values, jitter calculation, isPersistedStateValid
clock skew detection, handle429(0) edge case, and strengthened assertions
that verify behavioral state after clamping/rejection (not just log output).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@abueide abueide force-pushed the tapi/retry-manager branch from fcdc491 to a8c9435 Compare March 12, 2026 17:38
@abueide abueide force-pushed the tapi/retry-manager-tests branch from 6981059 to c49e640 Compare March 12, 2026 17:38
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.

1 participant