Skip to content

Preserve signal payload integer precision in workflow.SignalWorkflow#482

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-signal-workflow-precision-issue
Draft

Preserve signal payload integer precision in workflow.SignalWorkflow#482
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-signal-workflow-precision-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

workflow.SignalWorkflow could silently corrupt large integers (>2^53) because the system activity accepted interface{}, forcing JSON numbers through float64 during activity argument decoding. This changed payload values before they reached typed signal channels.

  • Root cause addressed: remove lossy interface{} hop

    • internal/signals.Activities.DeliverWorkflowSignal now accepts json.RawMessage instead of interface{} for the signal argument.
    • This preserves raw payload bytes across activity serialization/deserialization and avoids float64 coercion.
  • Signal API path updated to preserve typed payload encoding

    • workflow.SignalWorkflow[T] now serializes arg with the workflow converter up front and passes the result as json.RawMessage to the system signal activity.
    • Conversion failures now include signal/workflow context in the returned error.
  • Regression coverage for high-magnitude integers

    • Added a test in tester/tester_test.go that sends a payload containing uint64(123456789012345678) and asserts exact round-trip equality after SignalWorkflow.
input, err := contextvalue.Converter(ctx).To(arg)
if err != nil {
    // contextual conversion error
}

return ExecuteActivity[any](ctx, opts, a.DeliverWorkflowSignal, instanceID, name, json.RawMessage(input))

Copilot AI changed the title [WIP] Fix SignalWorkflow large integer truncation issue Preserve signal payload integer precision in workflow.SignalWorkflow May 29, 2026
Copilot AI requested a review from cschleiden May 29, 2026 21:05
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.

workflow.SignalWorkflow silently corrupts large integer values (> 2^53) via float64 precision loss

2 participants