Skip to content

Conversation

ondravondra
Copy link
Contributor

close #7254

@Aaronontheweb
Copy link
Member

Thanks for the PR - looks like this broke some tests

@ondravondra ondravondra force-pushed the bugfix/7254-ask-object-failure branch from 702ee75 to d12dea9 Compare November 11, 2024 09:43
@ondravondra ondravondra force-pushed the bugfix/7254-ask-object-failure branch from d12dea9 to 9f7f91b Compare November 11, 2024 09:53
@ondravondra
Copy link
Contributor Author

It seems that the framework relies on this behavior.
For example, test Inbox_Receive_will_timeout_gracefully_if_timeout_is_already_expired uses Akka.Actor.Inbox.Receive that calls Ask<object> and expects the result to be Status.Failure.
A bit of a pickle innit.

@Aaronontheweb
Copy link
Member

It seems that the framework relies on this behavior. For example, test Inbox_Receive_will_timeout_gracefully_if_timeout_is_already_expired uses Akka.Actor.Inbox.Receive that calls Ask<object> and expects the result to be Status.Failure. A bit of a pickle innit.

Probably just poor test design - at least that was my gut feeling when I looked at this PR. I'll give it another look when I can

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

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

LGTM

@Arkatufus Arkatufus enabled auto-merge (squash) June 26, 2025 18:53
@Aaronontheweb Aaronontheweb disabled auto-merge June 26, 2025 20:16
@Aaronontheweb Aaronontheweb merged commit 752e73a into akkadotnet:dev Jun 26, 2025
9 of 11 checks passed
@lucavice
Copy link
Contributor

Hi here.

I wanted to report that after updating to 1.5.45+, I noticed some parts of the project I am working on stopped working as intended.
Turns out that some parts of our codebase relied on that behaviour that @ondravondra reported for some of those tests.
In my case, I found:

 var orderQueryResponse = await DomainService<CheckoutDomainService>.Ask<object>(Mediator, getOrderQuery);
 if (orderQueryResponse is Status.Failure sf)
   {
      // does something if you got back a failure

This code was probably bad design in the first place, but I wanted to let you know just in case other people may have used the same pattern and they are experiencing a breaking change after updating. I actually like what the PR is introducing and I think it makes sense.

@Aaronontheweb
Copy link
Member

Thanks for weighing in @lucavice - I agree with all of this. Changing the behavior was probably the right call so the PR was a good idea, but yeah it's going to cause breaking behavioral changes for components that relied on the old sub-optimal behavior. Thanks for documenting this in case other users get bit by it too.

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.

Ask<object> will not throw exception when the response is Status.Failure
4 participants