Hi there,
When we bumped our application from version 3.1.9 to version 3.2.1 we started getting nondeterministic failures in our test suite.
The problematic code does:
ZERO = BigDecimal("0").freeze
and then uses this when calculating an average of an array of number:
x_average = x_values.sum(ZERO) / x_values.size
The error returned has been:
[2025-06-02T17:48:02Z] Failure/Error: x_average = x_values.sum(ZERO) / x_values.size
--
| [2025-06-02T17:48:02Z]
| [2025-06-02T17:48:02Z] TypeError:
| [2025-06-02T17:48:02Z] Proc can't be coerced into BigDecimal
| [2025-06-02T17:48:02Z] # ./lib/utils/regression_line.rb:22:in `/'
but we've also seen it error out with a string type:
String can't be coerced into BigDecimal (TypeError)
x_average = x_values.sum(ZERO) / x_values.size
^^^^^^^^^^^^^
I initially assumed that we were somehow passing a string into x_values, but since the issue is non-deterministic, I'm not sure how that could be the case. I tried to reproduce by running a similar sum operation in a loop but wasn't able to reproduce there.
Do you have any ideas on what might be causing this after the upgrade? Is there any other debugging information I can provide?
Thank you!
--Mike
Hi there,
When we bumped our application from version 3.1.9 to version 3.2.1 we started getting nondeterministic failures in our test suite.
The problematic code does:
and then uses this when calculating an average of an array of number:
The error returned has been:
but we've also seen it error out with a string type:
I initially assumed that we were somehow passing a string into
x_values, but since the issue is non-deterministic, I'm not sure how that could be the case. I tried to reproduce by running a similar sum operation in a loop but wasn't able to reproduce there.Do you have any ideas on what might be causing this after the upgrade? Is there any other debugging information I can provide?
Thank you!
--Mike