Repository navigation
Description
[agent] Found by the architecture refactor routine on main at cfc870f. Test code only: hosted mode in a Rush repo works today (run by hand, below). The problem is that no test would notice if it stopped.
The problem
rush_hosted_real_rush_update_install (crates/socket-patch-cli/tests/e2e_redirect_rush_sim.rs, line 589) is the one test that runs hosted mode under the real @microsoft/rush: rush update, scan --mode hosted, rush install, the patched bytes, VEX, then the preventManualShrinkwrapChanges refusal and the rush update that recovers from it. It reports ok in CI on all three operating systems and has never run an assertion there, and it cannot run one when a developer opts in:
- No CI leg opts in. The test returns at line 590 unless
RUSH_E2E=1. The three legs that run the suite (.github/workflows/ci.yml, lines 2137, 2253 and 2292) run it with--ignoredandpnpm_required, and no workflow or script namesRUSH_E2E. - Opted in, it still skips. Its fixture pairs Rush 5.100.0 (line 52) with pnpm 9.15.9 (line 608). That Rush release fails on the pnpm 9 lock of this fixture, so
rush updatefails every time, and lines 669 to 675 turn a failedrush updateintoSKIP … (network?)and a pass. The pairing has been there since the test was added (e9b0a58, 2026-07-02).
#1400 (fd7c243, for #1054) fixed this class for the suite's toolchain probe: "a runner without pnpm would turn the leg green without running anything". It left these two skips as they were; the #[ignore] text records that ("tier-2 RUSH_E2E=1 self-skip unchanged").
The other two tests of the suite are a simulation, as the file's header says: they copy the rewritten lock into a hand-made common/temp and run pnpm install --frozen-lockfile there, over a lock written by hand (rush_common_lock, line 163). So nothing checks hosted mode against the lock Rush itself writes, against Rush's own validation of the lock, or against the preventManualShrinkwrapChanges flow that the scan's warning and docs/ecosystems.md ("Hosted mode in a Rush repo") describe.
Evidence
All runs use the binary built from main (cfc870f), Node 22.23.5 and corepack pnpm 9.15.9.
As CI runs it, and opted in:
$ SOCKET_PATCH_PNPM_E2E_REQUIRED=1 cargo test -p socket-patch-cli --test e2e_redirect_rush_sim -- --ignored --nocapture
test rush_hosted_real_rush_update_install ... SKIP e2e_redirect_rush_sim: set RUSH_E2E=1 to run the real-rush tier-2 leg
ok
$ RUSH_E2E=1 SOCKET_PATCH_PNPM_E2E_REQUIRED=1 cargo test -p socket-patch-cli --test e2e_redirect_rush_sim -- --ignored --nocapture
test rush_hosted_real_rush_update_install ... SKIP e2e_redirect_rush_sim (tier2): `rush update` failed (network?):
[…]
ERROR: Cannot get dependency key for temp project: @rush-temp/app-a
ok
test result: ok. 3 passed; 0 failed
The failure is the pairing, not the network or Node. The test's own fixture (one project, no useWorkspaces), by hand on the same machine:
| Rush | pnpm | rush update |
|---|---|---|
| 5.100.0 | 9.15.9 | ERROR: Cannot get dependency key for temp project: @rush-temp/app-a |
| 5.100.0 | 8.15.9 | finished successfully |
| 5.182.1 | 9.15.9 | finished successfully |
With a Rush that works, the test runs and passes on main. With RUSH_VERSION set to 5.182.1 (the release e2e_vendor_rush.rs pins and runs in CI) and no other change, the test runs every assertion in about 20 seconds and passes.
Two mutants of the hosted pnpm rewrite (plan_hosted, crates/socket-patch-core/src/formats/pnpm/hosted.rs), each behind an environment switch in one build, never committed:
- M1: every Rush lock is left alone.
- M2: a lock is left alone when it holds
@rush-temp/entries. That is the shape Rush writes for a repo without pnpm workspaces, and the shape of the test's own fixture.
| simulated tests (2) | real-Rush test, as CI runs it | real-Rush test, RUSH_E2E=1 |
real-Rush test, RUSH_E2E=1 and Rush 5.182.1 |
|
|---|---|---|---|---|
main |
pass | "ok" (skipped) | "ok" (skipped) | pass |
| M1 | fail | "ok" (skipped) | "ok" (skipped) | fail |
| M2 | pass | "ok" (skipped) | "ok" (skipped) | fail: "real rush install must land the PATCHED bytes" |
M2 passes every test in the repository: no fixture of the hosted rewrite holds an @rush-temp/ entry (the string appears in vendor/pnpm_lock/rush.rs, in the contract and nowhere else), so only a lock that Rush wrote can reach it.
What the test would guard, run by hand with Rush 5.182.1 and a stand-in patch API serving a patched left-pad 1.3.0. All of it matches the documentation today:
- pnpm 9.15.9 and 10.28.0, pnpm workspaces: the scan rewrites
common/config/rush/pnpm-lock.yaml;rush installlands the patched file in the project that depends on it;vexattests it. On 10.28.0 a fresh clone installs the patched file, androllbackrestores the lock byte for byte. preventManualShrinkwrapChanges:rush installrefuses the edited lock,rush updaterefreshesrepo-state.json, and the pin is still in the lock afterwards.- Subspaces (pnpm 10.28.0): both subspace locks are pinned, both keep the pin through
rush update, and an install into an emptycommon/templands the patched file in both. - pnpm 12.21.0 and 11.28.12: a plain
rush installfails withERR_PNPM_TARBALL_URL_MISMATCH; the remedies the warning names install the patched file (pnpm_config_trust_lockfile=true, and on pnpm 11usePnpmFrozenLockfileForRushInstallas well). On pnpm 11 without the experiment the install exits 0 with the upstream file, as the warning says.
Planned fix
Test code and one CI key; no production change.
- Pin the Rush release the vendored suite pins (5.182.1), so the fixture can install.
- Drop the
RUSH_E2Egate.e2e_vendor_rushalready fetches the real Rush withnpm xon the same CI legs, so the network is not a new dependency. - Under
SOCKET_PATCH_PNPM_E2E_REQUIRED, make a failedrush updatea failure, as CI: fail pnpm e2e legs that skip every test (#1054) #1400 did for a missing pnpm. - After the recovering
rush update, assert that the lock still holds the hosted tarball. The scan prints "the hosted wiring survivesrush update", and the test checks only that the command exits 0. - Show the red and green: M2 above fails the fixed test and passes the test as it is.
Generated by Claude Code
Activity
refactor: #2363 and #2364 filed; real Rush ran