Skip to content

Conversation

stephanos
Copy link
Contributor

@stephanos stephanos commented Apr 24, 2025

⚠️ Before this is merged, the StartWorkflowExecutionResponse API needs to have a new field Running added to it.

What changed?

When UwS is applied to a closes Workflow where the requested Update (identified by its Update ID) has already been completed, return the Update outcome.

Note that this only applies to the current execution; not any previous execution.

Why?

Align UwS behavior with Update; a regular Update also returns its outcome from a closed Workflow.

How did you test it?

New tests.

Potential risks

Documentation

Is hotfix candidate?

@stephanos stephanos changed the title [WiP] Update-with-Start returns closed workflow's Outcome Update-with-Start returns closed workflow's Outcome Apr 24, 2025
&historyservice.StartWorkflowExecutionResponse{
RunId: workflowKey.RunID,
Started: false, // set explicitly for emphasis
// TODO: Running: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires an API change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you need to rename it to status here too but as soon as it is just a comment it doesn't really matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'll save the planet by not pushing the comment update now; and will fix it in the next PR.

return runningWorkflowLease, nil
}

func (mo *multiOp) allowUpdateWorkflow(
ctx context.Context,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused.

@stephanos stephanos requested a review from alexshtin April 25, 2025 16:09
@stephanos stephanos marked this pull request as ready for review April 25, 2025 16:15
@stephanos stephanos requested a review from a team as a code owner April 25, 2025 16:15
s.NoError(uwsRes.err)
startResp := uwsRes.response.Responses[0].GetStartWorkflow()
updateRep := uwsRes.response.Responses[1].GetUpdateWorkflow()
s.False(startResp.Started)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to assert on new status field here after you add it.

&historyservice.StartWorkflowExecutionResponse{
RunId: workflowKey.RunID,
Started: false, // set explicitly for emphasis
// TODO: Running: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you need to rename it to status here too but as soon as it is just a comment it doesn't really matter.

@stephanos stephanos merged commit ec4a2fd into temporalio:main Apr 29, 2025
50 checks passed
stephanos added a commit to temporalio/api that referenced this pull request May 1, 2025
_**READ BEFORE MERGING:** All PRs require approval by both Server AND
SDK teams before merging! This is why the number of required approvals
is "2" and not "1"--two reviewers from the same team is NOT sufficient.
If your PR is not approved by someone in BOTH teams, it may be summarily
reverted._

<!-- Describe what has changed in this PR -->
**What changed?**

Added field `WorkflowExecutionStatus status` to
`StartWorkflowExecutionResponse`.

<!-- Tell your future self why have you made these changes -->
**Why?**

To align Update-with-Start's behavior with a regular Update. A regular
Update returns its outcome from a closed Workflow, to make
Update-with-Start do the same thing, it needs to returns a successful
response in that case. But that would tell the user that a running
Workflow exists. To help the user distinguish whether UwS operated on a
closed or running workflow, this field is introduced.

<!-- Are there any breaking changes on binary or code level? -->
**Breaking changes**

No.

<!-- If this breaks the Server, please provide the Server PR to merge
right after this PR was merged. -->
**Server PR**

temporalio/temporal#7656
temporal-cicd bot pushed a commit to temporalio/api-go that referenced this pull request May 1, 2025
_**READ BEFORE MERGING:** All PRs require approval by both Server AND
SDK teams before merging! This is why the number of required approvals
is "2" and not "1"--two reviewers from the same team is NOT sufficient.
If your PR is not approved by someone in BOTH teams, it may be summarily
reverted._

<!-- Describe what has changed in this PR -->
**What changed?**

Added field `WorkflowExecutionStatus status` to
`StartWorkflowExecutionResponse`.

<!-- Tell your future self why have you made these changes -->
**Why?**

To align Update-with-Start's behavior with a regular Update. A regular
Update returns its outcome from a closed Workflow, to make
Update-with-Start do the same thing, it needs to returns a successful
response in that case. But that would tell the user that a running
Workflow exists. To help the user distinguish whether UwS operated on a
closed or running workflow, this field is introduced.

<!-- Are there any breaking changes on binary or code level? -->
**Breaking changes**

No.

<!-- If this breaks the Server, please provide the Server PR to merge
right after this PR was merged. -->
**Server PR**

temporalio/temporal#7656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants