Skip to content

Conversation

@yaythomas
Copy link
Member

Description of changes:

Add a new decorator that enables cleaner API for wait_for_callback operations by allowing submitter functions to accept additional parameters that are bound at call time.

The decorator wraps callables that take callback_id, context, and additional parameters, returning a function that binds those extra parameters and produces a submitter compatible with wait_for_callback.

Changes:

  • Add durable_wait_for_callback decorator to context module
  • Export decorator from package init for public API
  • Add integration test validating parameter binding and name propagation
  • Verify operation names are correctly set on STEP and CALLBACK operations

Example usage:
@durable_wait_for_callback def submit_task(callback_id, context, task_name, priority): external_api.submit(task_name, priority, callback_id)

result = context.wait_for_callback(submit_task(my_task, priority=5))

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Add a new decorator that enables cleaner API for wait_for_callback
operations by allowing submitter functions to accept additional
parameters that are bound at call time.

The decorator wraps callables that take callback_id, context, and
additional parameters, returning a function that binds those extra
parameters and produces a submitter compatible with wait_for_callback.

Changes:
* Add durable_wait_for_callback decorator to context module
* Export decorator from package __init__ for public API
* Add integration test validating parameter binding and name propagation
* Verify operation names are correctly set on STEP and CALLBACK operations

Example usage:
  @durable_wait_for_callback
  def submit_task(callback_id, context, task_name, priority):
      external_api.submit(task_name, priority, callback_id)

  result = context.wait_for_callback(submit_task(my_task, priority=5))
@yaythomas yaythomas requested a review from wangyb-A as a code owner December 2, 2025 02:07
Copy link
Member

@bchampp bchampp left a comment

Choose a reason for hiding this comment

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

Really nice improvement. Can we add an example using this in the testing library too? 🚀

@yaythomas yaythomas merged commit 1e60904 into main Dec 2, 2025
15 checks passed
@yaythomas yaythomas deleted the wait-callback-decorator branch December 2, 2025 16:34
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