Skip to content

Fix --liveview crash from installed archive: drop Sourceror runtime dep#18

Merged
GenericJam merged 1 commit into
masterfrom
lv-sourceror-fix
May 27, 2026
Merged

Fix --liveview crash from installed archive: drop Sourceror runtime dep#18
GenericJam merged 1 commit into
masterfrom
lv-sourceror-fix

Conversation

@GenericJam
Copy link
Copy Markdown
Owner

Fixes issues.md #1mix mob.new --liveview crashed for every archive user with UndefinedFunctionError (Sourceror not available). Sourceror was a runtime hex dep, but Mix archives bundle only their own beams, not deps — so it's absent when the task runs from an installed .ez. (Tests were green only because they run from the repo, where Sourceror is a dep.)

Changes

  • LiveViewPatcher.inject_deps uses stdlib only now — Code.string_to_quoted + a standard-AST append + Macro.to_string + Code.format_string!, replacing all 4 Sourceror calls. Trade-off (accepted, per issues.md): the generated mix.exs is reformatted and loses phx.new's comments — fine for a freshly generated file.
  • Removed {:sourceror} from deps (used nowhere else) + pruned the lock.
  • New archive_self_contained_test — a fast static guard (reads each mob_new beam's :imports chunk) asserting archive-reachable code references no non-bundled hex-dep modules. Closes the regression class: a green-in-repo / crash-when-installed dep can't reappear silently.
  • Bump 0.3.130.3.14.

Test plan

  • mix test276 tests, 0 failures (run with MOB_DIR set, per the two @tag :integration tests' documented worktree requirement); LiveViewPatcher suite 67/0
  • mix format / mix credo --strict clean
  • New guard test passes (and is real — mob_new beams import stdlib but nothing under _build/lib)
  • Acceptance criterion Android rendering content behind status bar #1 verified: built mob_new-0.3.14.ez (confirmed no Sourceror in the .ez), installed into an isolated MIX_ARCHIVES, ran mix mob.new lvdemo --liveview --android --no-install from /tmp (clean) → succeeds; generated mix.exs patched with {:mob, "~> 0.5"}, valid Elixir, phx deps preserved.

Version bumped; archive rebuild/republish left for you to trigger via the release flow.

🤖 Generated with Claude Code

mix mob.new --liveview crashed for every archive user with
UndefinedFunctionError (Sourceror not available): Sourceror was a runtime hex
dep, but Mix archives bundle only their own beams, not deps. (issues.md #1)

- LiveViewPatcher.inject_deps now uses stdlib only (Code.string_to_quoted +
  Macro.to_string + Code.format_string!) instead of Sourceror. Trade-off:
  reformats the generated mix.exs / drops phx.new's comments — fine for a fresh file.
- Remove {:sourceror} from deps (used nowhere else) + prune the lock.
- Add archive_self_contained_test: a static guard (via the BEAM imports chunk)
  asserting archive-reachable mob_new code references no non-bundled hex-dep
  modules — closes the regression class (green-in-repo, crash-when-installed).
- Bump 0.3.13 -> 0.3.14.

Verified: --liveview succeeds from a clean archive install (no Sourceror in the
.ez); generated mix.exs patched with :mob and valid. Full suite 276/0.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@GenericJam GenericJam merged commit 394b739 into master May 27, 2026
3 checks passed
@GenericJam GenericJam deleted the lv-sourceror-fix branch May 27, 2026 15:23
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.

1 participant