Add handling of business ID policy for standalone activities#8712
Merged
fretz12 merged 107 commits intostandalone-activityfrom Dec 5, 2025
Merged
Add handling of business ID policy for standalone activities#8712fretz12 merged 107 commits intostandalone-activityfrom
fretz12 merged 107 commits intostandalone-activityfrom
Conversation
Contributor
Author
|
cursor review |
bergundy
reviewed
Nov 27, 2025
chasm/lib/activity/validator.go
Outdated
| } | ||
|
|
||
| searchAttributes.IndexedFields = unaliased.IndexedFields | ||
| req.SearchAttributes.IndexedFields = unaliased.IndexedFields |
Member
There was a problem hiding this comment.
Also mentioned on slack, do not replace the the search attributes in the request.
Contributor
Author
There was a problem hiding this comment.
Removed. Looking at the slack thread, sounds like we're moving all validation to the frontend interceptor. Is this func still needed then?
yycptt
reviewed
Nov 27, 2025
bergundy
approved these changes
Dec 1, 2025
| enumspb.ACTIVITY_ID_REUSE_POLICY_REJECT_DUPLICATE: chasm.BusinessIDReusePolicyRejectDuplicate, | ||
| } | ||
|
|
||
| // TODO this will change once we rebase on main |
Member
There was a problem hiding this comment.
Why not implement use existing already?
Contributor
Author
There was a problem hiding this comment.
I see BusinessIDConflictPolicyUseExisting on main, but doesn't look like it's on our feature branch until we rebase.
dandavison
added a commit
that referenced
this pull request
Dec 19, 2025
## What changed? Add handling of business ID policy for standalone activities. Refactored standalone activity validations. ## Why? Required so that the chasm engine will handle the business ID policies based on the RPC request. ## How did you test it? - [X] built - [X] run locally and tested manually - [X] covered by existing tests - [X] added new unit test(s) - [X] added new functional test(s) ## Potential risks Will need to add more tests once we rebase standalone-activity with main. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds business ID reuse/conflict policy handling for standalone activities, refactors validation to operate on the full request with sane defaults, and updates tests accordingly. > > - **Activity Backend**: > - Map `enumspb` activity ID reuse/conflict policies to chasm policies and pass via `chasm.WithBusinessIDPolicy` in `StartActivityExecution`. > - Propagate `RequestId` via `chasm.WithRequestID`. > - **Validation**: > - Refactor `ValidateStandaloneActivity` to accept the entire `workflowservice.StartActivityExecutionRequest` and mutate in place (request ID, ID policies, input size, search attributes). > - Add `normalizeAndValidateIDPolicy` with defaults and incompatibility checks; require request ID when attaching completion callbacks. > - Minor tweaks to input/search attributes validation paths. > - **Frontend**: > - Update `validateAndPopulateStartRequest` to use new validation signatures and remove redundant vars. > - **Tests**: > - Add/extend unit tests for ID policy defaults/mismatch, input size warning/error, and request ID length. > - Add functional tests covering ID reuse (`REJECT_DUPLICATE`, `ALLOW_DUPLICATE_FAILED_ONLY`) and conflict policy failure on existing execution. > - Adjust cancellation tests to use unique `RequestId`; remove default `RequestId` from `startActivity` helper. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1225ccc. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Dan Davison <dan.davison@temporal.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Add handling of business ID policy for standalone activities. Refactored standalone activity validations.
Why?
Required so that the chasm engine will handle the business ID policies based on the RPC request.
How did you test it?
Potential risks
Will need to add more tests once we rebase standalone-activity with main.
Note
Adds business ID reuse/conflict policy handling for standalone activities, refactors validation to operate on the full request with sane defaults, and updates tests accordingly.
enumspbactivity ID reuse/conflict policies to chasm policies and pass viachasm.WithBusinessIDPolicyinStartActivityExecution.RequestIdviachasm.WithRequestID.ValidateStandaloneActivityto accept the entireworkflowservice.StartActivityExecutionRequestand mutate in place (request ID, ID policies, input size, search attributes).normalizeAndValidateIDPolicywith defaults and incompatibility checks; require request ID when attaching completion callbacks.validateAndPopulateStartRequestto use new validation signatures and remove redundant vars.REJECT_DUPLICATE,ALLOW_DUPLICATE_FAILED_ONLY) and conflict policy failure on existing execution.RequestId; remove defaultRequestIdfromstartActivityhelper.Written by Cursor Bugbot for commit 1225ccc. This will update automatically on new commits. Configure here.