Repository: svix/svix-webhooks (language: rust)

Issue:
cannot load such file -- svix/models/webhook_types (LoadError)
## Bug Report

Installing the latest version (`0.84.1`) of `svix` gem resulting in a `LoadError` error.

### Version

`0.84.1`

### Platform

```sh
$ uname -a
Darwin xxx 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:58 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6020 arm64
```

```sh
$ ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin22]
```

### Description

Steps to reproduce:

1. Add `svix` into a Gemfile:

```ruby
gem 'svix', '~> 0.84'
```

2. Run:

```
$ bundle install
```

3. Run, for example:

```
$ bundle exec rails help
Traceback (most recent call last):
	40: from bin/rails:4:in `<main>'
	39: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	38: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	37: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/commands.rb:18:in `<main>'
	36: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/command.rb:46:in `invoke'
	35: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/command/base.rb:69:in `perform'
	34: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	33: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	32: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	31: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/commands/help/help_command.rb:11:in `help'
	30: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/command.rb:86:in `print_commands'
	29: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/command.rb:96:in `commands'
	28: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/command.rb:96:in `flat_map'
	27: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/command.rb:96:in `each'
	26: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:12:in `printing_commands'
	25: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:42:in `formatted_rake_tasks'
	24: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:33:in `rake_tasks'
	23: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
	22: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/railties-6.0.6.1/lib/rails/command/actions.rb:22:in `require_application!'
	21: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:324:in `require'
	20: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:291:in `load_dependency'
	19: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:324:in `block in require'
	18: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	17: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	16: from /Users/xxx/Code/textmaster-root/services/TextMaster.com/config/application.rb:20:in `<main>'
	15: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.7/lib/bundler.rb:195:in `require'
	14: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.7/lib/bundler/runtime.rb:44:in `require'
	13: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.7/lib/bundler/runtime.rb:44:in `each'
	12: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.7/lib/bundler/runtime.rb:55:in `block in require'
	11: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.7/lib/bundler/runtime.rb:55:in `each'
	10: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.7/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	 9: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
	 8: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	 7: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	 6: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/svix-0.84.1/lib/svix.rb:73:in `<main>'
	 5: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:324:in `require'
	 4: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:291:in `load_dependency'
	 3: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:324:in `block in require'
	 2: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
	 1: from /Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/Users/xxx/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require': cannot load such file -- svix/models/webhook_types (LoadError)
```


Discussion / hints:
After a quick test, it works fine on `0.83.1` but breaks on `0.84.0`.
Grr, that's not good. We changed slightly how the lib is built and I guess something was missed.

Can you share a tiny reproduction case that we can look at and fix?

P.S, using 0.83.1 is absolutely fine until this is fixed. No important changes there.
The reproduction case is the following:

```
gem install svix
irb -r svix
```

you get the error right away 😉 
That's too easy, thanks! :)

Fix patch:
diff --git a/ruby/lib/svix.rb b/ruby/lib/svix.rb
index a1bb36d44..57e59eb07 100644
--- a/ruby/lib/svix.rb
+++ b/ruby/lib/svix.rb
@@ -70,7 +70,6 @@
 require "svix/models/message_status"
 require "svix/models/recover_in"
 require "svix/models/validation_error"
-require "svix/models/webhook_types"
 require "svix/models/status_code_class"
 
 # Core
diff --git a/ruby/lib/svix/internal.rb b/ruby/lib/svix/internal.rb
index 4f5513fb1..570ec068b 100644
--- a/ruby/lib/svix/internal.rb
+++ b/ruby/lib/svix/internal.rb
@@ -1,17 +1,16 @@
 # frozen_string_literal: true
 
 module Svix
-    private_constant :ApiClient
-    private_constant :Configuration
-    private_constant :ApplicationApi
-    private_constant :AuthenticationApi
-    private_constant :EndpointApi
-    private_constant :HealthApi
-    private_constant :IntegrationApi
-    private_constant :MessageApi
-    private_constant :MessageAttemptApi
-    private_constant :WebhookTypes
-    private_constant :HttpErrorOut
-    private_constant :HTTPValidationError
-    private_constant :ValidationError
+  private_constant :ApiClient
+  private_constant :Configuration
+  private_constant :ApplicationApi
+  private_constant :AuthenticationApi
+  private_constant :EndpointApi
+  private_constant :HealthApi
+  private_constant :IntegrationApi
+  private_constant :MessageApi
+  private_constant :MessageAttemptApi
+  private_constant :HttpErrorOut
+  private_constant :HTTPValidationError
+  private_constant :ValidationError
 end


Test patch: