Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Allow Update Validators to be async #1542

Open
mloffer opened this issue Oct 9, 2024 · 0 comments
Open

[Feature Request] Allow Update Validators to be async #1542

mloffer opened this issue Oct 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@mloffer
Copy link

mloffer commented Oct 9, 2024

Is your feature request related to a problem? Please describe.

I would like to be able to use async operations inside of Update Validators.

Use Case

I need to check complex access controls via a database query (e.g. state of an object in the database; ACL/ABAC/etc), and return an error to the caller if not allowed.

Describe the solution you'd like

Asynchronous Update Validators.

Additional context

While the Temporal documentation is fairly clear that Validators must be synchronous, there still seems to be a reasonable expectation that any and everything can be async, as demonstrated by this line in the temporalio/samples-typescript repo. I originally copied this pattern before discovering that Temporal treats async validators as though they are Activities, i.e. logging them to the Workflow Event History and not returning errors to the caller. (So if this feature request is rejected, that code should at least be updated so as not to be misleading.)

Alternatives

I can convert my access control validators (or anything else that requires async logic) to Activities and call them from their respective Update handlers. However, this will litter the Workflow Event History with largely irrelevant information, and will also require additional logic to poll the Workflow for the result of the access control Activity to see if the Update was even allowed.

@mloffer mloffer added the enhancement New feature or request label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant