Repository navigation
Description
Describe the bug
In a pnpm workspace that uses Vitest directly (here, through @vitest/coverage-v8), vp migrate writes:
peerDependencyRules:
allowAny:
- vitest
allowedVersions:
vitest: "*"The catalog it writes pins vitest to a real Vitest version (vitest: 5.1.1, the one Vite+ bundles), not an alias. Peer ranges on vitest are therefore checked against a real version and are met as they are: in the reproduction, pnpm peers check finds nothing with the rule or without it. All the rule can still do is silence a real mismatch, such as a plugin whose vitest peer range excludes the bundled version.
That is the reasoning pnpmPeerDependencyRuleKeys (packages/cli/src/migration/migrator/vitest-ecosystem.ts) already applies to vite. The vite rule is dropped once the core's version encodes the Vite it bundles, because "then it only hides real incompatibilities". vitest gets no such condition: it is managed whenever the workspace uses Vitest.
Two more things make it stick:
- A workspace that removes the rule is reported as needing an update. The next
vp migrateprints "Package manager settings configured" and writes the rule back. - pnpm's documentation marks
peerDependencyRulesas deprecated, starting with the 12.17 docs, and points tooverrideswith:peerfor changing peer ranges. pnpm still applies the field and does not warn, so this is not breaking anything today.
Would you consider writing the vitest rule only when it is needed (as for vite), and leaving a workspace without it alone?
Reproduction
Steps below (no repository needed).
Steps to reproduce
set -eu
root=$(mktemp -d)
cd "$root"
cat >package.json <<'EOF'
{
"name": "app",
"private": true,
"type": "module",
"packageManager": "pnpm@12.23.0",
"scripts": { "test": "vitest run" },
"devDependencies": {
"@vitest/coverage-v8": "5.1.1",
"vite": "8.3.8",
"vitest": "5.1.1"
}
}
EOF
echo 'packages: []' >pnpm-workspace.yaml
echo 'export default {};' >vite.config.ts
mkdir src
printf "import { expect, test } from 'vitest';\ntest('one', () => expect(1).toBe(1));\n" >src/one.test.ts
echo node_modules >.gitignore
git init -q && pnpm install >/dev/null && git add -A && git commit -qm init
vp migrate --no-interactive --no-agent --no-editor --no-hooks
grep -A4 '^peerDependencyRules' pnpm-workspace.yaml
pnpm peers check
# Remove the rule and install again.
node -e 'const fs = require("fs"); fs.writeFileSync("pnpm-workspace.yaml", fs.readFileSync("pnpm-workspace.yaml", "utf8").replace(/^peerDependencyRules:\n(?:[ \t].*\n?)*/m, ""))'
pnpm install >/dev/null
pnpm peers check
git add -A && git commit -qm "no vitest peer rule"
vp migrate --no-interactive --no-agent --no-editor --no-hooks
grep -A4 '^peerDependencyRules' pnpm-workspace.yamlSystem Info
# The global CLI is not installed here, so there is no `vp env current`.
$ vp --version
vp v1.8.0
Local vite-plus:
vite-plus v1.8.0
Node 26.13.1, pnpm 12.23.0, Windows 11Used Package Manager
pnpm
Logs
The steps above, run as written:
$ vp migrate --no-interactive --no-agent --no-editor --no-hooks
◇ Migrated . to Vite+ 1.8.0
• Node 26.13.1 pnpm 12.23.0
✓ Dependencies installed in 4.2s
• 1 file had imports rewritten
$ grep -A4 '^peerDependencyRules' pnpm-workspace.yaml
peerDependencyRules:
allowAny:
- vitest
allowedVersions:
vitest: "*"
$ pnpm peers check
No peer dependency issues found
# after removing the rule and installing again
$ pnpm peers check
No peer dependency issues found
$ vp migrate --no-interactive --no-agent --no-editor --no-hooks
◇ Updated . to Vite+ 1.8.0
• Node 26.13.1 pnpm 12.23.0
✓ Dependencies installed in 329ms
• Package manager settings configured
$ grep -A4 '^peerDependencyRules' pnpm-workspace.yaml
peerDependencyRules:
allowAny:
- vitest
allowedVersions:
vitest: "*"AI disclosure: I found and wrote this with Claude Code (model: Claude Opus 5.5, claude-opus-5-5; its reasoning effort level is not shown to me). I ran the steps above with vite-plus 1.8.0 and pnpm 12.23.0.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Effort
Target date
Start date
Activity
voidzero-bot commentedon Nov 29, 2026
packages/cli/src/migration/__tests__/vite-peer-dependency-rule.spec.tsvitestpeer-mismatch reports and re-inserts itself after removal. It contradicts the project's own documented "rule only when needed" policy (and the core-version-alignment RFC explicitly deferred this removal to a follow-up), but the user-visible impact stays limited to masked peer warnings in a specific package-manager setup.Both reported symptoms reproduce on current
main:vp migratewritespeerDependencyRules: { allowAny: [vitest], allowedVersions: { vitest: "*" } }for every Vitest-using pnpm workspace, and a workspace that removes the rule is flagged as pending ("Package manager settings configured") so the next migration writes it back. The root cause ispnpmPeerDependencyRuleKeys(packages/cli/src/migration/migrator/vitest-ecosystem.ts), which keepsvitestin the managed peer-rule keys whenever the workspace uses Vitest — with no "only when needed" condition like the onevitePeerDependencyRuleRequiredapplies tovite. The rule's original purpose vanished in #1588, when the@voidzero-dev/vite-plus-testwrapper was deleted and the managedvitestbecame the real bundled version; since then pnpm checksvitestpeer ranges against a genuine version, so the rule can only hide real incompatibilities (verified empirically:@vitest/coverage-v8@2.0.5against bundledvitest 5.1.1is reported bypnpm peers checkwithout the rule and silently accepted with it).I found a potential fix for this issue. It mirrors the
vitehandling forvitest: a newvitestPeerDependencyRuleRequireddrops the rule from the managed peer-rule keys unless the managed spec still needs it (wrapper alias, dist-tag,file:/URL spec, or prerelease/build), a lingering managed rule is treated as stale and removed, a user-authoredallowedVersions.vitestrange other than'*'is preserved, and the migrate summary names the removed rule. The suggested changes are on the branch above — they pass the migration unit suite (12 new regression assertions fail without the fix), 350 migration snapshot trials, and an end-to-end run of your reproduction — but they need human review before merging.Full Triage Report
Triage Report — Issue #3604 (reproduce stage)
Issue summary
vp migratewrites avitestentry into pnpmpeerDependencyRules(
allowAny: [vitest],allowedVersions: { vitest: "*" }) in workspaces that useVitest directly (here through
@vitest/coverage-v8). The catalog that migrationwrites pins
vitestto a real bundled Vitest version (vitest: 5.1.1), not analias, so
vitestpeer ranges are satisfied without any rule —pnpm peers checkfinds no issues with or without it. The rule can therefore only silence a real
peer mismatch (e.g. a plugin whose
vitestpeer range excludes the bundledversion). Additionally, a workspace that removes the rule is treated as needing
an update: the next
vp migrateprints "Package manager settings configured"and writes the rule back. The
viterule gets no equivalent treatment only viavitePeerDependencyRuleRequired—vitesthas no such "only when needed"condition in
pnpmPeerDependencyRuleKeys(
packages/cli/src/migration/migrator/vitest-ecosystem.ts).Expected: the
vitestpeer rule is written only when needed (as forvite),and a workspace without it is left alone.
Actual: the rule is always written for Vitest-using workspaces, and is
re-inserted after the user removes it.
Environment
5cf0b72c8("fix(cli): run a selected app target with itsown toolchain (fix(cli): run a selected app target with its own toolchain #3509)"), branch
triagebot/fix-3604;vp v1.8.0installedfrom this checkout on
PATH.packageManager: pnpm@12.23.0, which the migration honored).vp migratewas run through the local registry wrapper:node packages/tools/src/local-npm-registry.ts --pack -- vp migrate ….Reproduction path
/tmp/vite-plus-triage/gh-3604/repro(steps as in the issue) and/tmp/vite-plus-triage/gh-3604/control(control case).Commands attempted and results
1. Setup (exactly as in the issue)
Created
package.jsonwith devDependencies@vitest/coverage-v8@5.1.1,vite@8.3.8,vitest@5.1.1,pnpm-workspace.yamlwithpackages: [],vite.config.ts,src/one.test.ts;pnpm installand an initial git commit.2. First
vp migrate(wrapped in the local registry)pnpm-workspace.yamlafterwards ends with:Note: no
viterule was written —vitePeerDependencyRuleRequireddeems thecore alias sufficient on this pnpm version, while
vitestgets no suchcondition. Reproduced (part 1).
3.
pnpm peers check— with the rule and without itBoth runs:
No peer dependency issues found. The rule is not needed in thisworkspace.
4. Remove the rule, reinstall, commit
Stripped the
peerDependencyRulesblock,pnpm install,pnpm peers check(still no issues), committed.
5. Second
vp migratepnpm-workspace.yamlagain contains:Reproduced (part 2): the removed rule is reported as a pending setting and
written back.
6. Control — non-Vitest workspace
/tmp/vite-plus-triage/gh-3604/control: plainvite@8.3.8project, samemigrate command. Resulting
pnpm-workspace.yaml:No
peerDependencyRulesat all — thevitestrule is specific to workspacesthat use Vitest directly, not written unconditionally. Control passes; the
failure is not an unrelated "always writes peer rules" bug.
Result
Reproduced on current
main(v1.8.0 checkout), with the local build, bothhalves of the report: (1) the
vitestpeer rule is written for a Vitest-usingworkspace even though
pnpm peers checkneeds no rule, and (2) removing therule makes the next
vp migraterewrite it ("Package manager settingsconfigured").
Observations for diagnosis (no fix proposed)
pnpmPeerDependencyRuleKeysinpackages/cli/src/migration/migrator/vitest-ecosystem.tsbuildsmanagedfrom
managedOverridePackages(usesVitest)keys, filtering outvitewhenvitePeerDependencyRuleRequiredis false.vitestis kept wheneverusesVitestis true — there is no "rule only when the catalog entry is not areal version satisfying peers" condition like the one
vitehas.stalelist only removesvitestwhen the workspace does NOT useVitest, so a user-removed rule in a Vitest-using workspace is indistinguishable
from a migration-written one and is restored by
mergeManagedPnpmPeerDependencyRules.vitest: 5.1.1(a real version, bundled withvite-plus), so peer ranges on
vitestare checked against and satisfied by aconcrete version; the
allowedVersions: { vitest: "*" }/allowAnyentrycan only suppress genuine mismatches.
peerDependencyRulesdeprecated (from the 12.17 docs) infavor of
:peeroverrides; pnpm 12.23 still applies the field silently.Diagnosis — Issue #3604 (diagnose stage)
Root cause
The
vitestpnpm peerDependencyRules entry is written (and re-written) becausepnpmPeerDependencyRuleKeysputsvitestintomanagedunconditionallywhenever the workspace uses Vitest, with no "rule only when needed" condition.
The analogous condition exists only for
vite(
vitePeerDependencyRuleRequired).Affected code (all in
packages/cli/src/migration/migrator/):vitest-ecosystem.ts:606-626—pnpmPeerDependencyRuleKeys(the core ofthe bug).
managedis derived from the keys ofmanagedOverridePackages(usesVitest)(line 343), which containsvitestwhenever
usesVitestis true. The only filter is(key) => viteRuleRequired || key !== 'vite'—vitestnever gets avitestPeerDependencyRuleRequired-style check.stalecontainsvitestonly when
!usesVitest, so in a Vitest-using workspace a user-removed ruleis indistinguishable from a migration-written one and is treated as missing.
shared.ts:266-284—vitePeerDependencyRuleRequired: the model for themissing condition. It returns false when the core alias version encodes the
bundled Vite (stable major ≥ 8) on pnpm ≥ 10.2.0, with the explicit comment
that then "the rule would only hide real incompatibilities".
vitest-ecosystem.ts:654-685—mergeManagedPnpmPeerDependencyRulesandcatalog.ts:462-497(pnpm-workspace.yaml writer): both add everymanagedkey toallowAnyand setallowedVersions[key] = '*', sovitestis (re)written.
vite-plus-bootstrap.ts:209-222—pnpmPeerDependencyRulesSatisfyVitePlusand its call sites (
vite-plus-bootstrap.ts:793/808/824/1132/1234,orchestrators.ts:235,catalog.ts:1301): pending-detection requiresmanaged.every(key => allowAny.has(key) && allowedVersions[key] === '*').A workspace that removed the
vitestrule is therefore flagged pending, thereconcile path runs (
vite-plus-bootstrap.ts:1294setsreport.packageManagerBootstrapConfigured),bin.ts:662-664prints"Package manager settings configured", and the rule is written back. This is
symptom 2.
vitest-ecosystem.ts:629-632—isManagedAllowedVersionexempts onlyvitefrom the'*'check; a hypothetical user-authored non-*allowedVersions.vitestrange is currently overwritten.Why the rule was ever needed (history)
487e33891) added the pnpm peerDependencyRules "because packagesexpecting
vitesaw the vite-plus version instead" — at that timevitestwas aliased to the wrapper
npm:@voidzero-dev/vite-plus-test@latest, whoseversion did not encode a real Vitest version, so
vitestpeer ranges werechecked against a non-vitest version and the rule silenced the noise.
342fd2f44, June 2026) deleted the wrapper and changed the managedvitestoverride to the real bundled version(
VITE_PLUS_OVERRIDE_PACKAGES.vitest = VITEST_VERSION,utils/constants.ts:64,currently
5.1.1). From that point,vitestpeer ranges are checked againsta genuine Vitest version and are satisfied without any rule — the rule's
original purpose disappeared, but nothing removed it from
managed.4dc066a44, Nov 2026) then introduced the "drop when not needed"behavior, but scoped it to
viteonly (core-version alignment RFC). Thevitestkey stayed inmanagedwheneverusesVitest.Why it only hides real mismatches (verified empirically)
The catalog pin (
vitest: 5.1.1) is a real Vitest version, so pnpm checksvitestpeer ranges against it legitimately. Scratch proof in/tmp/vite-plus-triage/gh-3604/peer-proof(vitest 5.1.1 +@vitest/coverage-v8@2.0.5, whosevitestpeer is2.0.5):allowAny: [vitest]/allowedVersions: { vitest: "*" }:pnpm peers checkdoes not report thevitestmismatch.✕ unmet peer vitest — Installed: 5.1.1, Wanted: 2.0.5 (@vitest/coverage-v8@2.0.5).So today the rule's only observable effect is suppressing exactly the kind of
genuine incompatibility the migration should surface — the same reasoning the
vitepath already encodes ("then it only hides real incompatibilities").Suggested fix approach (not implemented)
Mirror the
vitetreatment forvitestinpnpmPeerDependencyRuleKeys(
vitest-ecosystem.ts:606):vitestspec is always the real bundledVITEST_VERSION(no alias), so avitestPeerDependencyRuleRequiredanalogis even simpler than the
viteone: when the spec is a concrete bundledversion, the rule is not required for any pnpm version (the override target
IS vitest, so even pre-10.2 alias-to-peers behavior checks a real version).
vitestfrommanagedand add it tostalein that case, so theYAML/JSON writers (
catalog.ts:462,mergeManagedPnpmPeerDependencyRules)remove a lingering managed rule and pending-detection
(
pnpmPeerDependencyRulesSatisfyVitePlus) stops flagging rule-lessworkspaces as needing an update.
isManagedAllowedVersionto also exemptvitestvalues other than'*', so a user-authoredallowedVersions.vitestrange is preserved whilethe migration-written
'*'is removed (same user-vs-managed distinction thevitepath makes).viteone (report.vitePeerDependencyRuleRemoved→ analogous
vitestline inbin.ts:665) and document it indocs/guide/migrate-rules.md.Edge cases
VITEST_IS_MANAGED_OVERRIDEfalse (VP_OVERRIDE_PACKAGESwithoutvitest):already excluded from
managed; unchanged.!usesVitestworkspace already getsvitestinstale— that path iskept and becomes the universal behavior.
vitestentry with a non-'*'allowedVersionsvalue (point 3 above) — currently onlyviteis protected.@vitest/coverage-*pinned to an older line): after the fix,vp migratesurfaces them; the migration-rules doc then needs a per-package rule the same
way it handles incompatible
viteplugins.peerDependencyRulesis deprecated from the 12.17 docs (in favor of:peeroverrides); pnpm 12.23 still applies it silently, so behavior today isunchanged — but it is another reason not to write new managed entries.
Regression evidence
Not a regression in the strict sense: behavior is as-designed when #1588 landed
and #3317 simply did not extend the new "only when needed" policy to
vitest.The reporter's characterization matches the code exactly.
Confidence
high — the failing logic (
pnpmPeerDependencyRuleKeysmanagingvitestunconditionally) and its effect on both symptoms are proven by code
inspection, git history, and direct observation (rule written, re-written after
removal with "Package manager settings configured", and a real mismatch hidden
by the rule in the peer-proof scratch project).
Verification — Issue #3604 (verify stage)
Claim
vp migratewrites
peerDependencyRules: { allowAny: [vitest], allowedVersions: { vitest: "*" } },and re-writes it ("Package manager settings configured") after the user
removes it, because the rule's absence is treated as a pending
settings update.
vitestrule only when it is needed(as migration already does for
vite), and leave a workspace without therule alone.
Verdict
bug — the behavior is an acknowledged leftover, not a chosen behavior. The
repository's own design documents say the
vitestrule should be removed.Evidence
Explicit maintainer intent to remove it (direct evidence).
rfcs/core-version-alignment.md, "Goals and scope" (lines ~80-87):The core-version-alignment work (PR feat: align the core version with the bundled Vite version #3317,
4dc066a44) deliberately scopedthe "stop writing the peer rule" change to
viteand recorded that thevitestrule is equally unnecessary ("pinned to its real version") andslated for removal by a follow-up. Issue
vp migratekeeps writing avitestentry into pnpmpeerDependencyRules, which hides real peer mismatches, and writes it back after it is removed #3604 is that follow-up; nothinglanded between feat: align the core version with the bundled Vite version #3317 and current
main(5cf0b72c8) that did it.The rule's original justification is gone. It was introduced with the
wrapper era: PR fix(cli): add peerDependencyRules for standalone pnpm projects #1222 (
487e33891) added pnpmpeerDependencyRulesbecausepeers then resolved to the wrapper aliases (
vite→@voidzero-dev/vite-plus-core@1.x,vitest→npm:@voidzero-dev/vite-plus-test@latest), whose versions werenot real Vite/Vitest versions. PR refactor: replace @voidzero-dev/vite-plus-test with upstream vitest #1588 (
342fd2f44) deleted thevite-plus-testwrapper and pinnedvitestto the real bundledVITEST_VERSION(packages/cli/src/utils/constants.ts:64), sovitestpeer ranges are checked against a genuine Vitest version — no pnpm version
needs the rule (the target of the override is real vitest, so even
pre-10.2.0 alias-to-peers behavior checks a true version).
The repo's documented policy rejects exactly this rule.
docs/guide/migrate-rules.md"Peer rules" documents why migration drops theviterule: entries whose pinned version satisfies peers "only hide realincompatibilities", and
rfcs/core-version-alignment.mdstates "These rulesalso hide real incompatibilities". pnpm's own docs deprecate
peerDependencyRules(12.17+) in favor of:peeroverrides — the docs'recommended remedy for a genuinely incompatible plugin is a per-plugin
override/rule, not a blanket
vitest: '*'. No doc, test intent, or codecomment anywhere states that Vitest-using workspaces should keep a managed
vitestpeer rule.Empirically the rule only hides real mismatches (peer-proof scratch,
see diagnosis):
@vitest/coverage-v8@2.0.5(peervitest 2.0.5) againstbundled
vitest 5.1.1is reported bypnpm peers checkwithout the ruleand silently accepted with it — the exact outcome the
viteremoval wasdesigned to restore.
The re-writing behavior follows mechanically from
pnpmPeerDependencyRuleKeyskeepingvitestinmanaged(
vitest-ecosystem.ts:606-626) pluspnpmPeerDependencyRulesSatisfyVitePlus(
vite-plus-bootstrap.ts:209-222) requiring everymanagedkey to bepresent; it is not separately intended behavior. The
!usesViteststalepath already removes a lingering
vitestrule, showing migration itselftreats the rule as a managed artifact, not a user need.
Tests/snapshots do not encode an intent to keep it. The
vite-peer-dependency-rule.spec.tssuite (added with feat: align the core version with the bundled Vite version #3317) tests only theviterule; the vitest entries in other fixtures(
migrator.spec.ts:3040/4329/4457, snapshotmigration_vitest_peer_dep.md)record the current output rather than assert a requirement, and predate
(fix(cli): add peerDependencyRules for standalone pnpm projects #1222/refactor: replace @voidzero-dev/vite-plus-test with upstream vitest #1588) or are orthogonal to (feat: align the core version with the bundled Vite version #3317) the "rule only when needed"
policy. A behavior change here regenerates those snapshots, as feat: align the core version with the bundled Vite version #3317 itself
did for
vite.Prior discussions:
gh searchfor "peerDependencyRules vitest" /"vitest peer rule" finds only issue
vp migratekeeps writing avitestentry into pnpmpeerDependencyRules, which hides real peer mismatches, and writes it back after it is removed #3604 itself; PRs fix(cli): add peerDependencyRules for standalone pnpm projects #1222, refactor: replace @voidzero-dev/vite-plus-test with upstream vitest #1588, feat: align the core version with the bundled Vite version #3317(bodies checked) never defend keeping the
vitestrule for Vitest-usingworkspaces after the wrapper was deleted.
Confidence
high — the design RFC explicitly designates the
vitestpeer rule assomething "a follow-up removes", the rule's original purpose demonstrably
disappeared in #1588, the repo's documented policy ("such rules only hide real
incompatibilities") contradicts writing it, and both reported symptoms were
reproduced and traced to unambiguous code paths.
Fix — Issue #3604 (fix stage)
Rationale
Follow-up the design RFC asked for (
rfcs/core-version-alignment.md, "Out ofscope: the
vitestpeer rule (vitestis pinned to its real version, so afollow-up removes the rule)"): mirror the
vite"rule only when needed" policyfor
vitest. Since the@voidzero-dev/vite-plus-testwrapper was deleted(#1588), the managed
vitestspec is the real bundled Vitest version, so pnpmchecks
vitestpeer ranges against a genuine version — the rule can only hidereal incompatibilities, and its absence must not be reported as a pending
settings update.
Changed files
packages/cli/src/migration/migrator/shared.ts— newvitestPeerDependencyRuleRequired(spec)next tovitePeerDependencyRuleRequired: the rule is required unless the spec is aplain, stable semver version (a wrapper alias, dist-tag,
file:/URL spec, orprerelease/build still needs it).
packages/cli/src/migration/migrator/vitest-ecosystem.ts—pnpmPeerDependencyRuleKeysnow dropsvitestfrommanagedand adds it tostalewhenever the rule is not required (also for Vitest-using workspaces);isManagedAllowedVersiontreats a non-'*'allowedVersions.vitestas theuser's own constraint, exactly as for
vite.packages/cli/src/migration/migrator/catalog.ts—trackVitePeerDependencyRuleRemovalgeneralized totrackPeerDependencyRuleRemoval, which records removals of both managedrules in the report.
packages/cli/src/migration/migrator/orchestrators.ts,packages/cli/src/migration/migrator/vite-plus-bootstrap.ts— renamed thethree tracker call sites accordingly.
packages/cli/src/migration/report.ts— newvitestPeerDependencyRuleRemovedflag.packages/cli/src/migration/bin.ts— migrate summary names the removedvitestrule, mirroring theviteline.docs/guide/migrate-rules.md— new "Vitest peer rule" documentation; theper-package-override note now covers both plain keys.
packages/cli/src/migration/__tests__/vite-peer-dependency-rule.spec.ts—regression tests (below).
crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/*/snapshots/.No writer or detection call site needed changes: the pnpm-workspace.yaml writer,
mergeManagedPnpmPeerDependencyRules, andpnpmPeerDependencyRulesSatisfyVitePlusall derive their behavior frompnpmPeerDependencyRuleKeys, so a rule-less Vitest workspace is no longerpending and a lingering managed rule is removed everywhere (workspace yaml, and
package.json#pnpmon pnpm before 10.6.2).Regression tests
vite-peer-dependency-rule.spec.ts(all fail without the source fix, verifiedby stashing the source changes):
vitestPeerDependencyRuleRequiredtable:5.1.1/5.2.0→ not required;prerelease/build/wrapper-alias/
latest/file:/undefined → required.pnpm vitest peer rule > with a stable core version:(the report flag is set,
detectVitePlusBootstrapPendingflips to false,second bootstrap is a no-op);
(regression for symptom 2: a rule-less workspace is converged, not pending);
(
allowedVersions: { vitest: '4 || 5' }survives,allowAnyentry and'*'value go).pnpm vitest peer rule > with a non-stable managed vitest spec:"keeps writing the vitest rule" (prerelease pin
5.2.0-beta.1).The pre-existing test "deletes peerDependencyRules from pnpm-workspace.yaml
when no rule remains" now covers the usesVitest case implicitly (both rules go).
Validation
pnpm -F vite-plus buildafter each source change (the snapshot runnervalidates dist freshness).
git stashof the source changes → 12 newassertions fail; restored → all pass.
pnpm -F vite-plus exec vitest run src/migration: 2351 passed, 51 failed —identical failure set to the pristine-checkout baseline
(
vitest-v5.spec.ts/vitest-v5-lockfile.spec.tsversioned-preflightfailures reproduce on unmodified
mainin this environment; unrelated topeer rules). +12 tests vs. baseline, all passing.
pnpm -F vite-plus exec tsc --noEmit -p tsconfig.json: clean.vp check: formatting clean; 105 lint errors — exactly the pristinebaseline count (pre-existing
docs/.vitepress/config.mtsetc.), none inchanged files.
just snapshot-test migration(compare mode, final build): 350 passed,0 failed. 25 snapshots regenerated with
UPDATE_SNAPSHOTS=1and reviewed:the diff is only (a) the
vitestpeerDependencyRules block no longerwritten (21 fixtures), (b) the new "Removed
vitest…" summary line where alegacy rule was removed (7 fixtures), and (c) pnpm 9's package.json rules
keeping
vite(rule still required on pnpm < 10.2.0) while dropping thevitestentries.(
node packages/tools/src/local-npm-registry.ts --pack -- vp migrate …),in
/tmp/vite-plus-triage/gh-3604/repro-fixedandrepro-final*:pnpm peers checkclean;"Package manager settings configured", no rule written (symptom 2 fixed);
rule is removed and the summary names it;
Skipped checks
pnpm test/pnpm bootstrap-clifull suite: the change is confined tovp migrate(novp createcode path or non-migration snapshot referencespeerDependencyRules), the migration unit suite and all 350 migrationsnapshot trials pass, and the remaining migration-adjacent suites
(
just check, Rust crates) are untouched by a TypeScript CLI change.vitest-v5*spec failures are left as-is (they fail onpristine
mainhere; out of scope).Alternatives considered
requiredcondition): rejected —with a
VP_OVERRIDE_PACKAGESwrapper alias, dist-tag,file:/URL, orprerelease managed spec (dev/CI and preview flows), peer ranges really do
fail and the rule is still needed; the condition mirrors
viteexactly.vite's (pre-10.2 alias-to-peers): not needed —the vitest override target is a real vitest version, so even pre-10.2 pnpm
checks a true version;
latest/alias specs are covered by the spec check.@vitest/browserkey(
managedOverridePackagesadds it for webdriverio projects): left out ofscope — the issue concerns
vitestonly, and that pin is also a real versionbut touches browser-provider fixtures beyond this fix.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
I've opened a pull request with this fix: #3606