sublayerapp / sublayer

A model-agnostic Ruby Generative AI DSL and framework. Provides base classes for building Generators, Actions, Tasks, and Agents that can be used to build AI powered applications in Ruby.
https://docs.sublayer.com
MIT License
111 stars 2 forks source link

deploying to heroku: expected file .../example_action.rb to define constant Sublayer::Templates::QuickScript::Actions::ExampleAction, but didn't #98

Closed ckundo closed 1 month ago

ckundo commented 2 months ago

When I deploy a Rails 7.1.3.4 app to Heroku, I get the error above and the app fails to start.

2024-08-30T01:10:50.336119+00:00 app[web.1]: [73] ! Unable to start worker
2024-08-30T01:10:50.336144+00:00 app[web.1]: [73] expected file /app/vendor/bundle/ruby/3.3.0/gems/sublayer-0.2.4/lib/sublayer/templates/quick_script/actions/example_action.rb to define constant Sublayer::Templates::QuickScript::Actions::ExampleAction, but didn't
2024-08-30T01:10:50.336192+00:00 app[web.1]: [73] /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/callbacks.rb:32:in `on_file_autoloaded'
2024-08-30T01:10:50.336193+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/kernel.rb:27:in `require'
2024-08-30T01:10:50.336193+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/sublayer-0.2.4/lib/sublayer/templates/quick_script/project_name.rb:4:in `block in <top (required)>'
2024-08-30T01:10:50.336193+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/sublayer-0.2.4/lib/sublayer/templates/quick_script/project_name.rb:4:in `each'
2024-08-30T01:10:50.336194+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/sublayer-0.2.4/lib/sublayer/templates/quick_script/project_name.rb:4:in `<top (required)>'
2024-08-30T01:10:50.336194+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
2024-08-30T01:10:50.336195+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
2024-08-30T01:10:50.336195+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/kernel.rb:26:in `require'
2024-08-30T01:10:50.336195+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/cref.rb:91:in `const_get'
2024-08-30T01:10:50.336196+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/cref.rb:91:in `get'
2024-08-30T01:10:50.336196+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/eager_load.rb:173:in `block in actual_eager_load_dir'
2024-08-30T01:10:50.336196+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/helpers.rb:47:in `block in ls'
2024-08-30T01:10:50.336196+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/helpers.rb:25:in `each'
2024-08-30T01:10:50.336196+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/helpers.rb:25:in `ls'
2024-08-30T01:10:50.336196+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/eager_load.rb:168:in `actual_eager_load_dir'
2024-08-30T01:10:50.336197+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/eager_load.rb:17:in `block (2 levels) in eager_load'
2024-08-30T01:10:50.336197+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/eager_load.rb:16:in `each'
2024-08-30T01:10:50.336197+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/eager_load.rb:16:in `block in eager_load'
2024-08-30T01:10:50.336197+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader/eager_load.rb:10:in `synchronize'
2024-08-30T01:10:50.336197+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk
-2.6.17/lib/zeitwerk/loader/eager_load.rb:10:in `eager_load'
2024-08-30T01:10:50.336198+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader.rb:413:in `block in eager_load_all'
2024-08-30T01:10:50.336198+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader.rb:411:in `each'
2024-08-30T01:10:50.336198+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.6.17/lib/zeitwerk/loader.rb:411:in `eager_load_all'
2024-08-30T01:10:50.336198+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/railties-7.1.3.4/lib/rails/application/finisher.rb:80:in `block in <module:Finisher>'
2024-08-30T01:10:50.336198+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:32:in `instance_exec'
2024-08-30T01:10:50.336198+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:32:in `run'
2024-08-30T01:10:50.336198+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:61:in `block in run_initializers'
2024-08-30T01:10:50.336198+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each'
2024-08-30T01:10:50.336199+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component'
2024-08-30T01:10:50.336199+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from'
2024-08-30T01:10:50.336199+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component'
2024-08-30T01:10:50.336199+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `each'
2024-08-30T01:10:50.336199+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `call'
2024-08-30T01:10:50.336199+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component'
2024-08-30T01:10:50.336199+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each'
2024-08-30T01:10:50.336199+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each'
2024-08-30T01:10:50.336200+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/railties-7.1.3.4/lib/rails/initializable.rb:60:in `run_initializers'
2024-08-30T01:10:50.336200+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/railties-7.1.3.4/lib/rails/application.rb:426:in `initialize!'
2024-08-30T01:10:50.336200+00:00 app[web.1]: /app/config/environment.rb:6:in `<top (required)>'
2024-08-30T01:10:50.336201+00:00 app[web.1]: config.ru:4:in `require_relative'
2024-08-30T01:10:50.336201+00:00 app[web.1]: config.ru:4:in `block in <main>'
2024-08-30T01:10:50.336204+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/rack-2.2.9/lib/rack/builder.rb:116:in `eval'
2024-08-30T01:10:50.336204+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/rack-2.2.9/lib/rack/builder.rb:116:in `new_from_string'
2024-08-30T01:10:50.336204+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/rack-2.2.9/lib/rack/builder.rb:105:in `load_file'
2024-08-30T01:10:50.336204+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/rack-2.2.9/lib/rack/builder.rb:66:in `parse_file'
2024-08-30T01:10:50.336204+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/configuration.rb:368:in `load_rackup'
2024-08-30T01:10:50.336204+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/configuration.rb:290:in `app'
2024-08-30T01:10:50.336204+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/runner.rb:173:in `app'
2024-08-30T01:10:50.336204+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/runner.rb:177:in `start_server'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster/worker.rb:60:in `run'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster.rb:216:in `worker'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster.rb:97:in `block in spawn_worker'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster.rb:97:in `fork'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster.rb:97:in `spawn_worker'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster.rb:81:in `block in spawn_workers'
2024-08-30T01:10:50.336205+00:00 app[web.1]: <internal:numeric>:237:in `times'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster.rb:74:in `spawn_workers'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster.rb:173:in `check_workers'
2024-08-30T01:10:50.336205+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cluster.rb:455:in `run'
2024-08-30T01:10:50.336206+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/launcher.rb:194:in `run'
2024-08-30T01:10:50.336206+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/lib/puma/cli.rb:75:in `run'
2024-08-30T01:10:50.336206+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/bin/puma:10:in `<top (required)>'
2024-08-30T01:10:50.336206+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/bin/puma:25:in `load'
2024-08-30T01:10:50.336206+00:00 app[web.1]: /app/vendor/bundle/ruby/3.3.0/bin/puma:25:in `<top (required)>'
2024-08-30T01:10:50.336206+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `load'
2024-08-30T01:10:50.336206+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `kernel_load'
2024-08-30T01:10:50.336206+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/cli/exec.rb:23:in `run'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/cli.rb:455:in `exec'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/cli.rb:35:in `dispatch'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/cli.rb:29:in `start'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/exe/bundle:28:in `block in <top (required)>'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/3.3.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
2024-08-30T01:10:50.336207+00:00 app[web.1]: /app/vendor/ruby-3.3.4/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/exe/bundle:20:in `<top (required)>'
2024-08-30T01:10:50.336208+00:00 app[web.1]: /app/vendor/bundle/bin/bundle:108:in `load'
2024-08-30T01:10:50.336208+00:00 app[web.1]: /app/vendor/bundle/bin/bundle:108:in `<main>'
ckundo commented 2 months ago

might be related to https://github.com/rails/rails/issues/38671

ckundo commented 2 months ago

when I generate a new Rails app with rails new sample, add sublayer to the Gemfile I see this error. Maybe related?

% bin/rails zeitwerk:check
Hold on, I am eager loading the application.
bin/rails aborted!
NameError: uninitialized constant Sublayer::CLI::Commands::Action (NameError)

    @mod.const_get(@cname, false)
        ^^^^^^^^^^
Did you mean?  Sublayer::CLI::Actions
               Sublayer::Actions

Tasks: TOP => zeitwerk:check
(See full trace by running task with --trace)
swerner commented 2 months ago

Ahh yeah looks like I screwed something up by not ignoring the cli directory in my zeitwerk setup and for some reason my tests didn't catch it. Fix should be coming out shortly!

swerner commented 2 months ago

Should be fixed in 0.2.6