fix(init): recognise a corepack-only package manager instead of refusing it - #1183
Conversation
…ing it `preflightRefusal` probed only the bare `<pm>` binary, so a machine where `packageManager` can only be run through corepack (no `pnpm` on PATH, only `corepack pnpm`) was refused as "pnpm is not installed" even though `corepack pnpm --version` succeeds. The suggested remedy, `corepack enable`, needs an elevated shell on Windows, so the refusal sent a corepack-managed user in a circle (reticlehq#1149). `init` now also probes `corepack <pm>` before refusing, and threads whichever prefix actually answered through to every place that invokes the package manager for the rest of the run: the dependency-install exec and its retry ladder, the dev-command string that gets printed and later spawned, the install-failure hint's suggested remedy commands, and node-io's closed RUNNABLE_COMMANDS allowlist, which now names `corepack` as a program init is allowed to spawn. Preflight resolves the invocation exactly once: it either hands back the command every later step should use, or the refusal to print, from the same probe — replacing two separate probing passes (one to decide whether to refuse, one to learn what the resolved command was) with one. The refusal text no longer suggests running the package manager through corepack right after saying corepack already failed to. Reverting the preflight.ts and detect/dev-script.ts changes locally and running the new tests confirms they fail without this change, per CONTRIBUTING.md's AI-assisted-contributions note. Closes reticlehq#1149 Signed-off-by: drakeo338 <paranoyouz@gmail.com>
|
Thanks for your first pull request to Reticle! A maintainer aims to review within two days. Before then, |
|
| 'a capabilities file). Fix the permissions, or run init from a checkout you own.', | ||
| }; | ||
| } | ||
| const resolved = resolvedPmCommand(io, packageManager); |
There was a problem hiding this comment.
Unnecessary probe with --url When
--url says the app is already served, preflight still probes the package manager before checking alreadyServed. On a corepack-only machine, this runs corepack <pm> --version synchronously and silently. If corepack needs time to resolve the manager, an init run that does not need to start the dev server is delayed.
| `installed on this machine — and corepack ${packageManager} could not run it either. Install ` + | ||
| `it (npm i -g ${packageManager}), or enable corepack for it (corepack enable — on Windows this ` + | ||
| 'needs an elevated shell), or pass --url with the address the app already serves.', |
There was a problem hiding this comment.
Signed-off-by: drakeo338 <paranoyouz@gmail.com>
The note that preflight takes the package manager init resolved (not a raw lockfile check), and the field report behind the --url tests. Comments only. Signed-off-by: Divyanshu Shekhar <imdshekhar@gmail.com>
What & why
preflightRefusalonly probed the bare<pm>binary, so a machine wherepackageManagercan only be run through corepack (nopnpmon PATH, onlycorepack pnpm) was told "pnpm is not installed" even thoughcorepack pnpm --versionsucceeds — and the suggested fix,corepack enable, needs an elevated shell on Windows, so the refusal sent that user in a circle.initnow also probescorepack <pm>, resolves the invocation exactly once (one probe, not two), and threads whichever prefix actually answers through the install exec, its retry ladder, the install-failure hint's remedy commands, the dev command, and node-io's allowlist. The refusal text no longer suggests corepack right after saying corepack already failed.Closes #1149
How it was verified
New/updated tests in
preflight.test.ts,install-retries.test.tsandinstall-hint.test.ts, each failing on the pre-fix code.Gates run
pnpm lint && pnpm typecheck && pnpm test:unit(~2 min — always)pnpm test:e2e(~8 min) — touched the tool surface,core, an observer, or telemetrypnpm gate:install(~15 min) — touchedreticle init,vite-plugin,next, orbabel-pluginpnpm test:e2e:desktop(~3 min) — touchedadapters/realm/electron,adapters/realm/tauri, or desktop captureChecklist
git commit -s) — CI's DCO check fails the PR without it. Already pushed?git rebase --signoff origin/main && git push --force-with-leaseany, no free strings (wire strings live in@reticlehq/core), no non-null!console.logor internal tracking codes left in the diff.changes/(never editCHANGELOG.md— that file is assembled at release time, and editing it is what makes PRs conflict; format in.changes/README.md) — added.changes/1149-corepack-pm-probe.mddocs/telemetry.md) and are covered by a test — N/A, this only changes which local package-manager binaryinitshells out to