Skip to content

Back off between live FedEx sandbox retries - #10

Closed
freshlogic wants to merge 2 commits into
mainfrom
fix-sandbox-503-retry-backoff
Closed

Back off between live FedEx sandbox retries#10
freshlogic wants to merge 2 commits into
mainfrom
fix-sandbox-503-retry-backoff

Conversation

@freshlogic

Copy link
Copy Markdown
Member

Summary

  • The live sandbox tests use async.retry with default options — 5 attempts at a zero interval.
  • On 2026-07-25 the FedEx sandbox returned 503 SERVICE.UNAVAILABLE.ERROR for the SMART_POST rate request. All 5 attempts fired inside the same ~15s outage window (15563ms ÷ 5 ≈ 3.1s each), so the retry was decorative and main went red.
  • Adds an exponential interval (2s, 4s, 8s across 4 attempts).

Root cause

Not a code defect and not a permanently-broken sandbox: should return rate quotes for a SmartPost shipment passed in 1792ms (run 28098919820) and 2307ms (run 26487320976) on the two prior green runs, so SMART_POST is provisioned and working. The 503 was a transient vendor outage that the zero-interval retry could not survive.

The startup_failure currently showing on main is a separate artifact — attempts 1 and 2 of run 30162824011 were genuine failures, and the run was subsequently re-run up to attempt: 50 by the CI watcher routine, which is what produced the startup_failure state.

Test plan

  • Verified against a local server that 503s for a fixed 5-second window (modelling a time-based outage rather than a request-count one):
    • default (times:5, interval:0)FAIL, 5 attempts in 24ms
    • new (times:4, backoff)PASS, 3 attempts over 6008ms
  • npx eslint . clean
  • Local suite failing-test set is byte-identical before and after the change (all remaining local failures are FEDEX_* credential-driven and pass in CI)
  • CI passes on this PR

Healthy runs incur no delay — backoff only applies after a failed attempt.

🤖 Generated with Claude Code

freshlogic and others added 2 commits July 27, 2026 10:50
The live sandbox tests wrap their calls in async.retry, but with default options: five
attempts at a zero interval. On 2026-07-25 the sandbox answered 503
SERVICE.UNAVAILABLE.ERROR for a SMART_POST rate request and all five attempts landed
inside the same ~15s outage window (test/index.js:645), so the retry bought nothing and
main went red. The test itself is sound — it passed in 1.8s and 2.3s on the two prior
green runs.

Give async.retry an exponential interval (2s, 4s, 8s over four attempts) so a short
vendor blip is actually ridden out. Verified against a local server that 503s for a fixed
5s window: the default config fails after burning five attempts in 24ms, the new config
passes on attempt three. Healthy runs are unaffected — the backoff only applies after a
failed attempt.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…bin.org

The non-200 access-token test pointed at https://httpbin.org/status/500, which is
unreliable: it answered in 20886ms on run 30162824011 and returned '503 Service
Temporarily Unavailable' rather than a 500 on run 30281894500, failing the /^500/
assertion. That is the same third-party dependency that turned dhl-ecommerce-solutions
red.

Stand up a throwaway node:http server answering 500 for the duration of the test. The
assertions are unchanged and the test now runs in 33ms without network access.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 30282039568

Warning

No base build found for commit c74e66a on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 100.0%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 324
Covered Lines: 324
Line Coverage: 100.0%
Relevant Branches: 50
Covered Branches: 50
Branch Coverage: 100.0%
Branches in Coverage %: Yes
Coverage Strength: 16.95 hits per line

💛 - Coveralls

@freshlogic freshlogic closed this Jul 27, 2026
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