Skip to content

Increase visibility on some client constructs and minor docs updates #434

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

Merged
merged 2 commits into from
Apr 9, 2025

Conversation

cretz
Copy link
Member

@cretz cretz commented Mar 18, 2025

What was changed

  • Exposed constructors as protected internal on multiple currently-internal-constructor-only classes returned from client calls so they can be mocked, but added warning that we may change them in incompatible ways in the future
    • We don't really want to commit to constructor stability here IMO at this time
    • Yes it is a bit annoying that they are internal and therefore you have to extend them to construct them, but we feel public encourages using these constructors too much, something we are actually discouraging
  • Made final overloads of some client calls virtual so they can be overridden in subclasses
  • Added docs as needed

Why?

Checklist

  1. Closes [Feature Request] Add visibility link in list workflow method XML doc #218
  2. Closes [Feature Request] Make sure all client responses are user-instantiable/mockable #228
  3. Closes [Feature Request] Requesting that WorkflowHandle's members are marked virtual or inherit from interface #419

@cretz cretz requested a review from a team March 18, 2025 20:47
Copy link

@neiljohari neiljohari left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Thank you!

question: so as a customer to use this, I'll likely extend and create fixture versions of things like WorkflowExecution in my unit tests project? Is that the goal? Seems reasonable if it is

Also is there a preview build of this package on NuGet I could use to try out and give feedback?

@cretz
Copy link
Member Author

cretz commented Mar 19, 2025

I'll likely extend and create fixture versions of things like WorkflowExecution in my unit tests project? Is that the goal? Seems reasonable if it is

Yes, you can extend WorkflowExecution with your own and call the base constructor with the advanced things needed to construct it since it is from raw proto. We discourage mocking clients usually because it can be hard to ever get the details of what the server does right, which is why we offer test environments that start real servers that we encourage people to use (i.e. Temporalio.Testing.WorkflowEnvironment.StartLocalAsync() which returns an environment with a fully usable Client on it).

Also is there a preview build of this package on NuGet I could use to try out and give feedback?

No, it will be available in next stable release after merged, but we do not publish NuGet preview releases. Though you can build it yourself (see bottom of README) or once merged to main, the main merge commit GitHub CI run will have artifacts with the NuGet package on it.

@cretz cretz merged commit 9ac9d69 into temporalio:main Apr 9, 2025
9 checks passed
@cretz cretz deleted the expose-client branch April 9, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants