command_attr_validator.go ×16

Frontier kind: Code frontier

unlabeled · c_72487f33271c

9 tests · 2688 LOC · 141 files · introduces 0 tests · 34 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
16 ranges34 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
419 ranges2688 lines · 141 files · Browse complete extent
All tests (intent)
9 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.

1 file ranked by introduced lines: 34 introduced LOC across 16 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/command_attr_validator.go 34 introduced LOC · 16 ranges

Open complete file

463 parentInfo *persistencespb.WorkflowExecutionInfo,
464 defaultWorkflowTaskTimeoutFn dynamicconfig.DurationPropertyFnWithNamespaceFilter,
465 > ) (enumspb.WorkflowTaskFailedCause, error) { command_attr_validator.go
466 >
467 > const failedCause = enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES
468 >
469 > if attributes == nil {
470 return failedCause, serviceerror.NewInvalidArgument("StartChildWorkflowExecutionCommandAttributes is not set on StartChildWorkflowExecutionCommand.")
471 }
472
473 > wfID := attributes.GetWorkflowId() command_attr_validator.go
474 >
475 > if err := v.validateCrossNamespaceCall(
476 > namespaceID,
477 > parentInfo.WorkflowId,
478 > targetNamespaceID,
479 > wfID,
480 > ); err != nil {
481 return failedCause, err
482 }
483 > wfType := "" command_attr_validator.go
484 > if attributes.WorkflowType != nil {
485 > wfType = attributes.WorkflowType.GetName()
486 > }
487 > ns := attributes.GetNamespace()
488 >
489 > if wfID == "" {
490 return failedCause, serviceerror.NewInvalidArgumentf("Required field WorkflowId is not set on StartChildWorkflowExecutionCommand. WorkflowType=%s Namespace=%s", wfType, ns)
491 }
492
493 > if wfType == "" { command_attr_validator.go
494 return failedCause, serviceerror.NewInvalidArgumentf("Required field WorkflowType is not set on StartChildWorkflowExecutionCommand. WorkflowId=%s Namespace=%s", wfID, ns)
495 }
496
497 > if len(ns) > v.maxIDLengthLimit { command_attr_validator.go
498 return failedCause, serviceerror.NewInvalidArgumentf("Namespace on StartChildWorkflowExecutionCommand exceeds length limit. WorkflowId=%s WorkflowType=%s Namespace=%s Length=%d Limit=%d", wfID, wfType, ns, len(ns), v.maxIDLengthLimit)
499 }
500
501 > if len(wfID) > v.maxIDLengthLimit { command_attr_validator.go
502 return failedCause, serviceerror.NewInvalidArgumentf("WorkflowId on StartChildWorkflowExecutionCommand exceeds length limit. WorkflowId=%s Length=%d Limit=%d WorkflowType=%s Namespace=%s", wfID, len(wfID), v.maxIDLengthLimit, wfType, ns)
503 }
504
505 > if len(wfType) > v.maxIDLengthLimit { command_attr_validator.go
506 return failedCause, serviceerror.NewInvalidArgumentf("WorkflowType on StartChildWorkflowExecutionCommand exceeds length limit. WorkflowId=%s WorkflowType=%s Length=%d Limit=%d Namespace=%s", wfID, wfType, len(wfType), v.maxIDLengthLimit, ns)
507 }
508
509 > if err := timestamp.ValidateAndCapProtoDuration(attributes.GetWorkflowExecutionTimeout()); err != nil { command_attr_validator.go
510 return failedCause, serviceerror.NewInvalidArgumentf("Invalid WorkflowExecutionTimeout on StartChildWorkflowExecutionCommand: %v. WorkflowId=%s WorkflowType=%s Namespace=%s", err, wfID, wfType, ns)
511 }
512
513 > if err := timestamp.ValidateAndCapProtoDuration(attributes.GetWorkflowRunTimeout()); err != nil { command_attr_validator.go
514 return failedCause, serviceerror.NewInvalidArgumentf("Invalid WorkflowRunTimeout on StartChildWorkflowExecutionCommand: %v. WorkflowId=%s WorkflowType=%s Namespace=%s", err, wfID, wfType, ns)
515 }
516
517 > if err := timestamp.ValidateAndCapProtoDuration(attributes.GetWorkflowTaskTimeout()); err != nil { command_attr_validator.go
518 return failedCause, serviceerror.NewInvalidArgumentf("Invalid WorkflowTaskTimeout on StartChildWorkflowExecutionCommand: %v. WorkflowId=%s WorkflowType=%s Namespace=%s", err, wfID, wfType, ns)
519 }
520
521 > if err := v.validateWorkflowRetryPolicy(namespace.Name(attributes.GetNamespace()), attributes.RetryPolicy); err != nil { command_attr_validator.go
522 return failedCause, fmt.Errorf("invalid WorkflowRetryPolicy on StartChildWorkflowExecutionCommand: %w. WorkflowId=%s WorkflowType=%s Namespace=%s", err, wfID, wfType, ns)
523 }
524
525 > if err := backoff.ValidateSchedule(attributes.GetCronSchedule()); err != nil { command_attr_validator.go
526 return failedCause, fmt.Errorf("invalid CronSchedule on StartChildWorkflowExecutionCommand: %w. WorkflowId=%s WorkflowType=%s Namespace=%s", err, wfID, wfType, ns)
527 }
528
529 > if err := v.searchAttributesValidator.Validate(attributes.GetSearchAttributes(), targetNamespace.String()); err != nil { command_attr_validator.go
530 return enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES, fmt.Errorf("invalid SearchAttributes on StartChildWorkflowCommand: %w. WorkflowId=%s WorkflowType=%s Namespace=%s", err, wfID, wfType, ns)
531 }
532
533 > if err := priorities.Validate(attributes.Priority); err != nil { command_attr_validator.go
534 return failedCause, err
535 }
536
537 // Inherit taskqueue from parent workflow execution if not provided on command
538 > if attributes.TaskQueue == nil { command_attr_validator.go
539 attributes.TaskQueue = &taskqueuepb.TaskQueue{
540 Kind: enumspb.TASK_QUEUE_KIND_NORMAL,
541 }
542 }
543 > if err := tqid.NormalizeAndValidateUserDefined( command_attr_validator.go
544 > attributes.TaskQueue, parentInfo.TaskQueue, parentInfo.TaskQueue, v.maxIDLengthLimit); err != nil {
545 return failedCause, fmt.Errorf("invalid TaskQueue on StartChildWorkflowExecutionCommand: %w. WorkflowId=%s WorkflowType=%s Namespace=%s TaskQueue=%s", err, wfID, wfType, ns, attributes.TaskQueue)
546 }