Skip to content

Add System Nexus transfer payload converter - #846

Open
tconley1428 wants to merge 3 commits into
mainfrom
transfer-type-converter-context
Open

Add System Nexus transfer payload converter#846
tconley1428 wants to merge 3 commits into
mainfrom
transfer-type-converter-context

Conversation

@tconley1428

@tconley1428 tconley1428 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a dedicated System Nexus outer payload converter.
  • Apply transfer conversion to the binary-proto outer envelope.
  • Keep System Nexus payload conversion limited to the operation envelope, not command metadata.

Generated System Nexus support will own the nested converter context in a follow-up once the
nex-gen transfer-type changes are ingested.

This mirrors the Python System Nexus converter: it owns transfer conversion for the outer envelope
and scopes the user converters while generated System Nexus transfer types serialize nested values.

Validation

  • dotnet build tests/Temporalio.Tests/Temporalio.Tests.csproj --no-restore
  • dotnet test tests/Temporalio.Tests/Temporalio.Tests.csproj --no-build --filter FullyQualifiedName~SystemNexusPayloadConverterTests --verbosity normal
  • dotnet test tests/Temporalio.Tests/Temporalio.Tests.csproj --no-build --filter FullyQualifiedName~SystemNexusTests --verbosity minimal

@jmaeagle99 jmaeagle99 self-assigned this Aug 17, 2026
@tconley1428
tconley1428 force-pushed the transfer-type-converter-context branch from cd1a3a2 to 32e2bca Compare August 18, 2026 17:16
@tconley1428 tconley1428 changed the title Add converter context for transfer type hooks Add System Nexus transfer payload converter Aug 18, 2026
@tconley1428
tconley1428 force-pushed the transfer-type-converter-context branch 5 times, most recently from b98c798 to 9c62ddc Compare August 18, 2026 18:06
@tconley1428
tconley1428 force-pushed the transfer-type-converter-context branch from 9c62ddc to 4ec540e Compare August 18, 2026 18:11
@tconley1428
tconley1428 marked this pull request as ready for review August 18, 2026 18:12
@tconley1428
tconley1428 requested a review from a team as a code owner August 18, 2026 18:12
Comment thread src/Temporalio/Nexus/SystemNexusPayloadConverter.cs Outdated
Comment thread src/Temporalio/Nexus/SystemNexusPayloadConverter.cs Outdated
Comment thread src/Temporalio/Nexus/SystemNexusPayloadConverter.cs Outdated
Comment thread tests/Temporalio.Tests/Nexus/SystemNexusPayloadConverterTests.cs Outdated
Comment thread src/Temporalio/Worker/WorkflowInstance.cs Outdated
Comment thread src/Temporalio/Nexus/SystemNexusConverterContext.cs Outdated
using Xunit;
using Xunit.Abstractions;

public class SystemNexusTests : WorkflowEnvironmentTestBase

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.

All of this looks to be just a move from WorkflowWorkerTests to SystemNexusTests, which is fine. But I don't see any net-new tests that validate the integration into ScheduleNexusOperationAsync method.

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.

Integration with it is currently not available since as you pointed out elsewhere, it doesn't use transfer type converter yet.

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.

I think we should add some kind of integration testing real soon. At least something that would have checked for the correct application of the converters to the different aspects of the ScheduleNexusOperationAsync invocation.

Comment thread src/Temporalio/Worker/WorkflowInstance.cs Outdated
Comment thread src/Temporalio/Nexus/SystemNexusPayloadConverter.cs Outdated

// TODO(cretz): Support Nexus serialization context
var payloadConverter = instance.payloadConverterNoContext;
var payloadConverter = SystemNexusPayloadVisitor.IsSystemNexusEndpoint(

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.

Have you considered the impact on the workflow replayer? I think similar support might be needed there.

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.

I haven't, here or in Python. That's a very good point.

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.

Added some coverage, but it appears to be the same path.

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.

I think we need to apply TemporalTransferTypePayloadConverter.Wrap at

DataConverter: options.DataConverter,
just like is done within the TemporalClient at
options.DataConverter = TemporalTransferTypePayloadConverter.Wrap(options.DataConverter);

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.

Yeah. Missed adding a transfer type convertible to the replay test. Added coverage for that in the next commit.

@tconley1428
tconley1428 force-pushed the transfer-type-converter-context branch from 8af354c to 0cff561 Compare August 19, 2026 00:03
@@ -2761,7 +2765,7 @@ public override Task<NexusWorkflowOperationHandle<TResult>> ScheduleNexusOperati
// If there is a start sync fail, we have to fail the handle task and
// there's nothing more we can do here
var handle = new NexusWorkflowOperationHandleImpl<TResult>(

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.

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.

I don't think these are correct, but I might want to walk through your logic with you to be sure.

handleSource.SetException(
instance.failureConverterNoContext.ToException(
syncStartFail, payloadConverter));
syncStartFail, operationPayloadConverter));

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.

This needs to use instance.payloadConverterNoContext.


// TODO(cretz): Support Nexus serialization context
var payloadConverter = instance.payloadConverterNoContext;
var payloadConverter = SystemNexusPayloadVisitor.IsSystemNexusEndpoint(

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.

I think we need to apply TemporalTransferTypePayloadConverter.Wrap at

DataConverter: options.DataConverter,
just like is done within the TemporalClient at
options.DataConverter = TemporalTransferTypePayloadConverter.Wrap(options.DataConverter);

using Xunit;
using Xunit.Abstractions;

public class SystemNexusTests : WorkflowEnvironmentTestBase

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.

I think we should add some kind of integration testing real soon. At least something that would have checked for the correct application of the converters to the different aspects of the ScheduleNexusOperationAsync invocation.

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.

2 participants