Skip to content

Standalone Activity refactor for consistency with Standalone Nexus Operations#9795

Merged
dandavison merged 3 commits intomainfrom
saa-retain-request-ids-refactor
Apr 9, 2026
Merged

Standalone Activity refactor for consistency with Standalone Nexus Operations#9795
dandavison merged 3 commits intomainfrom
saa-retain-request-ids-refactor

Conversation

@dandavison
Copy link
Copy Markdown
Contributor

@dandavison dandavison commented Apr 2, 2026

What changed?

Pure refactoring and renaming with no functional changes.

  • Move request-ID generation into validation functions
  • Rename delete method

Why?

For consistency with Standalone Nexus Operations

How did you test it?

  • covered by existing tests

Note

Medium Risk
Mostly a refactor, but it changes where/when server-generated request_ids are assigned for start/terminate/cancel, which can affect idempotency and retry behavior if incorrect.

Overview
Refactors standalone activity request validation to use new validateAndNormalize*Request helpers, consolidating start/cancel/terminate/delete validation and renaming timeout/ID-policy normalizers for consistency.

Moves server-side RequestId generation into the validation functions (and adjusts start request cloning so retries reuse the same generated ID), with tests updated/added to assert request_id stability across repeated validation for start/terminate/cancel.

Written by Cursor Bugbot for commit afb0fa5. This will update automatically on new commits. Configure here.

@dandavison dandavison requested a review from a team as a code owner April 2, 2026 21:38
@dandavison dandavison requested review from fretz12 and stephanos April 2, 2026 21:38
@dandavison dandavison force-pushed the saa-retain-request-ids-refactor branch 2 times, most recently from 194be87 to 1e068db Compare April 2, 2026 21:44
saValidator *searchattribute.Validator,
) error {
if req.GetRequestId() == "" {
req.RequestId = uuid.NewString()
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.

I think this can never happen because validateAndPopulateStartRequest already does that?

Copy link
Copy Markdown
Contributor Author

@dandavison dandavison Apr 2, 2026

Choose a reason for hiding this comment

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

Good spot. It's true, and this is questionable, but it bothered me to have the cancel and terminate ones doing it and the start one not doing it. That would mean the start one "knows" about what's going on in its upstream caller. So I decided to pay one instruction (or whatever) here and get consistency and future-proofing in return. But lmk if you don't like it.

"TerminateActivityExecution",
blobSizeLimitError,
blobSizeLimitWarn,
len(req.GetReason()),
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.

FYI we changed this to use a custom dc instead since we found blob size is way too big

firstID := getRequestId()
require.NoError(t, validate())
require.Equal(t, firstID, 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.

optional: if you wanted to be clever and remove some duplication you could have this use an interface that only provides GetRequestId; then you can pass both StartActivityExecutionRequest and TerminateActivityExecutionRequest into it

Base automatically changed from saa-retain-request-ids to main April 2, 2026 23:40
@dandavison dandavison force-pushed the saa-retain-request-ids-refactor branch from 1e068db to 755a00e Compare April 2, 2026 23:52
Use a package-level atomic to fail StartActivityExecution once after the
activity is created at history, triggering the RetryableInterceptor.
Without the fix, the retry generates a new request ID and gets
ActivityExecutionAlreadyStarted. With the fix, the retry reuses the
same request ID and the dedup succeeds.
@dandavison dandavison force-pushed the saa-retain-request-ids-refactor branch from 755a00e to 639dca2 Compare April 2, 2026 23:53
- Move request-ID generation into validation functions
- Rename delete method
@dandavison dandavison force-pushed the saa-retain-request-ids-refactor branch from 639dca2 to afb0fa5 Compare April 3, 2026 00:20
@dandavison dandavison merged commit ad37da9 into main Apr 9, 2026
48 checks passed
@dandavison dandavison deleted the saa-retain-request-ids-refactor branch April 9, 2026 11:07
stephanos pushed a commit that referenced this pull request Apr 13, 2026
…erations (#9795)

## What changed?
Pure refactoring and renaming with no functional changes.
- Move request-ID generation into validation functions
- Rename delete method

## Why?
For consistency with Standalone Nexus Operations

## How did you test it?
- [x] covered by existing tests
- [x] added new unit tests

## What could break
Could break requestID-based deduplication for Standalone Activity.
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