add(sdk/go): Context to workflow requests (#2765)#3127
Open
gregfurman wants to merge 1 commit intohatchet-dev:mainfrom
Open
add(sdk/go): Context to workflow requests (#2765)#3127gregfurman wants to merge 1 commit intohatchet-dev:mainfrom
gregfurman wants to merge 1 commit intohatchet-dev:mainfrom
Conversation
|
@gregfurman is attempting to deploy a commit to the Hatchet Team on Vercel. A member of the Team first needs to authorize it. |
|
📝 Documentation updates detected! Updated existing suggestion: Update Go migration guide for V0 SDK deprecation and context parameter breaking change Tip: Assign suggestions to team members in the Promptless dashboard to claim work 👥 |
|
📝 Documentation updates detected! Updated existing suggestion: Add V0 and V1 Generics SDK deprecation notices to Go migration guide Tip: Planning a big docs refactor? Use Deep Analysis to get help with the heavy lifting 🔍 |
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.
Description
Fixes #2765
Methods on the
AdminClientinterface ignore the caller method'scontext.Contextparameter, meaning cancelling a parent context fails to affect the downstream gRPC request.This PR introduces breaking changes to the interface which now correctly pass a caller context to these methods.
Rationale for breaking changes
The two alternatives considered for this were:
context.Contextparameter to the request options, allowing it to be retrieved from a seperate struct without changing the method signature -- like withhttp/netintroducing aNewRequestWithContext(see https://go.dev/blog/context-and-structs#exception-to-the-rule-preserving-backwards-compatibility)[Action]Contextmethods on the interface (i.eRunWorkflowContext) in a similar manner todatabase/sql'sQuery(...)andQueryContext(ctx context.Context, ...)(see https://go.dev/blog/module-compatibility#adding-to-a-function)However, the interface being changed is both in a deprecated package (which IMO should mean less stability guarantees) AND should probably have had these
ctxparams to begin with.With that said, if we choose to accept this PR, we should make mention of this breaking change to the SDK in the release notes.
Type of change
What's Changed
context.Contextto those methods within the (deprecated) v0AdminClientinterface.context.TODO()instead of a no-opcontext.Background()