Repository navigation
feat(codec): WithoutPanicOnIOError - #166
Merged
Merged
Conversation
marchmallow
force-pushed
the
mgallo/without-panic-on-io-error
branch
2 times, most recently
from
October 1, 2026 15:23
0b18eba to
988d45e
Compare
marchmallow
marked this pull request as ready for review
October 1, 2026 15:28
By default the codec panics on IO errors so the Temporal worker's WorkflowPanicPolicy can handle them, avoiding non-determinism issues inside workflow functions. Callers outside a Temporal worker context (API handlers, goroutines not managed by the SDK, activities that fetch a prior workflow result via client.GetWorkflow().Get()) have no such safety net — a panic there crashes the process rather than failing a single task. WithoutPanicOnIOError() makes the codec return errors instead of panicking in those contexts, allowing the caller to handle transient LPS IO failures gracefully. The existing default (panic) behaviour is unchanged.
hferentschik
force-pushed
the
mgallo/without-panic-on-io-error
branch
from
October 6, 2026 09:28
988d45e to
00e9f36
Compare
hferentschik
approved these changes
Oct 6, 2026
hferentschik
left a comment
Collaborator
There was a problem hiding this comment.
I don't think the need for a panic vs error per call is real. In fact I think the better solution is the one here.
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.
Motivation & Context
WorkflowPanicPolicycan retry the workflow task without risking replay non-determinism (feat: Coded now panics on IO error #97). That same panic fires for calls outside workflow code, where nothing catches it. Reported against a Rapid API wrappingclient.GetWorkflow(...).Get(): DataDog/dd-source Slack thread (internal).WithReturnErrorOnIOError. This PR keeps that commit and adds the review round it was waiting on, renamed toWithoutPanicOnIOErrorto match the name already in use by the consuming change (ddoghq/dd-source#114498, soon paired with a per-call-context variant on top of it).*IOErrorreturned, withWithoutPanicOnIOError()errorfromfmt.Errorf("large payload codec IO error: %v", cause)*IOError(implementserror,Unwrap() error); same message textInterface Changes
WithoutPanicOnIOError()codec option (default behavior, panicking, is unchanged).*IOErrortype. It is both the panic value and the returned error, soerrors.Asnow reaches the underlying cause (a*url.Error, a status-code mismatch, …) that%v-formatting previously hid.Validation
go build,go vet, andgo testpass incodec/.WithoutPanicOnIOErrorreturns a*IOError(errors.As) on both encode and decode IO errors; the existing panic tests now assert the panic value's concrete type too.RoundTripperthat returns a canned response with no real network connection underneath — anhttptest.Server-backed version of this test passed even with the fix reverted, because Go'snet/http.Transportcloses idle response bodies of its own accord in the background, independent of application code; the fake transport removes that confound.Risks
*IOError'sUnwrap()is new; a caller somewhere could be relying onerrors.Is/errors.Asnot reaching the cause. None are known (dd-source string-matches the panic message, which this preserves), but this is a public module.