sdk-go icon indicating copy to clipboard operation
sdk-go copied to clipboard

Typed nil versioning ramp panics

Open antlai-temporal opened this issue 6 months ago • 0 comments

Expected Behavior

The interface Ramp is an optional field for VersioningAssignmentRule, we should be able to set it to nil regardless of the type of the nil object

Actual Behavior

Currently we can set it to untyped nil, but with a typed nil it panics with a bad memory reference.

Steps to Reproduce the Problem

func Test_WorkerVersioningRules_typed_nil(t *testing.T) {
	ramp := &VersioningRampByPercentage{
		Percentage: 45.0,
	}
	ramp = nil

	u := UpdateWorkerVersioningRulesOptions{
		TaskQueue: "myQueue",
		Operation: &VersioningOperationInsertAssignmentRule{
			RuleIndex: 0,
			Rule: VersioningAssignmentRule{
				TargetBuildID: "2.0",
				Ramp:          ramp,
			},
		},
	}
      /// This panics....!!
	_, err := u.validateAndConvertToProto("my_namespace")
}

antlai-temporal avatar Aug 17 '24 00:08 antlai-temporal