tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

Skipping debug gem misses `::DEBUGGER__::TrapInterceptor`

Open dimerman opened this issue 3 years ago • 2 comments

on #947 tapioca skips the debug gem. however I'm seeing errors such as:

  sorbet/rbi/gems/[email protected]:13320: Replace with Logger::Severity::DEBUG
       13320 |  include ::DEBUGGER__::TrapInterceptor
                        ^^^^^^^^^^^^

workaround: add to todo.rbi

module ::DEBUGGER__::TrapInterceptor; end

dimerman avatar Jul 13 '22 18:07 dimerman

I've had some success with adding ENV["RUBY_DEBUG_ENABLE"] = "0" to my prerequire file to prevent the debug gem from executing.

This environment variable means that even if the debug gem loads, it doesn't do anything.

One caveat – there is a bug with the RUBY_DEBUG_ENABLE support in the latest release of the Gem which means that loading the gem doesn't define the DEBUGGER__ constant but still tries to access it. They've already merged a fix (https://github.com/ruby/debug/pull/731). Until that's released the workaround I'm using in my prerequire file is to define a little stub so that it doesn't raise:

unless defined? DEBUGGER__
  module DEBUGGER__
    def self.start(*args, **kwargs)
    end
  end
end

georgebrock avatar Jul 29 '22 10:07 georgebrock

The best workaround would be to add the missing constants to https://github.com/Shopify/rbi-central so Tapioca can pick it up when running tapioca annotations.

Morriar avatar Aug 02 '22 14:08 Morriar

Since https://github.com/Shopify/tapioca/pull/1179 is merged, Tapioca is internally setting ENV["RUBY_DEBUG_ENABLE"] = "0" so that we never load the debug gem at all (loading it lead to some hangs in forked processes). Morevover, https://github.com/ruby/debug/pull/731 has been released in 1.6.2 of the debug gem, so, this should be resolved.

I am closing this issue, please reopen if needed.

paracycle avatar Oct 10 '22 17:10 paracycle