-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Issue 3353: Investigate antisymmetry failure for UpperBounded for Duration #3470
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3470 +/- ##
==========================================
+ Coverage 91.10% 91.33% +0.23%
==========================================
Files 385 386 +1
Lines 8565 8591 +26
Branches 260 260
==========================================
+ Hits 7803 7847 +44
+ Misses 762 744 -18 |
Thanks for looking into this. Did you happen to dig up why Cats is currently using custom instances for these types? Dropping them doesn't seem unreasonable to me, but it'd be nice to make sure we know the context and reason someone added them in the first place. |
That's absolutely right. I could track the addition to this change #1878 by @non that is after the addition of |
@barambani Thanks for finding that! Let's leave it open for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that these implicits are only present in test code, I think it's fairly straightforward to drop them.
Thanks for checking 😄 . The risk is we are not exploring enough the space though. The intermittent failure can be because of an error in those numbers but it might also be the case that they are triggering a problem somewhere else. The ideal would be to have some advise from the author ( @non ) but I'm happy to move this on anyway. |
I'd rather err on the side of non-flaky builds, so I'm going to merge this. |
This is an attempt to fix #3353. What I observed is that the failure occurs here
when
x
andy
are equivalent (such as -4680 hours and -195 days) butf(x)
andf(y)
are not. The problem should be in the wayCogen
forDuration
andFiniteDuration
works here.The proposed solution is to use
Duration
andFiniterDuration
'sCogen
that ships with ScalaCheck as I assume are correct and tested. It uses the nanoseconds representation for the seed perturbation, that seems reasonable here, in the sense that a function applied to the same duration should give the same result even if it's represented in different units.I added also a couple of tests that trigger the problem with the current master. To make sure the change actually fixes the case I have been running the tests with
without a single failure.
Anyway I'm not sure what's the logic behind the current
Cogen
's implementation and the semantics of those numbers, so I'm more than happy to close this if it's not a good enough solution.