Skip to content

fix: update Zeitwerk autoload for inflections.rb#460

Merged
gjtorikian merged 1 commit intomainfrom
fix-inflections-issue
Apr 24, 2026
Merged

fix: update Zeitwerk autoload for inflections.rb#460
gjtorikian merged 1 commit intomainfrom
fix-inflections-issue

Conversation

@gjtorikian
Copy link
Copy Markdown
Contributor

@gjtorikian gjtorikian commented Apr 24, 2026

Summary

  • Tell Zeitwerk to ignore inflections.rb, which defines a plain constant (WORKOS_INFLECTIONS) rather than a class/module matching the file name
  • Without this, Zeitwerk expects inflections.rb to define an Inflections constant and raises a NameError on load

Closes #459.

Test plan

  • bundle exec rake passes with no Zeitwerk NameError
  • Inflection overrides still apply correctly (classes with non-standard casing like AuthenticationMFAFailed resolve)

`inflections.rb` defines a plain constant (`WORKOS_INFLECTIONS`),
not a class or module matching the file name. Zeitwerk expects
it to define `Inflections` and raises a `NameError` when it
doesn't. Telling the loader to ignore this file prevents the
autoload failure.
@gjtorikian gjtorikian requested review from a team as code owners April 24, 2026 17:26
@gjtorikian gjtorikian requested a review from nicknisi April 24, 2026 17:26
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

This PR adds a single loader.ignore call for inflections.rb so Zeitwerk stops expecting it to define a WorkOS::Inflections constant. The file is already explicitly loaded via require_relative before loader.setup, and the pattern is consistent with how errors.rb is handled in the same file.

Confidence Score: 5/5

Safe to merge — one-line targeted fix with no side effects.

The change is minimal and correct: inflections.rb defines a plain constant and is already require_relative'd manually, so telling Zeitwerk to ignore it is the right fix. The ignore call is placed before loader.setup, matching the identical pattern used for errors.rb. No logic, security, or ordering issues.

No files require special attention.

Important Files Changed

Filename Overview
lib/workos.rb Adds loader.ignore for inflections.rb before loader.setup; ordering is correct and mirrors the existing errors.rb pattern.

Sequence Diagram

sequenceDiagram
    participant WOS as workos.rb
    participant INF as inflections.rb
    participant ZW as Zeitwerk::Loader

    WOS->>INF: require_relative (defines WORKOS_INFLECTIONS)
    WOS->>ZW: loader.inflector.inflect(WORKOS_INFLECTIONS)
    WOS->>ZW: loader.collapse(...) × 13
    WOS->>ZW: loader.ignore(errors.rb)
    WOS->>ZW: loader.ignore(inflections.rb) ← new
    WOS->>ZW: loader.setup
    Note over ZW: Zeitwerk scans lib/workos/**<br/>inflections.rb skipped (no NameError)
Loading

Reviews (1): Last reviewed commit: "fix: Ignore inflections.rb in Zeitwerk a..." | Re-trigger Greptile

@gjtorikian gjtorikian changed the title Fix Zeitwerk autoload failure for inflections.rb fix: update Zeitwerk autoload for inflections.rb Apr 24, 2026
@gjtorikian gjtorikian merged commit 4fa1332 into main Apr 24, 2026
8 of 9 checks passed
@gjtorikian gjtorikian deleted the fix-inflections-issue branch April 24, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Zeitwerk eager-load crashes with "uninitialized constant WorkOS::Inflections" in 7.0.0

1 participant