Ignore EOF errors in jsonEncoding.Unmarshal()#1188
Ignore EOF errors in jsonEncoding.Unmarshal()#1188jjti wants to merge 6 commits intocadence-workflow:masterfrom
jsonEncoding.Unmarshal()#1188Conversation
|
jjtimmons seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
data
datajsonEncoding.Unmarshal()
|
closing because I don't like seeing this sit open in my PRs page, still think ya'll should do it |
|
re-opening for review by the Cadence team |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
|
@jjti could you review the Contributor License Agreement? Thanks! |
What changed?
EOFerrors, leaving the undecodedobjsZero-valuedI expect this will better align with user expectations. For example, if you
json.Unmarshala 0-length JSON array into a 1-length slice of struct pointers, the pointer remains zero'ed without err: https://go.dev/play/p/ppz62H1Pqpwhttps://pkg.go.dev/encoding/json#Unmarshal:~:text=To%20unmarshal%20a%20JSON%20array%20into%20a%20Go%20array
Why?
I've found that the Cadence Replayer fails on many of my team's Workflows:
Ie we're getting:
unable to decode argument: 0, *interface {}, with json error: EOFin Cadence Replayer where the Workflows happily succeed in our production code. Others have noticed the same: #1016This happens when we pass an
interface{}to afuture.Get(ctx, value)(as a throw away value, we don't actually expect a result):How did you test it?
make testPotential risks
EOFerrors fromUnmarshalindecoder.defaultDataConverter(data []byte, to ...interface{}). Eg: it's expected that we'll error out onUnmarshaland that all response values will be set to non-Zero values