Repository navigation
test(net): pin the retry policy against errors the SDK really throws - #650
Merged
Merged
Conversation
#647 reported that a 404 was being retried despite 404 sitting in NON_RETRYABLE_STATUSES. Investigating it, the premise does not hold — but the report's third acceptance criterion was right and is worth keeping. What was actually checked: the SDK's built dist carries statusCode yes (dist/index.js:54) a real 404 through the SDK NotFoundError, statusCode 404 statusCodeOf on that error 404 shouldRetry(0, error, 1) false react-query's own mutation machinery, driven with the app's exact retry default, against a real SDK 404 1 PATCH, not 2 So the predicate is correct at the unit level AND in composition. The duplicate write observed in #647 was real and timestamped, but retry was not its cause, and it no longer reproduces now that #646 stopped the endpoint 404ing. The existing tests here build a hand-rolled `{ statusCode }` object. That tests the arithmetic and nothing else — it cannot notice if a real SDK error stops carrying `statusCode`, which is the part that would break silently and the exact failure mode #647 hypothesised. #647's own acceptance criterion said as much: "a unit test on shouldRetry alone would pass today while the app misbehaves" So the assertions are repeated against NotFoundError, AuthenticationError, RateLimitError and APIError as the SDK constructs them. If the SDK renames the field, drops it from a subclass, or its build output falls behind its source, these fail while the hand-built ones keep passing. No production change: nothing was broken. Co-Authored-By: Claude Opus 5 <[email protected]>
This was referenced Aug 27, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #647 — the premise was wrong, and this keeps the half of it that was right.
What #647 claimed
That a 404 mutation was being retried, despite 404 sitting in
NON_RETRYABLE_STATUSES. I filed it after seeing two identical PATCHes 1,095ms apart on the wire.What I actually found
distcarriesstatusCodedist/index.js:54NotFoundError,statusCode: 404statusCodeOf(err)404shouldRetry(0, err, 1)falseretrydefault, against a real SDK 404The predicate is correct at the unit level and in composition. I built the last one specifically because the first four only test pieces — I'd already been burned this session by reasoning about components that were each individually fine.
So the duplicate write was real and timestamped, but retry was not its cause, and it no longer reproduces now that #649 stopped the endpoint 404ing. I could not identify what did send it. That's an unsatisfying end, but "the retry policy is broken" is not supported and leaving the issue open would send someone to fix a predicate that works.
The regression guard for a recurrence already exists:
smoke-move-undo.mjsnow pins exactly one write, 2xx per move, so a genuine double-send fails the smoke rather than going unnoticed.What was worth keeping
#647's third acceptance criterion, which was correct:
The existing tests build a hand-rolled
{ statusCode }object. That tests the arithmetic and nothing else — it cannot notice if a real SDK error stops carryingstatusCode, which is exactly the silent failure #647 hypothesised.So the assertions now also run against
NotFoundError,AuthenticationError,RateLimitErrorandAPIErroras the SDK constructs them. If the SDK renames the field, drops it from a subclass, or its build output falls behind its source, these fail while the hand-built ones keep passing.No production change — nothing was broken. 20/20 tests pass,
scf-coretypechecks clean.🤖 Generated with Claude Code