sdk-go icon indicating copy to clipboard operation
sdk-go copied to clipboard

Safer queries (and update validators)

Open cretz opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe.

Queries can start activities and such and they shouldn't

Describe the solution you'd like

  • Allow query handlers to accept a context as the first parameter in a backwards compatible way
  • Disallow that context to be used for execute activity
  • Add workflowcheck static analyzer check to ensure query handlers do not do anything they aren't supposed to

This is obviously a non-trivial amount of work and low priority

cretz avatar Aug 02 '22 18:08 cretz

This same restrictions should also apply to SideEffects as well

Quinn-With-Two-Ns avatar Dec 02 '22 21:12 Quinn-With-Two-Ns

see also https://github.com/temporalio/sdk-features/issues/177

Quinn-With-Two-Ns avatar Dec 02 '22 22:12 Quinn-With-Two-Ns

Queries, and other read only contexts can no longer perform any mutating operations. Leaving this open because we could still add support for the static analyzer

Quinn-With-Two-Ns avatar Jul 19 '23 16:07 Quinn-With-Two-Ns