-
Notifications
You must be signed in to change notification settings - Fork 272
Introduce SDK flag to use user DC on Memo's #2121
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| // memoUserDCEncode exists to allow us to configure the default behavior of | ||
| // SDKFlagMemoUserDCEncode. This is primarily useful with tests. | ||
| var memoUserDCEncode = os.Getenv("MEMO_USER_DC_ENCODE") != "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says this is useful for tests, but I don't see this used in the SDK anywhere. Why did we need to add this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's set and used in SetMemoUserDCEncode(), so we can defer setting it back to its previous flag
What was changed
Introduced an SDK flag,
SDKFlagMemoUserDCEncode, to configure new behavior, where we actually use the user data converter when encoding Memo's. If user DC errors out, the default DC will be used as a fallback. If that also returns an error, the user DC error will be returned to the caller.SDK flag is still set to false by default, so no behavior changes. After a Go SDK release or two, will the flag then be enabled by default.
Why?
Correct behavior to match other SDKs
Checklist
Closes Memo does not go through user provided data coverter #1045
How was this tested:
Added new tests that flip on/off the SDK flag and validates behavior
Any docs updates needed?
Note
Adds SDKFlagMemoUserDCEncode to optionally encode workflow/schedule memos with the user data converter (falling back to default), and updates codepaths and tests to honor it.
SDKFlagMemoUserDCEncodewith env toggleMEMO_USER_DC_ENCODEand setterSetMemoUserDCEncode.encodeMemoValueandshouldUseMemoUserDataConverter; prefer userDataConverterfor memo encoding, fallback to default on error.getWorkflowMemo(..)andvalidateAndSerializeMemo(..)to accept amemoFlagAccessorand apply flag.StartWorkflow,SignalWithStart, child workflow start, schedules, testsuite) to pass accessor and/or use new helpers.encodeScheduleWorkflowMemonow uses user DC (with fallback) and defaults DC when nil.Written by Cursor Bugbot for commit 049d0fb. This will update automatically on new commits. Configure here.