test_engine.go ×3

Frontier kind: Joint frontier

unlabeled · c_a114302c442d

1 test · 4230 LOC · 158 files · introduces 1 test · 61 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges61 lines · 4 files
Tests
1 test

Contains — complete concept membership

All code (extent)
866 ranges4230 lines · 158 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

4 files ranked by introduced lines: 61 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/chasm/lib/scheduler/handler.go 39 introduced LOC · 2 ranges

Open complete file

80 // CreateFromMigrationState creates a CHASM schedule from migrated V1 state.
81 // Used during migration from workflow-backed schedules to CHASM schedules.
82 > func (h *handler) CreateFromMigrationState(ctx context.Context, req *schedulerpb.CreateFromMigrationStateRequest) (resp *schedulerpb.CreateFromMigrationStateResponse, err error) { handler.go
83 > defer log.CapturePanic(h.logger, &err)
84 >
85 > scheduleID := req.GetState().GetSchedulerState().GetScheduleId()
86 > _, err = chasm.StartExecution(
87 > ctx,
88 > chasm.ExecutionKey{
89 > NamespaceID: req.NamespaceId,
90 > BusinessID: scheduleID,
91 > },
92 > CreateSchedulerFromMigration,
93 > req,
94 > )
95 >
96 > var alreadyStartedErr *chasm.ExecutionAlreadyStartedError
97 > if errors.As(err, &alreadyStartedErr) {
98 > // Check if the existing schedule is a sentinel. Sentinels are
99 > // auto-deleted SentinelIdleTime after schedule creation; the
100 > // V1 schedule will keep retrying migration until it expires.
101 > _, readErr := chasm.ReadComponent(
102 > ctx,
103 > chasm.NewComponentRef[*Scheduler](
104 > chasm.ExecutionKey{
105 > NamespaceID: req.NamespaceId,
106 > BusinessID: scheduleID,
107 > },
108 > ),
109 > func(s *Scheduler, ctx chasm.Context, _ *struct{}) (*struct{}, error) {
110 > if s.IsSentinel() {
111 > return nil, ErrSentinel
112 > }
113 return nil, nil
114 },
115 (*struct{})(nil),
116 )
117 > if readErr != nil { handler.go
118 > if errors.Is(readErr, ErrSentinel) {
119 > h.logger.Warn(
120 > fmt.Sprintf("Migration blocked by sentinel schedule; sentinel will auto-delete %v after schedule creation", SentinelIdleTime),
121 > tag.NewStringTag("schedule-id", scheduleID),
122 > )
123 > return nil, ErrSentinelBlocked
124 > }
125 return nil, readErr
126 }
go.temporal.io/server/chasm/chasmtest/test_engine.go 16 introduced LOC · 3 ranges

Open complete file

134 current, hasCurrent := e.currentExecutions[bKey]
135 if hasCurrent {
136 > // if the requestID matches the original create request, return the existing run. test_engine.go
137 > if options.RequestID != "" && options.RequestID == current.requestID {
138 serializedRef, err := current.node.Ref(current.root)
139 if err != nil {
147 }
148
149 > switch current.backend.GetExecutionState().State { test_engine.go
150 > case enumsspb.WORKFLOW_EXECUTION_STATE_CREATED, enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING:
151 > return e.handleConflictPolicy(ctx, ref, current, startFn, options)
152 case enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED:
153 return e.handleReusePolicy(ctx, ref, current, startFn, options)
349 startFn func(chasm.MutableContext) (chasm.RootComponent, error),
350 options chasm.TransitionOptions,
351 > ) (chasm.StartExecutionResult, error) { test_engine.go
352 > switch options.ConflictPolicy {
353 > case chasm.BusinessIDConflictPolicyFail:
354 > return chasm.StartExecutionResult{}, chasm.NewExecutionAlreadyStartedErr(
355 > fmt.Sprintf(
356 > "CHASM execution still running. BusinessID: %s, RunID: %s, ID Conflict Policy: %v",
357 > ref.BusinessID, current.key.RunID, options.ConflictPolicy,
358 > ),
359 > current.requestID,
360 > current.key.RunID,
361 > )
362 case chasm.BusinessIDConflictPolicyTerminateExisting:
363 _, _ = current.backend.UpdateWorkflowStateStatus(
go.temporal.io/server/chasm/lib/scheduler/gen/schedulerpb/v1/message.pb.go 4 introduced LOC · 1 range

Open complete file

117 }
118
119 > func (x *SchedulerState) GetScheduleId() string { message.pb.go
120 > if x != nil {
121 > return x.ScheduleId
122 > }
123 return ""
124 }
go.temporal.io/server/chasm/engine.go 2 introduced LOC · 1 range

Open complete file

263 )
264 if err != nil {
265 > return StartExecutionResult{}, err engine.go
266 > }
267
268 return StartExecutionResult{