fix: eagerly load configuration.rb to fix WorkOS.configure#467
fix: eagerly load configuration.rb to fix WorkOS.configure#467gjtorikian merged 2 commits intomainfrom
Conversation
Zeitwerk only triggers autoloading on constant access, not method calls. WorkOS.configure is defined in the hand-maintained configuration.rb, so it must be explicitly required — same pattern already used for errors.rb. Fixes #462 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
configuration.rb is now eagerly loaded, so the explicit require "workos/configuration" workaround is no longer needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR fixes a bug where Confidence Score: 5/5Safe to merge — targeted, low-risk fix that follows an established pattern in the codebase. The change is minimal (two lines in lib/workos.rb, one line removed from README), directly mirrors the existing pattern for errors.rb and inflections.rb, and correctly addresses the root cause of the Zeitwerk autoload timing issue. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant App
participant workos_rb as lib/workos.rb
participant Zeitwerk
participant configuration_rb as workos/configuration.rb
Note over App,configuration_rb: Before fix
App->>workos_rb: require "workos"
workos_rb->>Zeitwerk: loader.setup
App->>App: WorkOS.configure { ... }
Note right of App: ❌ NoMethodError — configuration.rb not yet loaded
Note over App,configuration_rb: After fix
App->>workos_rb: require "workos"
workos_rb->>Zeitwerk: loader.ignore(configuration.rb)
workos_rb->>Zeitwerk: loader.setup
workos_rb->>configuration_rb: require "workos/configuration" (eager)
configuration_rb-->>workos_rb: WorkOS::Configuration + WorkOS.configure defined
App->>App: WorkOS.configure { ... }
Note right of App: ✅ Works immediately
Reviews (1): Last reviewed commit: "docs: remove unnecessary require from RE..." | Re-trigger Greptile |
Summary
configuration.rbto the list of hand-maintained files ignored by Zeitwerk and explicitly requirederrors.rbandinflections.rbWorkOS.configurewas unavailable until something happened to referenceWorkOS::ConfigurationfirstFixes #462
Test plan
WorkOS.configure { |c| ... }works immediately afterrequire 'workos'without needing an explicitrequire 'workos/configuration'🤖 Generated with Claude Code