fix: allow replacing worker client on default runtime - #1707
fix: allow replacing worker client on default runtime#1707Sakshamm-Goyal wants to merge 2 commits into
Conversation
|
Addressed the runtime-selection concern in 8c313d8. The setter now compares only an explicitly configured runtime; it no longer creates The regression now creates the worker with a non-default runtime and replaces its client with one that has no runtime argument, which failed under the previous check. Source compilation and focused Mypy passed. I attempted the targeted pytest path, but this worktree's SDK Core submodule is absent, so its bridge extension cannot be built locally; fresh CI is queued for the full pinned-environment test. |
| bridge_client = _extract_bridge_client_for_worker(value) | ||
| if self._runtime is not bridge_client.config.runtime: | ||
| new_runtime = bridge_client.config.runtime | ||
| if new_runtime is not None and self._runtime is not new_runtime: |
There was a problem hiding this comment.
This would now appear to allow the new runtime to be None, regardless of the value of the old runtime.
|
Based on the comment you are also not even running the tests:
I'm going to close, if you still want to fix it, please think through the cases and actually run tests in a working environment. |
Fixes #657.
A replacement client with no explicit runtime uses
Runtime.default(), but the worker compared the configured runtime value directly and treatedNoneas a different runtime. Resolve the replacement client runtime with the same defaulting rule used during worker construction before comparing identities.Regression coverage connects a second client without supplying
runtimeand verifies it can replace a worker client. The explicit different-runtime rejection remains covered.Validated with:
pytest tests/worker/test_workflow.py::test_workflow_replace_worker_client_default_runtime tests/worker/test_workflow.py::test_workflow_replace_worker_client_diff_runtimes_fail -qruff format --check temporalio/worker/_worker.py tests/worker/test_workflow.pygit diff --check