command_attr_validator.go ×13

Frontier kind: Code frontier

unlabeled · c_6bbd6a250f58

2 tests · 2724 LOC · 141 files · introduces 0 tests · 28 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges28 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
427 ranges2724 lines · 141 files · Browse complete extent
All tests (intent)
2 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 28 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/command_attr_validator.go 24 introduced LOC · 13 ranges

Open complete file

393 attributes *commandpb.ContinueAsNewWorkflowExecutionCommandAttributes,
394 executionInfo *persistencespb.WorkflowExecutionInfo,
395 > ) (enumspb.WorkflowTaskFailedCause, error) { command_attr_validator.go
396 >
397 > const failedCause = enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES
398 > if attributes == nil {
399 return failedCause, serviceerror.NewInvalidArgument("ContinueAsNewWorkflowExecutionCommandAttributes is not set on ContinueAsNewWorkflowExecutionCommand.")
400 }
401
402 // Inherit workflow type from previous execution if not provided on command
403 > if attributes.WorkflowType == nil || attributes.WorkflowType.GetName() == "" { command_attr_validator.go
404 > attributes.WorkflowType = &commonpb.WorkflowType{Name: executionInfo.WorkflowTypeName}
405 > }
406
407 > wfType := attributes.WorkflowType.GetName() command_attr_validator.go
408 > if len(wfType) > v.maxIDLengthLimit {
409 return failedCause, serviceerror.NewInvalidArgumentf("WorkflowType on ContinueAsNewWorkflowExecutionCommand exceeds length limit. WorkflowType=%s Length=%d Limit=%d", wfType, len(wfType), v.maxIDLengthLimit)
410 }
411
412 // Inherit task queue from previous execution if not provided on command
413 > if attributes.TaskQueue == nil { command_attr_validator.go
414 attributes.TaskQueue = &taskqueuepb.TaskQueue{
415 Kind: enumspb.TASK_QUEUE_KIND_NORMAL,
416 }
417 }
418 > if err := tqid.NormalizeAndValidateUserDefined( command_attr_validator.go
419 > attributes.TaskQueue, executionInfo.TaskQueue, executionInfo.TaskQueue, v.maxIDLengthLimit); err != nil {
420 return failedCause, fmt.Errorf("error validating ContinueAsNewWorkflowExecutionCommand TaskQueue: %w. WorkflowType=%s TaskQueue=%s", err, wfType, attributes.TaskQueue)
421 }
422
423 > if err := timestamp.ValidateAndCapProtoDuration(attributes.GetWorkflowRunTimeout()); err != nil { command_attr_validator.go
424 return failedCause, serviceerror.NewInvalidArgumentf("Invalid WorkflowRunTimeout on ContinueAsNewWorkflowExecutionCommand: %v. WorkflowType=%s TaskQueue=%s", err, wfType, attributes.TaskQueue)
425 }
426
427 > if err := timestamp.ValidateAndCapProtoDuration(attributes.GetWorkflowTaskTimeout()); err != nil { command_attr_validator.go
428 return failedCause, serviceerror.NewInvalidArgumentf("Invalid WorkflowTaskTimeout on ContinueAsNewWorkflowExecutionCommand: %v. WorkflowType=%s TaskQueue=%s", err, wfType, attributes.TaskQueue)
429 }
430
431 > if err := timestamp.ValidateAndCapProtoDuration(attributes.GetBackoffStartInterval()); err != nil { command_attr_validator.go
432 return failedCause, serviceerror.NewInvalidArgumentf("Invalid BackoffStartInterval on ContinueAsNewWorkflowExecutionCommand: %v. WorkflowType=%s TaskQueue=%s", err, wfType, attributes.TaskQueue)
433 }
434
435 > if attributes.GetWorkflowRunTimeout().AsDuration() == 0 { command_attr_validator.go
436 attributes.WorkflowRunTimeout = executionInfo.WorkflowRunTimeout
437 }
438
439 > if attributes.GetWorkflowTaskTimeout().AsDuration() == 0 { command_attr_validator.go
440 attributes.WorkflowTaskTimeout = executionInfo.DefaultWorkflowTaskTimeout
441 }
442
443 > attributes.WorkflowRunTimeout = durationpb.New(overrideWorkflowRunTimeout(attributes.GetWorkflowRunTimeout().AsDuration(), executionInfo.GetWorkflowExecutionTimeout().AsDuration())) command_attr_validator.go
444 >
445 > attributes.WorkflowTaskTimeout = durationpb.New(overrideWorkflowTaskTimeout(namespaceName, attributes.GetWorkflowTaskTimeout().AsDuration(), attributes.GetWorkflowRunTimeout().AsDuration(), v.config.DefaultWorkflowTaskTimeout))
446 >
447 > if err := v.validateWorkflowRetryPolicy(namespaceName, attributes.RetryPolicy); err != nil {
448 return failedCause, fmt.Errorf("invalid WorkflowRetryPolicy on ContinueAsNewWorkflowExecutionCommand: %w. WorkflowType=%s TaskQueue=%s", err, wfType, attributes.TaskQueue)
449 }
450
451 > if err := v.searchAttributesValidator.Validate(attributes.GetSearchAttributes(), namespaceName.String()); err != nil { command_attr_validator.go
452 return enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES, fmt.Errorf("invalid SearchAttributes on ContinueAsNewWorkflowExecutionCommand: %w. WorkflowType=%s TaskQueue=%s", err, wfType, attributes.TaskQueue)
453 }
454
455 > return enumspb.WORKFLOW_TASK_FAILED_CAUSE_UNSPECIFIED, nil command_attr_validator.go
456 }
457
go.temporal.io/server/api/persistence/v1/executions.pb.go 4 introduced LOC · 1 range

Open complete file

473 }
474
475 > func (x *WorkflowExecutionInfo) GetWorkflowExecutionTimeout() *durationpb.Duration { executions.pb.go
476 > if x != nil {
477 > return x.WorkflowExecutionTimeout
478 > }
479 return nil
480 }