Skip to content

Conversation

robhanlon22
Copy link

@robhanlon22 robhanlon22 commented Aug 9, 2022

Ran into this load error when trying to run tests in a bespoke CI environment:

LoadError:
  cannot load such file -- .../lib/dry/logic/operations
  # .../lib/dry/logic/operators.rb:7:in `require'
  # .../lib/dry/logic/operators.rb:7:in `and'

I believe that this has to do with Zeitwerk loading and the order that things get loaded. It's trying to load the operations file but it's not there. Adding this file with a module declaration fixes this issue, and seems most consistent with Ruby patterns (a file named the same as a directory that declares the directory's module).

@robhanlon22 robhanlon22 requested a review from solnic as a code owner August 9, 2022 16:32
@robhanlon22 robhanlon22 changed the title Add empty operations module to fix spurious loading issues Add empty Operations module to fix spurious loading issues Aug 9, 2022
@flash-gordon
Copy link
Member

I'm pretty sure it's not a proper fix. I have very similar issues with specs in dry-system that reloaded zetwerk's context in tests. The solution was to fix the helper. Please check out that repo, the fix may be in a non-main branch (I'm on mobile atm).

@flash-gordon
Copy link
Member

By the way, it took me some time to figure it out. I used debugging tips from zeitwerk repo (you can set a custom logger for zeitwerk operations).

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