Critical fix: defining Opencode::Rails as a module shadowed ::Rails
under Ruby's constant lookup whenever host code referenced top-level
Rails.something from inside the Opencode:: namespace.
Caught when host code in lib/opencode/containers/container.rb failed
to boot:
/workspaces/app/lib/opencode/containers/container.rb:433:
undefined method 'root' for module Opencode::Rails (NoMethodError)
"notes.md" => Rails.root.join(...)
Ruby resolved 'Rails' to 'Opencode::Rails' first (the gem's version
namespace) before falling back to ::Rails. The fix removes the
intermediate module entirely:
module Opencode
RAILS_VERSION = "0.0.1.alpha1"
end
Added a regression test (test_no_opencode_rails_module) so the
shadowing never sneaks back in. opencode-ruby uses Opencode::VERSION
for its own gem version; we can't double-up on that constant, so this
gem uses RAILS_VERSION as a sibling on the same Opencode module.
- opencode-rails.gemspec (Ruby >= 3.2, MIT)
- runtime: opencode-ruby ~> 0.0.1.alpha1
- runtime: activerecord/activestorage/activesupport >= 7.1, < 9.0
Per-sublibrary deps (not the rails umbrella) so host apps don't
pull in ActionMailer/ActionCable/ActionView just to use this gem.
- lib/opencode-rails.rb (umbrella; requires opencode-ruby then leaves
then session/turn)
- lib/opencode/rails/version.rb (Opencode::Rails::VERSION = 0.0.1.alpha1)
- Gemfile (sibling-path pull of opencode-ruby for local dev)
- Rakefile, .gitignore
Source files will be ported in the next commit.