Skip to content

Activity invocation with duplicate function names is silently redirected to aliased registration #2379

Description

@antmendoza

Expected Behavior

The workflow should invoke the activity registered with the requested name, not an aliased activity with the same underlying function name.

The worker registers two activities that have the same function name but different package implementations: one without an alias and one with an alias.

w.RegisterActivity(acvitity_v1.Activity)
w.RegisterActivityWithOptions(
    acvitity_v2.Activity,
    activity.RegisterOptions{
       Name: "Activity_v2",
    },
)

The workflow invokes the non-aliased activity either by name or by function:


err := workflow.ExecuteActivity(ctx, "Activity", name).Get(ctx, &result) or
err := workflow.ExecuteActivity(ctx, acvitity_v1.Activity, name).Get(ctx, &result)

However, the workflow ends up invoking activity_v2.Activity.

I think the issue is that the function getActivityFunctionName finds an alias registered for the given function name and resolves with the function attached to the alias

Actual Behavior

The worker should invoke the activity registered under the requested name, rather than silently resolving the invocation to an aliased activity with the same function name.

Steps to Reproduce the Problem

Attached you can find the reproduction

30967.zip

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions