Skip to content

Commit c969b65

Browse files
Shivs11claude
andcommitted
Add revision-based suppression for pinned workflow target version signals
Add revision_number to LastNotifiedTargetVersion (server-internal) and DeclinedTargetVersionUpgrade (public API) protos. Thread TaskDispatchRevisionNumber from matching through to the target version change switch in AddWorkflowTaskStartedEvent. Case 4 now compares revision numbers instead of version strings: if the incoming target revision <= the declined revision, the signal is suppressed. This prevents trampolining when stale matching partitions send outdated target versions that differ from what was already declined. computeDeclinedTargetVersionUpgrade now carries the revision number from LastNotifiedTargetVersion into DeclinedTargetVersionUpgrade at continue-as-new time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 21a84ee commit c969b65

10,315 files changed

Lines changed: 9459788 additions & 516 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/persistence/v1/executions.pb.go

Lines changed: 16 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,5 @@ require (
216216
modernc.org/mathutil v1.7.1 // indirect
217217
modernc.org/memory v1.11.0 // indirect
218218
)
219+
220+
replace go.temporal.io/api => /Users/shivamsaraf/Desktop/work/api-go

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,6 @@ go.opentelemetry.io/otel/trace v1.40.0 h1:WA4etStDttCSYuhwvEa8OP8I5EWu24lkOzp+ZY
440440
go.opentelemetry.io/otel/trace v1.40.0/go.mod h1:zeAhriXecNGP/s2SEG3+Y8X9ujcJOTqQ5RgdEJcawiA=
441441
go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4=
442442
go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE=
443-
go.temporal.io/api v1.62.8-0.20260406230818-5423d0dd678a h1:2nCxSSKutK1VP2eA7/lw5/DfHk+UxNtr1GN5KsZTSNo=
444-
go.temporal.io/api v1.62.8-0.20260406230818-5423d0dd678a/go.mod h1:iaxoP/9OXMJcQkETTECfwYq4cw/bj4nwov8b3ZLVnXM=
445443
go.temporal.io/auto-scaled-workers v0.0.0-20260407181057-edd947d743d2 h1:1hKeH3GyR6YD6LKMHGCZ76t6h1Sgha0hXVQBxWi3dlQ=
446444
go.temporal.io/auto-scaled-workers v0.0.0-20260407181057-edd947d743d2/go.mod h1:T8dnzVPeO+gaUTj9eDgm/lT2lZH4+JXNvrGaQGyVi50=
447445
go.temporal.io/sdk v1.41.1 h1:yOpvsHyDD1lNuwlGBv/SUodCPhjv9nDeC9lLHW/fJUA=

proto/internal/temporal/server/api/persistence/v1/executions.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ message WorkflowExecutionInfo {
321321
// Used only within server persistence; never flows to the public API.
322322
message LastNotifiedTargetVersion {
323323
temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 1;
324+
// Revision number of the task queue routing config at the time the
325+
// notification was sent. Carried forward to DeclinedTargetVersionUpgrade
326+
// at continue-as-new time.
327+
int64 revision_number = 2;
324328
}
325329

326330
message ExecutionStats {

service/history/api/create_workflow_util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func NewWorkflowWithSignal(
113113
nil,
114114
false,
115115
nil,
116+
0,
116117
)
117118
if err != nil {
118119
// Unable to add WorkflowTaskStarted event to history

service/history/api/recordworkflowtaskstarted/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ func Invoke(
170170
workflowLease.GetContext().UpdateRegistry(ctx),
171171
false,
172172
req.TargetDeploymentVersion,
173+
req.TaskDispatchRevisionNumber,
173174
)
174175
if err != nil {
175176
// Unable to add WorkflowTaskStarted event to history

service/history/api/respondworkflowtaskcompleted/api.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ func (handler *WorkflowTaskCompletedHandler) Invoke(
597597
workflowLease.GetContext().UpdateRegistry(ctx),
598598
false,
599599
nil,
600+
0,
600601
)
601602
if err != nil {
602603
return nil, err
@@ -722,6 +723,7 @@ func (handler *WorkflowTaskCompletedHandler) Invoke(
722723
workflowLease.GetContext().UpdateRegistry(ctx),
723724
false,
724725
nil,
726+
0,
725727
)
726728
if err != nil {
727729
return nil, err

service/history/api/respondworkflowtaskcompleted/api_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ func (s *WorkflowTaskCompletedHandlerSuite) createSentUpdate(tv *testvars.TestVa
726726
nil,
727727
false,
728728
nil,
729+
0,
729730
)
730731
taskToken := &tokenspb.Task{
731732
Attempt: 1,
@@ -805,6 +806,7 @@ func (s *WorkflowTaskCompletedHandlerSuite) createPausedWorkflowWithWFT(tv *test
805806
nil,
806807
false,
807808
nil,
809+
0,
808810
)
809811
_, _ = ms.AddWorkflowTaskCompletedEvent(wt, &workflowservice.RespondWorkflowTaskCompletedRequest{
810812
Identity: tv.Any().String(),
@@ -822,6 +824,7 @@ func (s *WorkflowTaskCompletedHandlerSuite) createPausedWorkflowWithWFT(tv *test
822824
nil,
823825
false,
824826
nil,
827+
0,
825828
)
826829
taskToken := &tokenspb.Task{
827830
Attempt: 1,

service/history/api/verifyfirstworkflowtaskscheduled/api_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ func (s *VerifyFirstWorkflowTaskScheduledSuite) TestVerifyFirstWorkflowTaskSched
238238
nil,
239239
false,
240240
nil,
241+
0,
241242
)
242243
wt.StartedEventID = workflowTasksStartEvent.GetEventId()
243244

service/history/history_engine_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6618,6 +6618,7 @@ func addWorkflowTaskStartedEventWithRequestID(ms historyi.MutableState, schedule
66186618
nil,
66196619
false,
66206620
nil,
6621+
0,
66216622
)
66226623

66236624
return event

0 commit comments

Comments
 (0)