Clarification on Workflow Patching/Versioning in Python

Looking for clarification on this part of the documentation:

Specifically, when can we deploy workflow.deprecate_patch("my-patch").

Looks like there is 4 states:

  1. Initial (pre-patch)
  2. Patched
  3. Deprecated
  4. Removed Patched / Final

When going from PatchedDeprecated, the docs says:

After ensuring that all Workflows started with pre_patch_activity code have left retention, you can deprecate the patch.

It says “retention”, does it mean that we cannot deploy a deprecated_patch’d code until ALL pre-patch workflows (even completed ones) is removed from Temporal History? Or could we safely deploy a deprecated_patch’d as soon as all workflows are running the Patched code (regardless if there are any pre-patched workflows that are completed in Temporal History)?

Also, the same question apply for DeprecatedRemoved Patched. It also uses the word
”retention”.

i think for both cases you mention, if for your use case you do not need to query (workflow query) closed executions, you can deploy when there are no running workflows. otherwise until they are removed (closed workflows removed when they hit namespace retention period)

Thank you tihomir,

This will be an issue for manual workflow queries - so queries coming from the UI/Frontend service of temporal is not going to be an issue - is that right?

If you mean querying an execution from ui, yeah thats also a workflow query and if you query completed, query would cause event history replay that can lead to NDE and failure to deliver query response.

Are you talking more about the “query” tab in the workflow details page (https:/{temporal domain}.com/namespaces/default/workflows/{id}/{id}/query)?

I’m talking more about going to the list of workflows, clicking on it to see the event history and other data about it.

If you mean metadata query that ui calls. I believe it should not cause replay but honestly not sure ontop of head so will check and get back

Hi tihomir, just want to follow up if you checked this out? Thank you.