command_attr_validator.go ×4

Frontier kind: Code frontier

unlabeled · c_bc0a3c7cd9cc

3 tests · 9561 LOC · 264 files · introduces 0 tests · 28 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges28 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2044 ranges9561 lines · 264 files · Browse complete extent
All tests (intent)
3 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.

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

go.temporal.io/server/service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go 12 introduced LOC · 3 ranges

Open complete file

306 historyEvent, err = handler.handleCommandRequestCancelActivity(ctx, command.GetRequestCancelActivityTaskCommandAttributes())
307
308 > case enumspb.COMMAND_TYPE_CANCEL_TIMER: workflow_task_completed_handler.go
309 > historyEvent, err = handler.handleCommandCancelTimer(ctx, command.GetCancelTimerCommandAttributes())
310
311 case enumspb.COMMAND_TYPE_RECORD_MARKER:
916 _ context.Context,
917 attr *commandpb.CancelTimerCommandAttributes,
918 > ) (*historypb.HistoryEvent, error) { workflow_task_completed_handler.go
919 > if err := handler.validateCommandAttr(
920 > func() (enumspb.WorkflowTaskFailedCause, error) {
921 > return handler.attrValidator.ValidateTimerCancelAttributes(attr)
922 > },
923 ); err != nil || handler.stopProcessing {
924 return nil, err
925 }
926
927 > event, err := handler.mutableState.AddTimerCanceledEvent( workflow_task_completed_handler.go
928 > handler.workflowTaskCompletedID,
929 > attr,
930 > handler.identity)
931 > if err != nil {
932 return nil, handler.failWorkflowTaskOnInvalidArgument(enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES, err)
933 }
go.temporal.io/server/service/history/api/command_attr_validator.go 9 introduced LOC · 4 ranges

Open complete file

179 func (v *CommandAttrValidator) ValidateTimerCancelAttributes(
180 attributes *commandpb.CancelTimerCommandAttributes,
181 > ) (enumspb.WorkflowTaskFailedCause, error) { command_attr_validator.go
182 >
183 > const failedCause = enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES
184 > if attributes == nil {
185 return failedCause, serviceerror.NewInvalidArgument("CancelTimerCommandAttributes is not set on CancelTimerCommand.")
186 }
187
188 > timerID := attributes.GetTimerId() command_attr_validator.go
189 >
190 > if timerID == "" {
191 return failedCause, serviceerror.NewInvalidArgument("TimerId is not set on CancelTimerCommand.")
192 }
193 > if len(timerID) > v.maxIDLengthLimit { command_attr_validator.go
194 return failedCause, serviceerror.NewInvalidArgumentf("TimerId on CancelTimerCommand exceeds length limit. TimerId=%s Length=%d Limit=%d", timerID, len(timerID), v.maxIDLengthLimit)
195 }
196 > return enumspb.WORKFLOW_TASK_FAILED_CAUSE_UNSPECIFIED, nil command_attr_validator.go
197 }
198
go.temporal.io/server/service/history/workflow/mutable_state_impl.go 7 introduced LOC · 2 ranges

Open complete file

5471 command *commandpb.CancelTimerCommandAttributes,
5472 identity string,
5473 > ) (*historypb.HistoryEvent, error) { mutable_state_impl.go
5474 > opTag := tag.WorkflowActionTimerCanceled
5475 > if err := ms.checkMutability(opTag); err != nil {
5476 return nil, err
5477 }
5478
5479 > var timerStartedEventID int64 mutable_state_impl.go
5480 > timerID := command.GetTimerId()
5481 > ti, ok := ms.GetUserTimerInfo(timerID)
5482 > if !ok {
5483 // if timer is not running then check if it has fired in the mutable state.
5484 // If so clear the timer from the mutable state. We need to check both the