Fix --liveview crash from installed archive: drop Sourceror runtime dep#18
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issues.md #1 —
mix mob.new --liveviewcrashed for every archive user withUndefinedFunctionError (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_depsuses 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 generatedmix.exsis reformatted and losesphx.new's comments — fine for a freshly generated file.{:sourceror}from deps (used nowhere else) + pruned the lock.archive_self_contained_test— a fast static guard (reads each mob_new beam's:importschunk) 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.0.3.13→0.3.14.Test plan
mix test— 276 tests, 0 failures (run withMOB_DIRset, per the two@tag :integrationtests' documented worktree requirement);LiveViewPatchersuite 67/0mix format/mix credo --strictclean_build/lib)mob_new-0.3.14.ez(confirmed no Sourceror in the.ez), installed into an isolatedMIX_ARCHIVES, ranmix mob.new lvdemo --liveview --android --no-installfrom/tmp(clean) → succeeds; generatedmix.exspatched 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