Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test-suite bugfix: local activity errors were not encoded correctly #1247

Merged
merged 2 commits into from
Apr 27, 2023

Conversation

Groxx
Copy link
Contributor

@Groxx Groxx commented Apr 27, 2023

The added test hopefully reveals the issue - prior to this fix,
that err := f.Get(...) -> errors.Is(err, ...) check passed, because
the error value was not ever encoded into a *GenericError.

Thankfully this was only a test environment bug, and a user discovered
it due to writing tests.


The non-test behavior can be seen split between these two locations:

  • encoding error reason / data:
    if lar.err != nil {
    errReason, errDetails := getErrorDetails(lar.err, weh.GetDataConverter())
    lamd.ErrReason = errReason
    lamd.ErrJSON = string(errDetails)
    lamd.Backoff = lar.backoff
  • constructing the generic error in handleLocalActivityMarker:
    if len(lamd.ErrReason) > 0 {
    lar.attempt = lamd.Attempt
    lar.backoff = lamd.Backoff
    lar.err = constructError(lamd.ErrReason, []byte(lamd.ErrJSON), weh.GetDataConverter())

... which also show incorrect / pointless string/byte conversions.
I've left comments there just to prevent confusion, but these fields are
probably worth changing at some point.

The added test hopefully reveals the issue - prior to this fix,
that `err := f.Get(...)` -> `errors.Is(err, ...)` check passed, because
the error value was not ever encoded into a `*GenericError`.

Thankfully this was only a test environment bug, and a user discovered
it due to writing tests.
@@ -1159,10 +1159,10 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessLocalActivityResult(lar *lo
if lar.err != nil {
errReason, errDetails := getErrorDetails(lar.err, weh.GetDataConverter())
lamd.ErrReason = errReason
lamd.ErrJSON = string(errDetails)
lamd.ErrJSON = string(errDetails) // TODO: this is not json, nor is it necessarily a valid string
Copy link
Contributor

Choose a reason for hiding this comment

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

clarification, not validated as being json or even a string? or never json?

Copy link
Contributor Author

@Groxx Groxx Apr 27, 2023

Choose a reason for hiding this comment

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

it's user-encoded data in an arbitrary format (because it uses their dataconverter).

json is the default, but since it's arbitrary IMO that means "never json".

@Groxx Groxx merged commit 1fed700 into uber-go:master Apr 27, 2023
@Groxx Groxx deleted the errors-is-local-activities branch April 27, 2023 17:34
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.

2 participants