Skip to content

Conversation

@fretz12
Copy link
Contributor

@fretz12 fretz12 commented Nov 26, 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?

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

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.

  • 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.

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

@fretz12 fretz12 marked this pull request as ready for review November 26, 2025 21:56
@fretz12 fretz12 requested review from a team as code owners November 26, 2025 21:56
@fretz12
Copy link
Contributor Author

fretz12 commented Nov 26, 2025

cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


}

searchAttributes.IndexedFields = unaliased.IndexedFields
req.SearchAttributes.IndexedFields = unaliased.IndexedFields
Copy link
Member

Choose a reason for hiding this comment

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

Also mentioned on slack, do not replace the the search attributes in the request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed. Looking at the slack thread, sounds like we're moving all validation to the frontend interceptor. Is this func still needed then?

@fretz12 fretz12 requested review from bergundy and yycptt December 1, 2025 17:00
enumspb.ACTIVITY_ID_REUSE_POLICY_REJECT_DUPLICATE: chasm.BusinessIDReusePolicyRejectDuplicate,
}

// TODO this will change once we rebase on main
Copy link
Member

Choose a reason for hiding this comment

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

Why not implement use existing already?

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 see BusinessIDConflictPolicyUseExisting on main, but doesn't look like it's on our feature branch until we rebase.

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.

4 participants