mob.new_plugin: scaffold against current mob, not the abandoned ~> 0.6#26
Merged
Conversation
… 0.7)
MobDev.Plugin.Scaffold hard-coded {:mob, "~> 0.6"} in the generated
mix.exs and mob_version: "~> 0.6" in every tier's manifest, so a freshly
scaffolded plugin could not activate against published mob 0.7.x.
Derive the requirement instead: Scaffold.detect_mob_requirement/0 prefers
the mob actually resolved in the project, falling back to a single
@fallback_mob_requirement ("~> 0.7") constant. files_for/3 threads it into
both mix.exs and the manifest so they always agree. A Scaffold test pins
the default and validates a generated manifest against a matching mob
version, so the pin can't silently lag a future mob release.
Closes #21
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
MobDev.Plugin.Scaffoldhard-coded the mob requirement in two places:{:mob, "~> 0.6"}in the generatedmix.exsandmob_version: "~> 0.6"in every tier's manifest. Published mob is 0.7.x, so a freshly scaffolded plugin can't activate:and
mix deps.getresolves a stale mob. The literal also lived in five separate template strings, somix.exsand the manifest could drift apart with nothing catching a stale value before a user hit it.Reported as #21, surfaced by mob_ci which dogfoods
mob.new_plugin --tier 0..4and had to hand-bump the generated fixtures. Confirmed by a consumer in the issue thread.Fix
Derive the requirement instead of hard-coding it:
Scaffold.mob_requirement/1(pure) maps a concrete version to"~> MAJOR.MINOR", or returns the compiled fallback onnil.Scaffold.detect_mob_requirement/0prefers the version of:mobactually resolved in the project (Application.spec(:mob, :vsn)afterApplication.load/1), falling back to a single@fallback_mob_requirement("~> 0.7") when mob isn't loadable (standalone scaffolding).mix mob.new_plugincalls this and threads the result intoScaffold.files_for/3; the templates stay pure.@fallback_mob_requirement);mix.exsand all manifests interpolate the threaded value so they can't disagree.~> 0.6example in the manifest validator's error message is bumped to~> 0.7for consistency (themob_devadopt-deps~> 0.6references are left alone — those pinmob_devitself, which is 0.6.x).Tests
New
Scaffolddescribe block (#21): asserts the derivation, that every tier'smix.exsand manifest agree, that the default is not~> 0.6, thatfiles_for/3honors an explicit requirement, and that a generated manifest validates against a mob version satisfying the default (derived from the requirement, so the check tracks future bumps).mix test test/mob_dev/plugin/scaffold_test.exs→ 40 passed.mix format+mix credo --strictclean.ADR:
decisions/2026-06-22-scaffold-derives-mob-requirement.md. CHANGELOG entry under[Unreleased].Note
When mob's major.minor moves again,
@fallback_mob_requirementstill needs a human bump — mob_dev doesn't depend on mob, so CI here can't compare against the latest published mob automatically. The test guards against silently shipping the old floor.Closes #21
🤖 Generated with Claude Code