Skip to content

Fix incorrectly set legacy build id options #859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions temporalio/bridge/src/worker.rs
Copy link
Member

@cretz cretz May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an easy test we could write that would break (or timeout) before these changes were added?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is, it already existed and was just skipped. It now passes but didn't without the fix.

Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub enum WorkerVersioningStrategy {

#[derive(FromPyObject)]
pub struct WorkerVersioningNone {
pub build_id: String,
pub build_id_no_versioning: String,
}

/// Recreates [temporal_sdk_core_api::worker::WorkerDeploymentOptions]
Expand All @@ -122,7 +122,7 @@ pub struct WorkerDeploymentOptions {

#[derive(FromPyObject)]
pub struct LegacyBuildIdBased {
pub build_id: String,
pub build_id_with_versioning: String,
}

/// Recreates [temporal_sdk_core_api::worker::WorkerDeploymentVersion]
Expand Down Expand Up @@ -803,7 +803,7 @@ fn convert_versioning_strategy(
match strategy {
WorkerVersioningStrategy::None(vn) => {
temporal_sdk_core_api::worker::WorkerVersioningStrategy::None {
build_id: vn.build_id,
build_id: vn.build_id_no_versioning,
}
}
WorkerVersioningStrategy::DeploymentBased(options) => {
Expand All @@ -825,7 +825,7 @@ fn convert_versioning_strategy(
}
WorkerVersioningStrategy::LegacyBuildIdBased(lb) => {
temporal_sdk_core_api::worker::WorkerVersioningStrategy::LegacyBuildIdBased {
build_id: lb.build_id,
build_id: lb.build_id_with_versioning,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions temporalio/bridge/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ class WorkerDeploymentOptions:
class WorkerVersioningStrategyNone:
"""Python representation of the Rust struct for configuring a worker versioning strategy None."""

build_id: str
build_id_no_versioning: str


@dataclass
class WorkerVersioningStrategyLegacyBuildIdBased:
"""Python representation of the Rust struct for configuring a worker versioning strategy legacy Build ID-based."""

build_id: str
build_id_with_versioning: str


WorkerVersioningStrategy: TypeAlias = Union[
Expand Down
3 changes: 2 additions & 1 deletion temporalio/worker/_replayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ def on_eviction_hook(
max_task_queue_activities_per_second=None,
graceful_shutdown_period_millis=0,
versioning_strategy=temporalio.bridge.worker.WorkerVersioningStrategyNone(
build_id=self._config["build_id"] or load_default_build_id(),
build_id_no_versioning=self._config["build_id"]
or load_default_build_id(),
),
workflow_task_poller_behavior=temporalio.bridge.worker.PollerBehaviorSimpleMaximum(
1
Expand Down
4 changes: 2 additions & 2 deletions temporalio/worker/_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,13 @@ def __init__(
build_id = build_id or load_default_build_id()
versioning_strategy = (
temporalio.bridge.worker.WorkerVersioningStrategyLegacyBuildIdBased(
build_id=build_id
build_id_with_versioning=build_id
)
)
else:
build_id = build_id or load_default_build_id()
versioning_strategy = temporalio.bridge.worker.WorkerVersioningStrategyNone(
build_id=build_id
build_id_no_versioning=build_id
)

if max_concurrent_workflow_task_polls:
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ async def env(env_type: str) -> AsyncGenerator[WorkflowEnvironment, None]:
"--dynamic-config-value",
"frontend.enableExecuteMultiOperation=true",
"--dynamic-config-value",
"frontend.enableVersioningWorkflowAPIs=true",
"frontend.workerVersioningWorkflowAPIs=true",
"--dynamic-config-value",
"frontend.enableVersioningDataAPIs=true",
"frontend.workerVersioningDataAPIs=true",
"--dynamic-config-value",
"system.enableDeploymentVersions=true",
],
Expand Down
Loading