Skip to content

SDK-349 Serial execution and deletion semantics#1012

Merged
sumeruchat merged 2 commits intofeature/SDK-347-unpause-processing-requestsfrom
feature/SDK-349-serial-execution-deletion-semantics
Mar 16, 2026
Merged

SDK-349 Serial execution and deletion semantics#1012
sumeruchat merged 2 commits intofeature/SDK-347-unpause-processing-requestsfrom
feature/SDK-349-serial-execution-deletion-semantics

Conversation

@sumeruchat
Copy link
Contributor

Summary

  • Invert error classification in IterableAPICallTaskProcessor: replace narrow isNetworkUnavailable() (string match for "offline") with isPermanentFailure() (whitelist 4xx as permanent). Everything else — 5xx, timeouts, DNS failures, connection resets — is now treated as transient and retains the task for retry.
  • Reorder error branches: JWT auth check first (so 401 JWT isn't caught by 4xx), then permanent failure check, then default to transient retry
  • Serial execution was already correct (verified via running flag, recursive processTasks(), single CoreData context) — no changes needed

What changed

Error Type Before After
5xx (500, 502, 503) Deleted after inline retries Retained for queue-level retry
Network timeout Deleted Retained for retry
DNS/connection failure Deleted Retained for retry
4xx (400, 403, 404) Deleted Deleted (unchanged)
401 JWT + autoRetry Retained Retained (unchanged)
Network offline Retained Retained (unchanged)

Test plan

  • testRetainTaskOn5xxWithAutoRetry — 500 retains task (updated from old test that expected deletion)
  • testRetainTaskOn5xxAndProcessAfterRecovery — 500 retains, fix server → task succeeds
  • testDeleteTaskOn4xxClientError — 400 deletes task immediately
  • test5xxErrorIsTransient — processor-level: 500 → .failureWithRetry
  • test4xxErrorIsPermanent — processor-level: 400 → .failureWithNoRetry
  • testTimeoutErrorIsTransient — processor-level: timeout → .failureWithRetry

🤖 Generated with Claude Code

Invert error classification to whitelist-for-deletion: only 4xx
client errors are permanent. 5xx server errors, network timeouts,
DNS failures, and connection resets are now treated as transient
and retain the task for retry.

- Replace isNetworkUnavailable() with isPermanentFailure() in
  IterableAPICallTaskProcessor — checks for 4xx status codes only
- Reorder error branches: JWT check first, then permanent failure,
  then default to transient retry
- Update existing 500 test to expect retention instead of deletion
- Add 3 processor-level unit tests (5xx, 4xx, timeout classification)
- Add 2 integration tests (5xx recovery, 4xx deletion)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.20%. Comparing base (826effa) to head (70e56c9).

Additional details and impacted files
@@                             Coverage Diff                              @@
##           feature/SDK-347-unpause-processing-requests    #1012   +/-   ##
============================================================================
  Coverage                                        70.20%   70.20%           
============================================================================
  Files                                              112      112           
  Lines                                             9213     9217    +4     
============================================================================
+ Hits                                              6468     6471    +3     
- Misses                                            2745     2746    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joaodordio joaodordio changed the base branch from feature/SDK-335-retry-logic to feature/SDK-347-unpause-processing-requests March 13, 2026 11:06
@joaodordio
Copy link
Member

I've updated the base branch to be the feature/SDK-347-unpause-processing-requests instead of the feature/SDK-335-retry-logic so the review is made only on the changes for this task instead. Also it makes the merging easier.

Copy link
Member

@joaodordio joaodordio left a comment

Choose a reason for hiding this comment

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

Just left a comment regarding the 429 code

Exclude 429 from isPermanentFailure() so rate-limited requests are
retained for retry instead of being deleted. Add unit test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sumeruchat sumeruchat assigned sumeruchat and unassigned sumeruchat Mar 16, 2026
@sumeruchat sumeruchat merged commit 445adb0 into feature/SDK-347-unpause-processing-requests Mar 16, 2026
9 checks passed
@sumeruchat sumeruchat deleted the feature/SDK-349-serial-execution-deletion-semantics branch March 16, 2026 13:19
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.

4 participants