command_attr_validator.go ×5

Frontier kind: Code frontier

unlabeled · c_6f260b014820

4 tests · 3262 LOC · 146 files · introduces 0 tests · 21 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges21 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
457 ranges3262 lines · 146 files · Browse complete extent
All tests (intent)
4 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: 21 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/command_attr_validator.go 11 introduced LOC · 5 ranges

Open complete file

141 func (v *CommandAttrValidator) ValidateTimerScheduleAttributes(
142 attributes *commandpb.StartTimerCommandAttributes,
143 > ) (enumspb.WorkflowTaskFailedCause, error) { command_attr_validator.go
144 >
145 > const failedCause = enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES
146 >
147 > if attributes == nil {
148 return failedCause, serviceerror.NewInvalidArgument("StartTimerCommandAttributes is not set on StartTimerCommand.")
149 }
150
151 > timerID := attributes.GetTimerId() command_attr_validator.go
152 >
153 > if timerID == "" {
154 return failedCause, serviceerror.NewInvalidArgument("TimerId is not set on StartTimerCommand.")
155 }
156 > if len(timerID) > v.maxIDLengthLimit { command_attr_validator.go
157 return failedCause, serviceerror.NewInvalidArgumentf("TimerId on StartTimerCommand exceeds length limit. TimerId=%s Length=%d Limit=%d", timerID, len(timerID), v.maxIDLengthLimit)
158 }
159 > if err := timestamp.ValidateAndCapProtoDuration(attributes.GetStartToFireTimeout()); err != nil { command_attr_validator.go
160 return failedCause, serviceerror.NewInvalidArgumentf("An invalid StartToFireTimeout is set on StartTimerCommand: %v. TimerId=%s", err, timerID)
161 }
162 > return enumspb.WORKFLOW_TASK_FAILED_CAUSE_UNSPECIFIED, nil command_attr_validator.go
163 }
164
go.temporal.io/server/service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go 10 introduced LOC · 4 ranges

Open complete file

300 historyEvent, err = handler.handleCommandCancelWorkflow(ctx, command.GetCancelWorkflowExecutionCommandAttributes())
301
302 > case enumspb.COMMAND_TYPE_START_TIMER: workflow_task_completed_handler.go
303 > historyEvent, err = handler.handleCommandStartTimer(ctx, command.GetStartTimerCommandAttributes())
304
305 case enumspb.COMMAND_TYPE_REQUEST_CANCEL_ACTIVITY_TASK:
772 _ context.Context,
773 attr *commandpb.StartTimerCommandAttributes,
774 > ) (*historypb.HistoryEvent, error) { workflow_task_completed_handler.go
775 > if err := handler.validateCommandAttr(
776 > func() (enumspb.WorkflowTaskFailedCause, error) {
777 > return handler.attrValidator.ValidateTimerScheduleAttributes(attr)
778 > },
779 ); err != nil || handler.stopProcessing {
780 return nil, err
781 }
782
783 > event, _, err := handler.mutableState.AddTimerStartedEvent(handler.workflowTaskCompletedID, attr) workflow_task_completed_handler.go
784 > if err != nil {
785 return nil, handler.failWorkflowTaskOnInvalidArgument(enumspb.WORKFLOW_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID, err)
786 }
787 > return event, nil workflow_task_completed_handler.go
788 }
789