Skip to content

Nondeterministic failures on version 3.2.1 #337

Closed
@michaeldiscala

Description

@michaeldiscala

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions