Repository navigation
Semantics of vague version specs (latest / lts): should a shim ever block on the registry?
#3446
Replies: 1 comment
|
Thanks for separating the cache bug from the policy discussion. I’d address #3445 first by restoring caching and stale fallback with proper authentication isolation. For the broader policy, I’d prefer local-first execution: when a floating spec has a known, usable installation, launch it immediately and refresh in the background. Even a bounded lookup adds unnecessary latency to routine commands. The key is to track the resolved version separately from the ready-to-run version. A refresh should update the latter only after installation and verification succeed; failures should leave the working version available. I would still allow synchronous installation on first use. Exact pins must remain strict, and fallback for a tag must use a version previously resolved for that tag and registry/auth context—not an arbitrary installed version. This suggests two separate changes: fix authenticated caching first, then move floating-version updates off the launch path. |
Uh oh!
There was an error while loading. Please reload this page.
Context
vpresolves package-manager and Node.js version specs on every shim invocation (select_core_tool→resolve_package_manager_tool→ensure_package_manager_bin). With an exact pin that is free. With a dist-tag (latest,lts,latest-10) it means a registry or nodejs.org round trip before the tool even starts.Measured on vp 1.6.0,
pnpm --versionfrom a directory without a pin:latest,~/.npmrcholds a token for the registry originlatest, no token in.npmrcpnpm@12.18.0The cache bypass behind the first row is a bug, tracked in #3445. This discussion is about the semantics that make that bug matter.
Scope: two different layers
package.jsonpackageManager/devEngines,.nvmrc,.node-version24.6.3means24.6.3; download it if missing, fail if unavailableconfig.jsondefaultPackageManagerVersions,VP_*_VERSION,vp uselatest,lts,latest-10)Project pins are Corepack-compatible and I am not proposing to change them. Tags only exist because vp added its own default/session layer, so their semantics are vp's to define.
My position
For a vague spec, "eventually the newest" is the right reading: being a patch or a minor behind costs nothing, while a slow command, a failing command, or a command that fails because the network is flaky costs real time. Vagueness should therefore be resolved asynchronously, and a tag lookup should never be a precondition for running an already installed tool.
Three candidate policies
latestThe rule I would like to see is "a shim may decide, but may not install": knowing that a newer release exists is harmless; downloading it while someone typed
pnpm lsis not. Installation then belongs tovppaths.Orthogonal pieces that help whichever policy wins:
vpcommands —spawn_background_check_if_neededalready does exactly this for self-update (lock, timestamp,VP_NO_UPDATE_CHECK), so the shim can stay dumb while freshness still happens;Questions
latest/lts/latest-Nhave by default? I would pick P2.pnpm 12.20.0 is available; run vp env refresh) or stay silent?docs/guide/env.mddocuments both "cached for one hour" (line 102) and "re-resolve on each use" (line 191) — which of those survives?devEngines.packageManager: ^12) that is not installed: strict failure (Corepack behaviour) or the newest installed match?Happy to send PRs either way — the uncontroversial part (#3445 plus the short budget) does not depend on this decision.
All reactions