fix(xtask): run pnpm install before build_mcp_widget#2070
Merged
Conversation
Fresh clones failed `cargo xtask build` because `build_mcp_widget` was the first step to touch pnpm — and it runs `pnpm --filter nteract-mcp-app install`, which assumes the workspace is already initialized. Without a prior `pnpm install`, the filtered install either errors or triggers its own root install sequence, which races with the background pnpm install that cmd_build used to fire after. Fix: move `ensure_pnpm_install()` up to Phase 0a, before `build_mcp_widget`. Drop the subsequent thread-spawned install plus its join point — there's nothing left to parallelize with at that phase since the widget step now runs synchronously after install. Also fix the same class of bug in `build_with_bundle` (backs `cargo xtask build-app` / `build-dmg`): it called `run_frontend_build` without any upstream pnpm install, so a fresh-clone release build would fail with missing-workspace-package errors.
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.
Summary
cargo xtask buildon a fresh clone failed becausebuild_mcp_widgetwas the first step to touch pnpm, and it runspnpm --filter nteract-mcp-app install— which assumes the workspace is already initialized. Without a prior rootpnpm install, that filtered install races with the background root install thatcmd_buildused to kick off afterwards.Fix moves
ensure_pnpm_install()up to Phase 0a, before the widget build. Drops the now-redundant background-install thread and its join point.Also fixes the same class of bug in
build_with_bundle(cargo xtask build-app/build-dmg): it calledrun_frontend_buildwithout any upstreampnpm install, so a fresh-clone release build would fail with missing-workspace-package errors. Addsensure_pnpm_install()right afterrequire_pnpm().Why the old order existed
cmd_build's background-install thread made sense whenbuild_mcp_widgetdidn't also shell out to pnpm. At some point the widget step was added and the fresh-clone case silently regressed.What's unchanged
cargo xtask dev,cargo xtask notebook,cargo xtask viteall already callensure_pnpm_install()synchronously up front. Their ordering is correct and untouched.ensure_pnpm_install()is still idempotent and short-circuits whennode_modules/.modules.yamlis newer thanpackage.jsonandpnpm-lock.yaml— no-op cost on warm trees.build_mcp_widget's ownpnpm --filter nteract-mcp-app installis kept as a safety belt for any future caller from a different code path.Test plan
cargo build -p xtask,cargo test -p xtask(9/9),cargo clippy -p xtask --all-targets -- -D warnings— all clean.cargo xtask buildon the warm tree; confirmed order of operations is "Skipping pnpm install" → "Skipping MCP Apps widget build" → "Building Rust targets...".git clone && cargo xtask build) to confirm the original fresh-clone path now succeeds.