Skip to content

feat: commercetools-aligned per-method retry defaults for mutations - #325

Merged
machnicki merged 2 commits into
mainfrom
feat/DRO-32231
Jun 17, 2026
Merged

feat: commercetools-aligned per-method retry defaults for mutations#325
machnicki merged 2 commits into
mainfrom
feat/DRO-32231

Conversation

@machnicki

@machnicki machnicki commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

POST/PATCH/DELETE mutations are no longer retried on ECONNABORTED/ETIMEDOUT or 500 by default — commercetools may have already processed the mutation server-side. Gateway errors (502/503/504) are still retried as the LB rejected the request before forwarding to commercetools.

Changes:

  • types.ts: add MethodRetryPolicy interface and methodPolicies to CommercetoolsRetryConfig
  • is-retryable-error.ts: method-aware logic with commercetools-aligned per-method defaults
  • request.ts: pass httpMethod and methodPolicies to isRetryableError
  • tests: full coverage of new method-aware behavior and backward-compat cases

…tions

POST/PATCH/DELETE mutations are no longer retried on ECONNABORTED/ETIMEDOUT
or 500 by default — CT may have already processed the mutation server-side.
Gateway errors (502/503/504) are still retried as the LB rejected the request
before forwarding to CT.

Changes:
- types.ts: add MethodRetryPolicy interface and methodPolicies to CommercetoolsRetryConfig
- is-retryable-error.ts: method-aware logic with CT-aligned per-method defaults
- request.ts: pass httpMethod and methodPolicies to isRetryableError
- tests: full coverage of new method-aware behavior and backward-compat cases
@machnicki
machnicki requested a review from jimmythomson June 17, 2026 10:33
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.25%. Comparing base (9980e9d) to head (89d0ef8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/lib/request/request.ts 50.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (94.11%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #325      +/-   ##
==========================================
- Coverage   99.31%   99.25%   -0.07%     
==========================================
  Files          58       58              
  Lines        1456     1470      +14     
  Branches      148      156       +8     
==========================================
+ Hits         1446     1459      +13     
  Misses          2        2              
- Partials        8        9       +1     
Files with missing lines Coverage Δ
src/lib/request/is-retryable-error.ts 100.00% <100.00%> (ø)
src/lib/request/request.ts 98.85% <50.00%> (-1.15%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@machnicki machnicki changed the title feat: Apply CT-aligned per-method retry defaults for mutations feat: Commercetools - aligned per-method retry defaults for mutations Jun 17, 2026
@machnicki machnicki changed the title feat: Commercetools - aligned per-method retry defaults for mutations feat: commercetools-aligned per-method retry defaults for mutations Jun 17, 2026
@machnicki
machnicki merged commit ccc4159 into main Jun 17, 2026
3 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 6.28.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@machnicki
machnicki deleted the feat/DRO-32231 branch June 17, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants