ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
@ 2024-11-05 20:09 sanderd17 (Sander Deryckere) via ruby-core
  2024-11-05 20:25 ` [ruby-core:119752] " sanderd17 (Sander Deryckere) via ruby-core
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: sanderd17 (Sander Deryckere) via ruby-core @ 2024-11-05 20:09 UTC (permalink / raw)
  To: ruby-core; +Cc: sanderd17 (Sander Deryckere)

Issue #20871 has been reported by sanderd17 (Sander Deryckere).

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871

* Author: sanderd17 (Sander Deryckere)
* Status: Open
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119752] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
@ 2024-11-05 20:25 ` sanderd17 (Sander Deryckere) via ruby-core
  2024-11-18  5:02 ` [ruby-core:119954] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sanderd17 (Sander Deryckere) via ruby-core @ 2024-11-05 20:25 UTC (permalink / raw)
  To: ruby-core; +Cc: sanderd17 (Sander Deryckere)

Issue #20871 has been updated by sanderd17 (Sander Deryckere).


Forgot to mention.

We use the `parallel_tests` gem to speed up our specs in CI.

On my local environment, with synchronous tests, I haven't been able to reproduce the same behaviour either.

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110416

* Author: sanderd17 (Sander Deryckere)
* Status: Open
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119954] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
  2024-11-05 20:25 ` [ruby-core:119752] " sanderd17 (Sander Deryckere) via ruby-core
@ 2024-11-18  5:02 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2024-11-18  7:24 ` [ruby-core:119955] " rolf (Rolf T) via ruby-core
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2024-11-18  5:02 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #20871 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Feedback

The example works as expected on Ruby 3.3.6.  It seems unlikely the commit you are referencing is related, because the commits fixes an issue where the method cache is not updated on a change, it wouldn't cause the method not to show up at all.  Are you able to provide a self-contained reproducible example for this issue?

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110683

* Author: sanderd17 (Sander Deryckere)
* Status: Feedback
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119955] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
  2024-11-05 20:25 ` [ruby-core:119752] " sanderd17 (Sander Deryckere) via ruby-core
  2024-11-18  5:02 ` [ruby-core:119954] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2024-11-18  7:24 ` rolf (Rolf T) via ruby-core
  2024-11-18  9:12 ` [ruby-core:119956] " rolf (Rolf T) via ruby-core
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rolf (Rolf T) via ruby-core @ 2024-11-18  7:24 UTC (permalink / raw)
  To: ruby-core; +Cc: rolf (Rolf T)

Issue #20871 has been updated by rolf (Rolf T).


We are running into the exact same problem. I was not able to reproduce it except as part of a Rails application. Maybe that's not exactly helpful, but hopefully this helps zoom in further on the issue. The problem seems to be introduced in Ruby 3.3.6.

A working reproduction is here: https://github.com/rolftimmermans/ruby-20871

With Ruby 3.3.6 via irb there seems to be no issue:

``` ruby
% irb                    
irb(main):001> RUBY_VERSION
=> "3.3.6"
irb(main):002> require_relative "lib/ext"
=> true
irb(main):003> [].foo
=> "foo"
```

With Ruby 3.3.6 via Rails console the bug manifests itself:

```ruby
% rails c
Loading development environment (Rails 7.1.5)
irb(main):001> RUBY_VERSION
=> "3.3.6"
irb(main):002> require_relative "lib/ext"
=> true
irb(main):003> [].foo
(irb):3:in `<main>': undefined method `foo' for an instance of Array (NoMethodError)

[].foo
  ^^^^
```

With Ruby 3.3.5 via Rails console everything is working fine:

```ruby
% rails c     
/Users/rolftimmermans/.rubies/ruby-3.3.5/lib/ruby/3.3.0/json/generic_object.rb:2: warning: /Users/rolftimmermans/.rubies/ruby-3.3.5/lib/ruby/3.3.0/ostruct.rb was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add ostruct to your Gemfile or gemspec to silence this warning.
Loading development environment (Rails 7.1.5)
irb(main):001> RUBY_VERSION
=> "3.3.5"
irb(main):002> require_relative "lib/ext"
=> true
irb(main):003> [].foo
=> "foo"
```

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110686

* Author: sanderd17 (Sander Deryckere)
* Status: Feedback
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119956] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (2 preceding siblings ...)
  2024-11-18  7:24 ` [ruby-core:119955] " rolf (Rolf T) via ruby-core
@ 2024-11-18  9:12 ` rolf (Rolf T) via ruby-core
  2024-11-19  8:43 ` [ruby-core:119964] " tdeo (Thierry Deo) via ruby-core
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rolf (Rolf T) via ruby-core @ 2024-11-18  9:12 UTC (permalink / raw)
  To: ruby-core; +Cc: rolf (Rolf T)

Issue #20871 has been updated by rolf (Rolf T).


I managed to narrow it down a bit further. With the versions specified in https://github.com/rolftimmermans/ruby-20871/blob/main/Gemfile.lock:

```ruby
% irb
irb(main):001> require "active_support"
irb(main):002> require "active_support/json/decoding"
irb(main):003> require "active_support/core_ext/object/try"
irb(main):004> 
irb(main):005* class Foo
irb(main):006*   include Enumerable
irb(main):007> end
irb(main):008> 
irb(main):009* module Ext
irb(main):010*   def foo
irb(main):011*     "foo"
irb(main):012*   end
irb(main):013> end
irb(main):014> 
irb(main):015> Enumerable.include(Ext)
irb(main):016> 
=> Enumerable
irb(main):017> [].foo
(irb):17:in `<main>': undefined method `foo' for an instance of Array (NoMethodError)

[].foo
  ^^^^
	from <internal:kernel>:187:in `loop'
	from /Users/rolftimmermans/.gem/ruby/3.3.6/gems/irb-1.14.1/exe/irb:9:in `<top (required)>'
	from /Users/rolftimmermans/.gem/ruby/3.3.6/bin/irb:25:in `load'
	from /Users/rolftimmermans/.gem/ruby/3.3.6/bin/irb:25:in `<main>'
```


----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110687

* Author: sanderd17 (Sander Deryckere)
* Status: Feedback
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119964] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (3 preceding siblings ...)
  2024-11-18  9:12 ` [ruby-core:119956] " rolf (Rolf T) via ruby-core
@ 2024-11-19  8:43 ` tdeo (Thierry Deo) via ruby-core
  2024-11-19 14:37 ` [ruby-core:119968] " sanderd17 (Sander Deryckere) via ruby-core
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tdeo (Thierry Deo) via ruby-core @ 2024-11-19  8:43 UTC (permalink / raw)
  To: ruby-core; +Cc: tdeo (Thierry Deo)

Issue #20871 has been updated by tdeo (Thierry Deo).


I'm running into a similar situation which I managed to reproduce with a plain ruby console and no external dependencies:

```ruby
$ irb
irb(main):001> 
module Bar; def bar; 'bar'; end; end
module Foo; def foo; 'foo'; end; end

Enumerable.prepend Bar
Class.new { include Enumerable }

Enumerable.include Foo

puts [].foo

(irb):9:in `<main>': undefined method `foo' for an instance of Array (NoMethodError)

puts [].foo
       ^^^^
        from <internal:kernel>:187:in `loop'
        from /Users/thierry/.asdf/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/exe/irb:9:in `<top (required)>'
        from /Users/thierry/.asdf/installs/ruby/3.3.6/bin/irb:25:in `load'
        from /Users/thierry/.asdf/installs/ruby/3.3.6/bin/irb:25:in `<main>'
```

Removing either of the `Enumerable.prepend` or `Class.new` lines makes the bug go away

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110700

* Author: sanderd17 (Sander Deryckere)
* Status: Feedback
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119968] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (4 preceding siblings ...)
  2024-11-19  8:43 ` [ruby-core:119964] " tdeo (Thierry Deo) via ruby-core
@ 2024-11-19 14:37 ` sanderd17 (Sander Deryckere) via ruby-core
  2024-11-19 15:36 ` [ruby-core:119969] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sanderd17 (Sander Deryckere) via ruby-core @ 2024-11-19 14:37 UTC (permalink / raw)
  To: ruby-core; +Cc: sanderd17 (Sander Deryckere)

Issue #20871 has been updated by sanderd17 (Sander Deryckere).


Thanks @rolf and @tdeo for finding minimal examples!

Why is this ticket marked as `closed` now?

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110704

* Author: sanderd17 (Sander Deryckere)
* Status: Feedback
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119969] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (5 preceding siblings ...)
  2024-11-19 14:37 ` [ruby-core:119968] " sanderd17 (Sander Deryckere) via ruby-core
@ 2024-11-19 15:36 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2024-11-19 20:35 ` [ruby-core:119970] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2024-11-19 15:36 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #20871 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Feedback to Open

sanderd17 (Sander Deryckere) wrote in #note-6:
> Thanks @rolf and @tdeo for finding minimal examples!
> 
> Why is this ticket marked as `closed` now?

It was in Feedback status, which shows the Closed button.  Now that we've received feedback, including a self contained example, I've moved it back to Open.

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110705

* Author: sanderd17 (Sander Deryckere)
* Status: Open
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119970] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (6 preceding siblings ...)
  2024-11-19 15:36 ` [ruby-core:119969] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2024-11-19 20:35 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2024-11-20  1:12 ` [ruby-core:119971] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2024-11-19 20:35 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #20871 has been updated by jeremyevans0 (Jeremy Evans).


I was able to reproduce this but in Ruby 3.2.6, 3.3.6, and master.  Backing out commit:6118e8a47394409b53164b60e79fadf348b97db3 (the commit to master that commit:edeb0319f7a95dfe3f9b895bcf32371dd8514726 was based on), fixes the problem, so I was too quick to dismiss that as a cause.  My apologies for that.

We could revert commit:6118e8a47394409b53164b60e79fadf348b97db3 in master (with similar reverts for 3.2 and 3.3), and reopen #20716.

Looking at the change in commit:6118e8a47394409b53164b60e79fadf348b97db3, it seems like adding module Foo to the subclasses list is breaking something.

I'm not sure when I'll have time to try to fix this, it might not be until next month.  So if anyone else has time and can find a way to fix #20716 without causing the breakage in this issue, that would be awesome.

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110706

* Author: sanderd17 (Sander Deryckere)
* Status: Open
* ruby -v: 3.3.6
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119971] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (7 preceding siblings ...)
  2024-11-19 20:35 ` [ruby-core:119970] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2024-11-20  1:12 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2024-11-20 18:23 ` [ruby-core:119976] " sanderd17 (Sander Deryckere) via ruby-core
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2024-11-20  1:12 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #20871 has been updated by jeremyevans0 (Jeremy Evans).

Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED

I had some extra time today, and I was able to find the cause, and once I found the cause, the fix was trivial: https://github.com/ruby/ruby/pull/12125

The root cause is a bug in the initial commit to allow Module#include to affect classes and modules that that have already included the receiver, commit:3556a834a2847e52162d1d3302d4c64390df1694 (which I wrote).

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110707

* Author: sanderd17 (Sander Deryckere)
* Status: Open
* ruby -v: 3.3.6
* Backport: 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:119976] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (8 preceding siblings ...)
  2024-11-20  1:12 ` [ruby-core:119971] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2024-11-20 18:23 ` sanderd17 (Sander Deryckere) via ruby-core
  2024-11-30  6:11 ` [ruby-core:120069] " nagachika (Tomoyuki Chikanaga) via ruby-core
  2025-01-15  1:49 ` [ruby-core:120682] " k0kubun (Takashi Kokubun) via ruby-core
  11 siblings, 0 replies; 13+ messages in thread
From: sanderd17 (Sander Deryckere) via ruby-core @ 2024-11-20 18:23 UTC (permalink / raw)
  To: ruby-core; +Cc: sanderd17 (Sander Deryckere)

Issue #20871 has been updated by sanderd17 (Sander Deryckere).


So the bug has always been present, but was hidden by a different caching issue.

Great find, wouldn't have known where to start.

Thank you so much for taking this up so quickly! 

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110714

* Author: sanderd17 (Sander Deryckere)
* Status: Closed
* ruby -v: 3.3.6
* Backport: 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:120069] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (9 preceding siblings ...)
  2024-11-20 18:23 ` [ruby-core:119976] " sanderd17 (Sander Deryckere) via ruby-core
@ 2024-11-30  6:11 ` nagachika (Tomoyuki Chikanaga) via ruby-core
  2025-01-15  1:49 ` [ruby-core:120682] " k0kubun (Takashi Kokubun) via ruby-core
  11 siblings, 0 replies; 13+ messages in thread
From: nagachika (Tomoyuki Chikanaga) via ruby-core @ 2024-11-30  6:11 UTC (permalink / raw)
  To: ruby-core; +Cc: nagachika (Tomoyuki Chikanaga)

Issue #20871 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED to 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED

ruby_3_2 commit:bb065f08441aab8f97b45bd3f1600202547c9532 merged revision(s) commit:3b7892b6e4d1a1a5d6019987f9b46ed443dd104f.

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-110812

* Author: sanderd17 (Sander Deryckere)
* Status: Closed
* ruby -v: 3.3.6
* Backport: 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:120682] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array
  2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
                   ` (10 preceding siblings ...)
  2024-11-30  6:11 ` [ruby-core:120069] " nagachika (Tomoyuki Chikanaga) via ruby-core
@ 2025-01-15  1:49 ` k0kubun (Takashi Kokubun) via ruby-core
  11 siblings, 0 replies; 13+ messages in thread
From: k0kubun (Takashi Kokubun) via ruby-core @ 2025-01-15  1:49 UTC (permalink / raw)
  To: ruby-core; +Cc: k0kubun (Takashi Kokubun)

Issue #20871 has been updated by k0kubun (Takashi Kokubun).

Backport changed from 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED to 3.1: REQUIRED, 3.2: DONE, 3.3: DONE

ruby_3_3 commit:8506fdfb4aca5262940b9c49827c2a839f6bb1fe merged revision(s) commit:3b7892b6e4d1a1a5d6019987f9b46ed443dd104f.

----------------------------------------
Bug #20871: Including methods in Enumerable doesn't make them available in Array
https://bugs.ruby-lang.org/issues/20871#change-111505

* Author: sanderd17 (Sander Deryckere)
* Status: Closed
* ruby -v: 3.3.6
* Backport: 3.1: REQUIRED, 3.2: DONE, 3.3: DONE
----------------------------------------
Today, our CI pipeline started failing after the automatic update from v3.3.5 to v3.3.6.

After researching, it turned out that our core extensions to the `Array` class weren't loaded anymore.

The core-extensions code looks like this:

```ruby

module CoreExt
  module Enumerable
    def average
      sum(&:to_f) / count if any?
    end

    # def ...
  end
end

Enumerable.include CoreExt::Enumerable
```

After some debugging, it turned out that the `average` method was included in the `instance_methods` of `Enumerable`, but not in the `instance_methods` of `Array`.

Explicitly adding `Array.include CoreExt::Enumerable` fixes CI for our case.


The very strange thing is that it only happens on a release branch we are still maintaining. It doesn't happen on our main development branch (which also updated to v3.3.6 today). I have been unable to find the difference between both branches so far (they diverged a couple of months ago, but the base system is still regularly updated on both, and pretty similar).

After some digging around, I assume this commit is related to our issue: https://github.com/ruby/ruby/commit/edeb0319f7a95dfe3f9b895bcf32371dd8514726



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-01-15  1:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-05 20:09 [ruby-core:119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array sanderd17 (Sander Deryckere) via ruby-core
2024-11-05 20:25 ` [ruby-core:119752] " sanderd17 (Sander Deryckere) via ruby-core
2024-11-18  5:02 ` [ruby-core:119954] " jeremyevans0 (Jeremy Evans) via ruby-core
2024-11-18  7:24 ` [ruby-core:119955] " rolf (Rolf T) via ruby-core
2024-11-18  9:12 ` [ruby-core:119956] " rolf (Rolf T) via ruby-core
2024-11-19  8:43 ` [ruby-core:119964] " tdeo (Thierry Deo) via ruby-core
2024-11-19 14:37 ` [ruby-core:119968] " sanderd17 (Sander Deryckere) via ruby-core
2024-11-19 15:36 ` [ruby-core:119969] " jeremyevans0 (Jeremy Evans) via ruby-core
2024-11-19 20:35 ` [ruby-core:119970] " jeremyevans0 (Jeremy Evans) via ruby-core
2024-11-20  1:12 ` [ruby-core:119971] " jeremyevans0 (Jeremy Evans) via ruby-core
2024-11-20 18:23 ` [ruby-core:119976] " sanderd17 (Sander Deryckere) via ruby-core
2024-11-30  6:11 ` [ruby-core:120069] " nagachika (Tomoyuki Chikanaga) via ruby-core
2025-01-15  1:49 ` [ruby-core:120682] " k0kubun (Takashi Kokubun) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).