fix: avoid unnecessary compile dependencies for runtime DSL modules - #2885
Conversation
|
I believe we will need to use |
db2f946 to
97a43dc
Compare
|
Thanks for pointing this out. I made two different changes based on how each module is consumed. I removed I kept A possible follow-up would be to split generic action |
97a43dc to
013519c
Compare
|
For this:
I think that this can be handled by calling |
|
I tested this in a minimal fixture.
I created a minimal reproduction comparing both approaches and verified it with Elixir 1.16.3 / OTP 26 and Elixir 1.20.0 / OTP 29: https://github.com/jechol/elixir-conditional-compile-dependency The most direct solution seems to be raising Ash's minimum Elixir version to 1.16, adding |
013519c to
6d5fe61
Compare
|
Okay, so, in retrospect, this has a critical issue (the reactor conditional compile time dependency). Specifically, that in order to know if a module is a reactor, you have to compile it. So this current iteration would actually break in the case that someone changes a module from an |
|
Agreed. The current branch already keeps the compile dependency on every The remaining changes only remove dependencies for the other runtime-only module fields and preserve compile ordering for |
|
🚀 Thank you for your contribution! 🚀 |
Contributor checklist
Leave anything that you believe does not apply unchecked.
Summary
Several Ash DSL fields contain module references that are stored and used at runtime, but were not included in
no_depend_modules.As a result, normal module aliases in those fields could create compile dependencies from the resource to runtime callback modules.
This adds the missing
no_depend_modulesdeclarations for:error_handlerandtouches_resourceserror_handlerandnotifiersmodify_queryparse_attributeandtenant_from_attributecallbacksimplementationexistsaggregate resourcesdispatcherdefault_domainThese fields either store module identities or invoke their callbacks at runtime. Their implementations are not used to produce compile-time resource state, so changes to those modules should not require recompiling the resource.
default_domainis explicitly ensured compiled before its existingAsh.Domainvalidation so clean parallel compilation does not depend on file ordering.Fields that are consumed at compile time, including type constraints and aggregate target fields used to derive metadata, intentionally retain their compile dependencies.
Validation
This pull request was developed with AI assistance and reviewed by the submitter.