dry-rb / dry-core

A toolset of small support modules used throughout the @dry-rb & @rom-rb ecosystems
https://dry-rb.org/gems/dry-core/
MIT License
171 stars 34 forks source link

uninitialized constant Dry::Core::ClassAttributes::IDENTITY #75

Closed poloka closed 2 years ago

poloka commented 2 years ago

Describe the bug

Release 0.9.0 is broken. Because of the removal of the Constants: https://github.com/dry-rb/dry-core/compare/v0.8.1...v0.9.0#diff-96814e9c79807ef64d126407350ffd3011e57aa5406c0625219fda5c6b1c8774L12

Causes error:

/usr/local/bundle/gems/dry-core-0.9.0/lib/dry/core/class_attributes.rb:65:in `defines': uninitialized constant Dry::Core::ClassAttributes::IDENTITY (NameError)

Because of the reference to the constant here: https://github.com/dry-rb/dry-core/compare/v0.8.1...v0.9.0#diff-96814e9c79807ef64d126407350ffd3011e57aa5406c0625219fda5c6b1c8774R65

References https://github.com/dry-rb/dry-core/blob/v0.9.0/lib/dry/core/constants.rb#L30

Expected behavior

Not to get an unexpected constant missing error

My environment

opti commented 2 years ago

@poloka I was just about to report the same issue. Thanks for posting it.

poloka commented 2 years ago

Here was the commit from @solnic that broke things: https://github.com/dry-rb/dry-core/commit/96d01e2baa89854692308f192ff84e88b7428a21

opti commented 2 years ago

There is also this discussion on the same issue https://github.com/dry-rb/dry-core/issues/73

solnic commented 2 years ago

Thanks for reporting this. I'm pretty sure it's because there's a cherry-pick require somewhere in your code that loads some file that needs Dry::Core::Constants while dry/core (which is the zeitwerk library entry-point now) is not yet required. Is this the case? If yes, could you remove any requires like that and just have one require "dry/core"?

solnic commented 2 years ago

...OK nevermind I just merged #76 and it made me realize that we actually have constants in the list of ignored files by zeitwerk so the require and inclusion of the module were both needed in various situations. Thanks for the fix @poloka - it's now released in 0.9.1.

poloka commented 2 years ago

Thanks @solnic for the quick release!!