temporalio / sdk-core

Core Temporal SDK that can be used as a base for language specific Temporal SDKs
MIT License
266 stars 70 forks source link

Rust-SDK: Handle unknown workflow #787

Closed valkum closed 1 month ago

valkum commented 1 month ago

What was changed

This makes sure unknown workflows are handled on-par with other SDKs. This is done by emitting a WorkflowActivationComplete message with state set to failure.

This is based on feedback from https://github.com/temporalio/sdk-core/pull/784

Why?

The recent changed avoided panics caused by unknown workflows. The workflow activation was never marked as failed. This made it hard to add a test for this behavior.

Checklist

  1. How was this tested: Test is added to check for the correct behavior.
valkum commented 1 month ago

The test currently does not shutdown properly. The temporal_sdk_core::worker: Initiated shutdown message is logged, so it hangs somewhere after that point. I am not sure if this is caused by emitting the WorkflowActiviationComplete message, or by the test structure itself.

It might be possible to make the test a bit smaller. I hope the reasoning in the comments for handling the RemoveFromCache jobs is correct.