Skip to content

pause: return serviceerror.FailedPrecondition when pausing a Paused activity#10001

Merged
spkane31 merged 3 commits into
feature/activity-operator-cmdsfrom
spk/pause-idempotency
Apr 23, 2026
Merged

pause: return serviceerror.FailedPrecondition when pausing a Paused activity#10001
spkane31 merged 3 commits into
feature/activity-operator-cmdsfrom
spk/pause-idempotency

Conversation

@spkane31
Copy link
Copy Markdown
Contributor

What changed?

When calling PauseActivityExecution on an already paused activity a serviceerror.FailedPrecondition is returned to the user.

Why?

If a user attempts to pause an already paused activity with an identity and reason and then inspects that activity it will show a different identity and reason which is a confusing behavior, returning an error is a better way to show that the request did not alter the activity.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

No, this is into a feature branch. After merging the feature branch into main the behavior will change for workflow activities which treat Pause on an already paused activity as a no-op.

@spkane31 spkane31 requested review from a team as code owners April 21, 2026 15:16
@spkane31 spkane31 force-pushed the feature/activity-operator-cmds branch from 0845a2a to 2f5e463 Compare April 21, 2026 19:28
@spkane31 spkane31 force-pushed the spk/pause-idempotency branch from fbbb438 to 61e341c Compare April 21, 2026 20:28
@spkane31 spkane31 changed the base branch from feature/activity-operator-cmds to main April 21, 2026 22:25
@spkane31 spkane31 changed the base branch from main to feature/activity-operator-cmds April 21, 2026 22:25
@spkane31 spkane31 force-pushed the spk/pause-idempotency branch 2 times, most recently from 61e341c to 682bfe3 Compare April 22, 2026 12:40
@spkane31 spkane31 requested review from dandavison and fretz12 April 22, 2026 12:41
Comment thread chasm/lib/activity/frontend.go Outdated
}

if err := validateAndNormalizeTerminateRequest(
if req.GetRequestId() == "" {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You might need to pull in main, and we shouldn't make this change. This was moved into the validate function, and we agreed there was no need to clone the proto

// validateAndNormalizeStartActivityExecutionRequest validates and normalizes the standalone
// activity specific attributes. Note that this method mutates the input params; the caller must
// clone the request if necessary (e.g. if it may be retried).
func (h *frontendHandler) validateAndNormalizeStartActivityExecutionRequest(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that's strange why this is in the PR, shouldn't be

spkane31 added a commit that referenced this pull request Apr 22, 2026
## What changed?
Fixing a bad rebase by (1) adding
`validateAndNormalizeStartActivityExecutionRequest` function, (2)
correcting the validateXXX functions, and (3) running `make fmt` to
format the proto files.

## Why?
Fixes bad rebase and unblocks #10001 and #9852

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
NA
@spkane31 spkane31 force-pushed the spk/pause-idempotency branch from d23aaca to 9507593 Compare April 22, 2026 20:13
})

t.Run("PauseIdempotent", func(t *testing.T) {
t.Run("PauseWhilePaused", func(t *testing.T) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make sure we cover the idempotent case (same request ID)

@spkane31 spkane31 merged commit 830691b into feature/activity-operator-cmds Apr 23, 2026
45 checks passed
@spkane31 spkane31 deleted the spk/pause-idempotency branch April 23, 2026 16:23
spkane31 added a commit that referenced this pull request Apr 28, 2026
## What changed?
Fixing a bad rebase by (1) adding
`validateAndNormalizeStartActivityExecutionRequest` function, (2)
correcting the validateXXX functions, and (3) running `make fmt` to
format the proto files.

## Why?
Fixes bad rebase and unblocks #10001 and #9852

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
NA
spkane31 added a commit that referenced this pull request Apr 28, 2026
…ctivity (#10001)

## What changed?
When calling `PauseActivityExecution` on an already paused activity a
`serviceerror.FailedPrecondition` is returned to the user.

## Why?
If a user attempts to pause an already paused activity with an identity
and reason and then inspects that activity it will show a different
identity and reason which is a confusing behavior, returning an error is
a better way to show that the request did not alter the activity.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [X] added new functional test(s)

## Potential risks
No, this is into a feature branch. After merging the feature branch into
main the behavior will change for workflow activities which treat Pause
on an already paused activity as a no-op.
spkane31 added a commit that referenced this pull request Apr 29, 2026
## What changed?
Fixing a bad rebase by (1) adding
`validateAndNormalizeStartActivityExecutionRequest` function, (2)
correcting the validateXXX functions, and (3) running `make fmt` to
format the proto files.

## Why?
Fixes bad rebase and unblocks #10001 and #9852

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
NA
spkane31 added a commit that referenced this pull request Apr 29, 2026
…ctivity (#10001)

## What changed?
When calling `PauseActivityExecution` on an already paused activity a
`serviceerror.FailedPrecondition` is returned to the user.

## Why?
If a user attempts to pause an already paused activity with an identity
and reason and then inspects that activity it will show a different
identity and reason which is a confusing behavior, returning an error is
a better way to show that the request did not alter the activity.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [X] added new functional test(s)

## Potential risks
No, this is into a feature branch. After merging the feature branch into
main the behavior will change for workflow activities which treat Pause
on an already paused activity as a no-op.
spkane31 added a commit that referenced this pull request Apr 29, 2026
## What changed?
Fixing a bad rebase by (1) adding
`validateAndNormalizeStartActivityExecutionRequest` function, (2)
correcting the validateXXX functions, and (3) running `make fmt` to
format the proto files.

## Why?
Fixes bad rebase and unblocks #10001 and #9852

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
NA
spkane31 added a commit that referenced this pull request Apr 29, 2026
…ctivity (#10001)

## What changed?
When calling `PauseActivityExecution` on an already paused activity a
`serviceerror.FailedPrecondition` is returned to the user.

## Why?
If a user attempts to pause an already paused activity with an identity
and reason and then inspects that activity it will show a different
identity and reason which is a confusing behavior, returning an error is
a better way to show that the request did not alter the activity.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [X] added new functional test(s)

## Potential risks
No, this is into a feature branch. After merging the feature branch into
main the behavior will change for workflow activities which treat Pause
on an already paused activity as a no-op.
spkane31 added a commit that referenced this pull request May 11, 2026
## What changed?
Fixing a bad rebase by (1) adding
`validateAndNormalizeStartActivityExecutionRequest` function, (2)
correcting the validateXXX functions, and (3) running `make fmt` to
format the proto files.

## Why?
Fixes bad rebase and unblocks #10001 and #9852

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
NA
spkane31 added a commit that referenced this pull request May 11, 2026
…ctivity (#10001)

## What changed?
When calling `PauseActivityExecution` on an already paused activity a
`serviceerror.FailedPrecondition` is returned to the user.

## Why?
If a user attempts to pause an already paused activity with an identity
and reason and then inspects that activity it will show a different
identity and reason which is a confusing behavior, returning an error is
a better way to show that the request did not alter the activity.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [X] added new functional test(s)

## Potential risks
No, this is into a feature branch. After merging the feature branch into
main the behavior will change for workflow activities which treat Pause
on an already paused activity as a no-op.
spkane31 added a commit that referenced this pull request May 12, 2026
## What changed?
Fixing a bad rebase by (1) adding
`validateAndNormalizeStartActivityExecutionRequest` function, (2)
correcting the validateXXX functions, and (3) running `make fmt` to
format the proto files.

## Why?
Fixes bad rebase and unblocks #10001 and #9852

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
NA
spkane31 added a commit that referenced this pull request May 12, 2026
…ctivity (#10001)

## What changed?
When calling `PauseActivityExecution` on an already paused activity a
`serviceerror.FailedPrecondition` is returned to the user.

## Why?
If a user attempts to pause an already paused activity with an identity
and reason and then inspects that activity it will show a different
identity and reason which is a confusing behavior, returning an error is
a better way to show that the request did not alter the activity.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [X] added new functional test(s)

## Potential risks
No, this is into a feature branch. After merging the feature branch into
main the behavior will change for workflow activities which treat Pause
on an already paused activity as a no-op.
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.

3 participants