fix(wizard): honor MOSAIC_GATEWAY_SKIP_NPM_INSTALL — unblock install.sh --dev gateway testing #698

Merged
jason.woltje merged 2 commits from fix/gateway-config-honor-skip-env into next 2026-07-10 01:30:11 +00:00
Owner

What

Restores the CLI-side consumer of MOSAIC_GATEWAY_SKIP_NPM_INSTALL: the wizard's gateway stage now skips installGatewayPackage() (npm install -g @mosaicstack/gateway@latest) when the env is 1, plus two spec cases that pin the behavior.

Why

tools/install.sh --dev (on next) builds CLI and gateway from source at --ref and exports MOSAIC_GATEWAY_SKIP_NPM_INSTALL=1 — but the consumer was lost when #676 closed as superseded (#689 took the gateway-side Redis fix; the CLI-side env gate fell through the crack). Result today: every --dev run silently overwrites the source-built gateway with the published @latest, so a dev-test validates the wrong artifact. This unblocks the planned greenfield VM dev-test of the next lane.

Producer already on next (install.sh lines 124/493/673); this adds the missing consumer.

Verification

  • vitest: 12/12 pass (2 new cases; the env-gate case fails on revert — true behavioral pin)
  • tsc --noEmit clean, eslint pass, prettier clean
  • Non-dev installs: env unset ⇒ undefined === '1' is false ⇒ byte-identical behavior
  • Independent review (author≠reviewer): PASS — gate logic, daemonRunning interaction, env conventions (=== '1' matches MOSAIC_ASSUME_YES et al.), test pinning all verified

Companion

Enables: install.sh --dev --ref <branch> end-to-end gateway testing on the 0.0.49/next lane.

🤖 Generated with Claude Code

## What Restores the CLI-side consumer of `MOSAIC_GATEWAY_SKIP_NPM_INSTALL`: the wizard's gateway stage now skips `installGatewayPackage()` (`npm install -g @mosaicstack/gateway@latest`) when the env is `1`, plus two spec cases that pin the behavior. ## Why `tools/install.sh --dev` (on `next`) builds CLI **and** gateway from source at `--ref` and exports `MOSAIC_GATEWAY_SKIP_NPM_INSTALL=1` — but the consumer was lost when #676 closed as superseded (#689 took the gateway-side Redis fix; the CLI-side env gate fell through the crack). Result today: every `--dev` run silently overwrites the source-built gateway with the published `@latest`, so a dev-test validates the wrong artifact. This unblocks the planned greenfield VM dev-test of the `next` lane. Producer already on `next` (`install.sh` lines 124/493/673); this adds the missing consumer. ## Verification - vitest: 12/12 pass (2 new cases; the env-gate case fails on revert — true behavioral pin) - `tsc --noEmit` clean, eslint pass, prettier clean - Non-dev installs: env unset ⇒ `undefined === '1'` is false ⇒ byte-identical behavior - Independent review (author≠reviewer): **PASS** — gate logic, daemonRunning interaction, env conventions (`=== '1'` matches `MOSAIC_ASSUME_YES` et al.), test pinning all verified ## Companion Enables: `install.sh --dev --ref <branch>` end-to-end gateway testing on the 0.0.49/`next` lane. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jason.woltje added 2 commits 2026-07-09 20:25:01 +00:00
Lets dev/offline installs keep an already-present global @mosaicstack/gateway
(e.g. a build-from-source `install.sh --dev`) instead of overwriting it with
the registry @latest build during `mosaic wizard` / `mosaic gateway install`.

Refs #675

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RMoEx7hfdFGjUiCHuN1RRi
test(wizard): cover MOSAIC_GATEWAY_SKIP_NPM_INSTALL gate in gateway-config stage
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
4b0137325b
Two cases: fresh install without skipInstall calls installGatewayPackage
exactly once (baseline), and MOSAIC_GATEWAY_SKIP_NPM_INSTALL=1 suppresses
the registry install so a build-from-source gateway (install.sh --dev) is
not overwritten by @latest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RMoEx7hfdFGjUiCHuN1RRi
Author
Owner

VERIFIED APPROVE — reviewer-of-record [W-jarvis:reviewer] head 4b0137325b

Reviewed PR #698 against base next at exact head 4b0137325be6357c65b168ce9b97c9fc98b4e0ef.

Evidence:

  • Scope verified: diff is confined to packages/mosaic/src/stages/gateway-config.ts and packages/mosaic/src/stages/gateway-config.spec.ts; git diff --check origin/next...origin/pr/698 clean.
  • Claim verified: tools/install.sh on next already exports MOSAIC_GATEWAY_SKIP_NPM_INSTALL=1 for dev/source and next fallback paths, but origin/next had no gateway-config consumer. This PR restores the missing consumer in gatewayConfigStage.
  • Behavior verified: when env var is unset, skipNpmInstall is equivalent to existing opts.skipInstall; fresh install still calls installGatewayPackage() when skipInstall: false and daemon is not running. When MOSAIC_GATEWAY_SKIP_NPM_INSTALL=1, the stage skips the registry install and does not overwrite a source-built/global gateway.
  • Tests verified: new specs pin both default install behavior and env-gated skip behavior; env cleanup added in beforeEach. Local targeted run passed: pnpm --filter @mosaicstack/mosaic test -- src/stages/gateway-config.spec.ts (9/9).
  • CI verified: Woodpecker #1661 pull_request and #1660 push are overall success on this head.

No merge performed by reviewer.

VERIFIED APPROVE — reviewer-of-record [W-jarvis:reviewer] head 4b0137325be6357c65b168ce9b97c9fc98b4e0ef Reviewed PR #698 against base `next` at exact head `4b0137325be6357c65b168ce9b97c9fc98b4e0ef`. Evidence: - Scope verified: diff is confined to `packages/mosaic/src/stages/gateway-config.ts` and `packages/mosaic/src/stages/gateway-config.spec.ts`; `git diff --check origin/next...origin/pr/698` clean. - Claim verified: `tools/install.sh` on `next` already exports `MOSAIC_GATEWAY_SKIP_NPM_INSTALL=1` for dev/source and next fallback paths, but `origin/next` had no gateway-config consumer. This PR restores the missing consumer in `gatewayConfigStage`. - Behavior verified: when env var is unset, `skipNpmInstall` is equivalent to existing `opts.skipInstall`; fresh install still calls `installGatewayPackage()` when `skipInstall: false` and daemon is not running. When `MOSAIC_GATEWAY_SKIP_NPM_INSTALL=1`, the stage skips the registry install and does not overwrite a source-built/global gateway. - Tests verified: new specs pin both default install behavior and env-gated skip behavior; env cleanup added in `beforeEach`. Local targeted run passed: `pnpm --filter @mosaicstack/mosaic test -- src/stages/gateway-config.spec.ts` (`9/9`). - CI verified: Woodpecker #1661 pull_request and #1660 push are overall success on this head. No merge performed by reviewer.
jason.woltje merged commit 193331544d into next 2026-07-10 01:30:11 +00:00
jason.woltje deleted branch fix/gateway-config-honor-skip-env 2026-07-10 01:30:11 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#698