Skip to content

fix: reenable compile task before running queued tasks#367

Merged
zachdaniel merged 2 commits intoash-project:mainfrom
albinkc:fix/reenable-compile-before-queued-tasks
Mar 15, 2026
Merged

fix: reenable compile task before running queued tasks#367
zachdaniel merged 2 commits intoash-project:mainfrom
albinkc:fix/reenable-compile-before-queued-tasks

Conversation

@albinkc
Copy link
Contributor

@albinkc albinkc commented Mar 15, 2026

Summary

  • Fixes Could not load <Module>, error: :nofile errors when mix igniter.install runs queued tasks (like ash.codegen) that depend on freshly generated source files
  • Re-enables compile, app.config, and loadpaths Mix tasks before each queued task in run_next/1

Problem

When installing multiple packages (e.g. mix igniter.install ash ash_postgres ash_authentication ...), the pipeline:

  1. Runs mix compile early (before new source files exist)
  2. Installers generate new .ex files and queue an ash.codegen task
  3. Igniter writes the new files to disk
  4. Igniter runs queued tasks — ash.codegen calls Mix.Task.run("compile"), but this is a no-op because compile already ran in step 1
  5. Code.ensure_compiled/1 fails with :nofile for newly generated modules

Reproduction

sh <(curl 'https://ash-hq.org/install/willow?install=phoenix') \
    && cd willow && mix igniter.install ash ash_phoenix \
    ash_postgres ash_authentication ash_authentication_phoenix \
    ash_admin ash_state_machine ash_money ash_double_entry \
    ash_archival live_debugger mishka_chelekom tidewave \
    ash_paper_trail ash_ai cloak ash_cloak usage_rules \
    --auth-strategy password --auth-strategy magic_link --setup \
    --yes

Fails with:

Task failed (mix error): mix ash.codegen initialize_and_add_authentication_resources_and_...
Reason: Could not load Willow.Accounts, error: :nofile.

Fix

Add Mix.Task.reenable/1 for compile, app.config, and loadpaths before running each queued task, so downstream tasks that call Mix.Task.run("compile") actually trigger a fresh compilation.

Test plan

  • Verified the failing test (install_test.exs:34) is a pre-existing flake on main, not caused by this change
  • Full test suite: 304 tests pass, 1 pre-existing failure unrelated to this change
  • End-to-end: re-run the reproduction command above with the fix applied

🤖 Generated with Claude Code

albinkc and others added 2 commits March 16, 2026 00:14
When igniter writes newly generated source files to disk and then runs
queued tasks (like `ash.codegen`), those tasks call
`Mix.Task.run("compile")` which is a no-op because compile already ran
earlier in the igniter pipeline — before the new files existed.

This causes `Code.ensure_compiled/1` to fail with `:nofile` for any
modules that were generated during the install process.

Fix by re-enabling compile, app.config, and loadpaths before each
queued task so that downstream tasks can trigger a fresh compilation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Removed comments explaining the re-enabling of compile tasks.
@zachdaniel zachdaniel merged commit 686c653 into ash-project:main Mar 15, 2026
45 checks passed
@zachdaniel
Copy link
Contributor

🚀 Thank you for your contribution! 🚀

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