Skip to content

Use ActivitySerializationContext when describing a Standalone Activity#1583

Merged
VegetarianOrc merged 3 commits into
mainfrom
amazzeo/activity-context-for-describe-activity
Jun 5, 2026
Merged

Use ActivitySerializationContext when describing a Standalone Activity#1583
VegetarianOrc merged 3 commits into
mainfrom
amazzeo/activity-context-for-describe-activity

Conversation

@VegetarianOrc
Copy link
Copy Markdown
Contributor

@VegetarianOrc VegetarianOrc commented Jun 4, 2026

What was changed

Use ActivitySerializationContext when describing a Standalone Activity.

Why?

Using a WorkflowSerializationContext where the workflow_id is really an activity_id seems like a bug.

@VegetarianOrc VegetarianOrc marked this pull request as ready for review June 4, 2026 23:20
@VegetarianOrc VegetarianOrc requested a review from a team as a code owner June 4, 2026 23:20
Comment thread temporalio/client/_impl.py Outdated
Comment on lines +696 to +698
activity_type = (
resp.info.activity_type.name if resp.info.HasField("activity_type") else ""
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

activity_type is always present, the check is unnecessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done! Should we remove the same check from where the ActivityExecution and the ActivityExecutionDescription are built?

data_converter=self._client.data_converter.with_context(
WorkflowSerializationContext(
ActivitySerializationContext(
namespace=self._client.namespace,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is _client.namespace guaranteed to always be the namespace that the activity started with? I'm not clear about whether the client and the workflow/activity always have the same namespace (but I assume they do).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, you can't start/describe a workflow/activity unless you're auth'd against the namespace they are in. Except via Nexus of course 😎

@VegetarianOrc VegetarianOrc merged commit 8d66724 into main Jun 5, 2026
16 checks passed
@VegetarianOrc VegetarianOrc deleted the amazzeo/activity-context-for-describe-activity branch June 5, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants