MOB-73 — fix --slim gate: publish MOB_SLIM env var instead of Process dict - #83
Merged
Conversation
… dict
`mix mob.deploy --slim` was a silent no-op. `NativeBuild.build_all/1`
stored the boolean in `Process.put(:mob_slim, slim)` but the actual
strip-pass gate at `maybe_slim_otp_bundle/2` reads
`System.get_env("MOB_SLIM")` (mirroring `release.ex`, which explicitly
sets the env var for its subprocess call chain). Nothing ever read
back from the process dict.
Fix: replace the Process.put call with a public-for-testing helper
`__apply_slim_env__/1` that sets `MOB_SLIM=1` or `=0`, matching what
`release.ex` already does. The gate at `maybe_slim_otp_bundle/2` is
unchanged. Both paths (mob.deploy + mob.release) now use the same
env-var mechanism.
Two revert-verified tests in `NativeBuildTest`: setting `MOB_SLIM=0`
then calling `__apply_slim_env__(true)` must leave the env at `"1"`,
and vice versa. Setup/on_exit save-restore MOB_SLIM for isolation
(module is already async: false).
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.
mix mob.deploy --slimwas a silent no-op.NativeBuild.build_all/1(lib/mob_dev/native_build.ex:43) stored the boolean inProcess.put(:mob_slim, slim), but the actual strip-pass gate atmaybe_slim_otp_bundle/2(lib/mob_dev/native_build.ex:5861) readsSystem.get_env("MOB_SLIM")— mirroringrelease.ex:62, which explicitly sets the env var for its subprocess call chain. Nothing in the codebase ever callsProcess.get(:mob_slim).Result: only
mix mob.releaseproduced a slim OTP bundle.mix mob.deploy --slimshipped the full runtime.Fix
Replace
Process.put(:mob_slim, slim)with a public-for-testing helper__apply_slim_env__/1that setsMOB_SLIM=1or=0. The gate atmaybe_slim_otp_bundle/2is unchanged; bothmob.deployandmob.releasenow use the same env-var mechanism.Tests
Two new revert-verified tests in
NativeBuildTest(test/mob_dev/native_build_test.exs):MOB_SLIM=0set beforehand,__apply_slim_env__(true)must leave the env at"1"MOB_SLIM=1set beforehand,__apply_slim_env__(false)must leave the env at"0"Setup uses
on_exitto restore the priorMOB_SLIMfor isolation (the module is alreadyasync: falsebecause it mutates other process-global env vars in the MLX section).Revert-verified: swapped the impl back to
Process.put(:mob_slim, slim)and both new tests failed with"0"/"1"mismatches. Restored → 215/215 pass.Gates
mix test: 215 pass (this file), full suite greenmix credo --strict: 0 issues (3767 mods/funs)mix compile --warnings-as-errors --force: cleanCloses MOB-73.