Skip to content

MOB-73 — fix --slim gate: publish MOB_SLIM env var instead of Process dict - #83

Merged
GenericJam merged 1 commit into
masterfrom
fix/MOB-73-slim-env-var
Sep 12, 2026
Merged

MOB-73 — fix --slim gate: publish MOB_SLIM env var instead of Process dict#83
GenericJam merged 1 commit into
masterfrom
fix/MOB-73-slim-env-var

Conversation

@GenericJam

Copy link
Copy Markdown
Owner

mix mob.deploy --slim was a silent no-op. NativeBuild.build_all/1 (lib/mob_dev/native_build.ex:43) stored the boolean in Process.put(:mob_slim, slim), but the actual strip-pass gate at maybe_slim_otp_bundle/2 (lib/mob_dev/native_build.ex:5861) reads System.get_env("MOB_SLIM") — mirroring release.ex:62, which explicitly sets the env var for its subprocess call chain. Nothing in the codebase ever calls Process.get(:mob_slim).

Result: only mix mob.release produced a slim OTP bundle. mix mob.deploy --slim shipped the full runtime.

Fix

Replace Process.put(:mob_slim, slim) with a public-for-testing helper __apply_slim_env__/1 that sets MOB_SLIM=1 or =0. The gate at maybe_slim_otp_bundle/2 is unchanged; both mob.deploy and mob.release now use the same env-var mechanism.

Tests

Two new revert-verified tests in NativeBuildTest (test/mob_dev/native_build_test.exs):

  • MOB_SLIM=0 set beforehand, __apply_slim_env__(true) must leave the env at "1"
  • MOB_SLIM=1 set beforehand, __apply_slim_env__(false) must leave the env at "0"

Setup uses on_exit to restore the prior MOB_SLIM for isolation (the module is already async: false because 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 green
  • mix credo --strict: 0 issues (3767 mods/funs)
  • mix compile --warnings-as-errors --force: clean

Closes MOB-73.

… 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>
@GenericJam
GenericJam merged commit a7e064b into master Sep 12, 2026
3 checks passed
@GenericJam
GenericJam deleted the fix/MOB-73-slim-env-var branch September 12, 2026 05:20
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