Skip to content

Conversation

@rileyseaburg
Copy link
Contributor

Summary

  • Moves the SKIP_WIDGET_RENDERER check to the beginning of widget_renderer.rb so it runs during Bundler.require
  • When SKIP_WIDGET_RENDERER=true, provides a stub class with the same interface instead of crashing
  • This fixes the production crash where instances fail to start because the native library isn't found

Root Cause

The previous fix added the env var to manifests, but the check was in an initializer that runs after Bundler.require in config/application.rb. The gem was crashing during the bundle require phase before the initializer could run.

Copilot AI review requested due to automatic review settings December 23, 2025 14:28
@rileyseaburg rileyseaburg merged commit 194e0fa into production Dec 23, 2025
13 of 14 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves the SKIP_WIDGET_RENDERER environment variable check to the beginning of widget_renderer.rb to fix a production crash where the native library loading fails before the initializer can run. When the env var is set to 'true', a stub class is provided instead of attempting to load the native library.

Key Changes

  • Early environment variable check before requiring dependencies
  • Stub class implementation when renderer should be skipped
  • Addition of available? method to both stub and native implementations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

def self.render_widget(template, data)
# Return nil to signal caller should use ERB fallback
nil
end
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stub implementation defines render_widget(template, data) but the actual usage in the codebase calls WidgetRenderer.generate_js(json). The stub should define generate_js to match the actual interface of the native implementation.

Suggested change
end
end
def self.generate_js(json)
# Return nil to signal caller should use JS/ERB fallback
nil
end

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants