Skip to content

vp migrate writes minimumReleaseAgeExclude into a pnpm workspace that turns the age gate off with minimumReleaseAge: 0, and keeps re-adding it #3601

In review

Description

@caglarenes

Describe the bug

A pnpm workspace with minimumReleaseAge: 0 has pnpm's release-age gate turned off: nothing is held back, so there is nothing to exempt. vp migrate still adds the ten Vite+ exemptions to minimumReleaseAgeExclude, so the file ends up stating both that nothing is held back and which packages are exempt from it.

Deleting the list does not stick. The next vp migrate reports the project as needing an update ("Updated . to Vite+ 1.8.0 … Package manager settings configured") and writes the same ten lines back. The project is never treated as already on Vite+ until it accepts them.

Both places check whether the key exists, not what it says:

  • rewritePnpmWorkspaceYaml (packages/cli/src/migration/migrator/catalog.ts): if (doc.has('minimumReleaseAge'))
  • pnpmWorkspaceMinimumReleaseAgeExemptionsPending (same file): doc.minimumReleaseAge === undefined

I intend to submit a PR that treats 0 (any value ≤ 0) as no gate in both places, with tests next to the existing ones in migrator.spec.ts.

A related point I left out of that PR: an absent key is not "no gate" on pnpm ≥ 11. There minimumReleaseAge defaults to 1440, as the comment in crates/vp_cli_snapshots/tests/cli_snapshots/main.rs notes. So a pnpm 11+ workspace without the key has the gate on but gets no exemptions. Fixing that needs the pnpm version in the pending check, which is a larger change, so I'm leaving that one to you.

Reproduction

Steps below (three small files, no repository needed).

Steps to reproduce

  1. In an empty directory:

    package.json

    {
      "name": "age-gate-off",
      "private": true,
      "type": "module",
      "packageManager": "pnpm@12.23.0",
      "scripts": { "build": "vite build" },
      "devDependencies": { "vite": "^8.3.8" }
    }

    pnpm-workspace.yaml

    minimumReleaseAge: 0

    vite.config.ts

    export default {};
  2. git init && git add -A && git commit -m init

  3. vp migrate --no-interactive --no-agent --no-editor --no-hooks

    pnpm-workspace.yaml is now:

    minimumReleaseAge: 0
    catalog:
      vite: npm:@voidzero-dev/vite-plus-core@8.3.8001
      vite-plus: 1.8.0
    overrides:
      vite@*: 'catalog:'
    minimumReleaseAgeExclude:
      - vite-plus
      - '@voidzero-dev/*'
      - oxlint
      - '@oxlint/*'
      - tsrs
      - '@tsrs/*'
      - oxfmt
      - '@oxfmt/*'
      - vitest
      - '@vitest/*'
  4. Delete the minimumReleaseAgeExclude list, commit, and run the same vp migrate again. It prints "Updated . to Vite+ 1.8.0 … Package manager settings configured" and the list is back.

I ran both migrations with VP_SKIP_INSTALL=1 to skip the install; the workspace file is written either way.

System 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

Tools:
  vite      v8.3.8
  rolldown  v1.2.19
  vitest    v5.1.1
  oxfmt     v0.79.0
  oxlint    v1.94.0
  tsrs      v7.1.0-beta.tsrs4
  tsdown    v0.23.4

Node 26.13.1, pnpm 12.23.0, Windows 11

Used Package Manager

pnpm

Logs

$ vp migrate --no-interactive --no-agent --no-editor --no-hooks
◇ Migrated . to Vite+ 1.8.0
• Node 26.13.1  pnpm 12.23.0

# after deleting minimumReleaseAgeExclude:
$ 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:
    vite   → 8.3.8
• Package manager settings configured

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 reproduction above with vite-plus 1.8.0.

Activity

  1. added theissue type on Nov 29, 2026
  2. voidzero-bot commented on Nov 29, 2026

    @voidzero-bot
    Contributor
    • Reproduced: Yes
    • Exploration: Yes — View branch
    • Unit Test: Yes — packages/cli/src/migration/tests/migrator.spec.ts
    • Priority: P3: minor bug. This only hits pnpm workspaces that explicitly disable the age gate with minimumReleaseAge: 0, and it is cosmetically annoying rather than breaking: the extra minimumReleaseAgeExclude list is inert while the gate is off, and simply leaving the list in place restores the normal "already using Vite+" fast exit.

    Both the writer (rewritePnpmWorkspaceYaml) and the pending check (pnpmWorkspaceMinimumReleaseAgeExemptionsPending) in packages/cli/src/migration/migrator/catalog.ts gate on minimumReleaseAge key presence rather than its value, so 0 — which pnpm (and Vite+'s own installer override in crates/vp_setup/src/install.rs) treats as a disabled gate — is misread as an enabled one. That makes the writer add the ten Vite+ exemptions to a gate that holds nothing back, and makes the pending check treat their absence as a pending change, so every vp migrate re-adds a deleted list and the project never converges to the fast exit. The code's own comment ("no gate -> nothing to exempt") states the opposite intent, and a control with minimumReleaseAge: 1440 confirms the value is the discriminator while enabled gates keep working.

    I found a potential fix for this issue. It adds a single shared pnpmAgeGateEnabled predicate used by both sites (absent/null and ≤ 0 → no gate, > 0 → gate), plus four regression tests next to the existing age-gate coverage that fail without the change and pass with it; the reporter's deferred pnpm ≥ 11 absent-key default (1440) is intentionally left untouched.

    Full Triage Report

    Triage Report — Issue #3601

    Result: REPRODUCED

    Issue summary

    vp migrate on a pnpm workspace that turns pnpm's release-age gate off with minimumReleaseAge: 0 still writes the ten Vite+ exemptions into minimumReleaseAgeExclude, even though nothing is held back and there is nothing to exempt. Deleting the list does not stick: the next vp migrate reports "Package manager settings configured" and writes the same ten lines back, so the project is never treated as already on Vite+ until it accepts them.

    Expected: with minimumReleaseAge set to 0 (or any value ≤ 0) the gate is off; the migrator should neither write minimumReleaseAgeExclude nor treat its absence as a pending package-manager-settings change.

    Actual: the exemptions are written on first migration and re-written on every subsequent migration after manual deletion.

    Environment

    • Vite+ checkout: main @ 5cf0b72 (local packages/cli dist built from this checkout; packages/cli version 1.8.0, same as the report)
    • Global CLI used to dispatch: vp v1.8.0 at /home/runner/.vite-plus/bin/vp
    • Migration executed through the local npm registry wrapper (local-npm-registry.ts --pack -- env VP_SKIP_INSTALL=1 vp migrate --no-interactive --no-agent --no-editor --no-hooks) so the migration ran against the checkout's own vite-plus build.
    • Managed toolchain selected by the migrator: Node 26.13.1, pnpm 12.23.0 (matches the report)
    • Host: Ubuntu (GitHub Actions runner), shell: bash
    • Reproduction path: /tmp/vite-plus-triage/gh-3601/repro

    Reproduction steps and output

    Project created per the report (package.json with vite ^8.3.8, pnpm-workspace.yaml containing only minimumReleaseAge: 0, vite.config.ts with export default {};), git init + commit.

    1. First migration (gate off, minimumReleaseAge: 0)

    Exit code 0. Output:

    ◇ Migrated . to Vite+ 1.8.0
    • Node 26.13.1  pnpm 12.23.0
    

    Resulting pnpm-workspace.yaml (matches the report verbatim, including the inconsistent combination of an off gate plus exemptions):

    minimumReleaseAge: 0
    catalog:
      vite: npm:@voidzero-dev/vite-plus-core@8.3.8001
      vite-plus: 1.8.0
    overrides:
      vite@*: 'catalog:'
    minimumReleaseAgeExclude:
      - vite-plus
      - '@voidzero-dev/*'
      - oxlint
      - '@oxlint/*'
      - tsrs
      - '@tsrs/*'
      - oxfmt
      - '@oxfmt/*'
      - vitest
      - '@vitest/*'

    2. Delete minimumReleaseAgeExclude, commit, re-run same command

    Exit code 0. Output:

    ◇ Updated . to Vite+ 1.8.0
    • Node 26.13.1  pnpm 12.23.0
    • Dependencies:
        vite   → 8.3.8
    • Package manager settings configured
    

    The ten-line minimumReleaseAgeExclude list is written back verbatim.

    Controls

    1. List kept in place, re-run migrate → quiet: This project is already using Vite+! Happy coding! (exit 0), no file changes. The pending check does settle once the list is present, so the re-write is triggered specifically by the list's absence, not by a generic "always rewrites pnpm-workspace.yaml" failure.

    2. Gate actually on (minimumReleaseAge: 1440), exclude list deleted, re-run migrate → "Package manager settings configured" and the list is re-added. That re-add is correct behavior for an enabled gate, confirming the discriminating factor is the gate's value (0), not the deletion workflow or environment.

    Observations (no fix proposed in this step)

    • Current main still contains both existence-only checks named in the report, in packages/cli/src/migration/migrator/catalog.ts: the writer (~line 498) if (doc.has('minimumReleaseAge')) and the pending check (~line 1413) doc.minimumReleaseAge === undefined.
    • Neither place inspects the value, so 0 is treated as an enabled gate in both the writer and the pending check, which explains both the initial write and the repeated re-write.
    • The reporter's separate note about an absent minimumReleaseAge key on pnpm ≥ 11 (where the gate defaults to 1440, so absence means "gate on") was not tested here; the reported trigger (0) alone reproduces fully.
    • The reproduction matches the report's output and file contents exactly on current main; this is not an already-fixed issue.

    Diagnosis

    Affected code

    All in packages/cli/src/migration/migrator/catalog.ts (migration layer, JS CLI — not the Rust global CLI):

    1. Writer — rewritePnpmWorkspaceYaml (line 346), the minimumReleaseAgeExclude block at lines 496–510:

      if (doc.has('minimumReleaseAge')) {        // ← presence check, value ignored
        ...
        for (const exclude of PNPM_MINIMUM_RELEASE_AGE_EXCLUDES) {
          if (!existing.has(exclude)) minimumReleaseAgeExclude.add(scalarString(exclude));
        }
        doc.setIn(['minimumReleaseAgeExclude'], minimumReleaseAgeExclude);
      }
    2. Pending check — pnpmWorkspaceMinimumReleaseAgeExemptionsPending (lines 1397–1419), line 1413:

      if (!doc || doc.minimumReleaseAge === undefined) {   // ← presence check
        return false;
      }
      return PNPM_MINIMUM_RELEASE_AGE_EXCLUDES.some((exclude) => !existing.has(exclude));

      PNPM_MINIMUM_RELEASE_AGE_EXCLUDES (lines 91–102, ten patterns) is shared by both, so the two checks cannot drift — but they share the same wrong predicate.

    Incorrect logic

    Both sites treat key presence as gate enabled. In pnpm, a numeric minimumReleaseAge of 0 means the release-age gate is disabled (nothing is quarantined), yet the YAML key exists. With minimumReleaseAge: 0:

    • The writer passes the doc.has(...) guard and appends the ten Vite+ exemptions, producing the self-contradictory file observed in the reproduction.
    • The pending check passes doc.minimumReleaseAge === undefined only when the key is absent; with the value 0 (a YAML scalar that deserializes to the number 0, not undefined), it evaluates the exemption comparison, finds the list missing, and reports the workspace as pending.

    Why it causes the observed behavior

    The pending check is consulted in the "already using Vite+" fast-exit path (packages/cli/src/migration/migrator/vite-plus-bootstrap.ts, lines ~826 and ~1218). Returning true makes an otherwise-current project take the full re-migration path, which calls rewritePnpmWorkspaceYaml (vite-plus-bootstrap.ts lines ~1062 and ~1237), whose presence-only guard then re-writes the deleted list. Hence the exact cycle reproduced: delete → "Updated . to Vite+ 1.8.0 … Package manager settings configured" → list restored; keep → "already using Vite+". The control with minimumReleaseAge: 1440 shows the same re-add, which there is correct, proving the value — not the workflow — is the discriminator.

    Suggested fix approach

    Introduce a single shared predicate, pnpmAgeGateEnabled(value: unknown): boolean, that parses the YAML scalar (numeric or numeric-string) and returns false for values ≤ 0, true for values > 0, and false for an absent/null value. Use it in place of doc.has('minimumReleaseAge') in the writer and in place of the doc.minimumReleaseAge === undefined guard in the pending check.

    Edge cases

    • A project that migrates with the gate on and later sets minimumReleaseAge: 0 keeps a stale exemption list; pnpm ignores minimumReleaseAgeExclude when the gate is off, so the fix leaves it in place rather than deleting user-editable entries.
    • The reporter's deferred point stands: an absent key is not "no gate" on pnpm ≥ 11, where pnpm defaults minimumReleaseAge to 1440 (see the comment in crates/vp_cli_snapshots/tests/cli_snapshots/main.rs ~line 877). Fixing that requires the pnpm major version in the pending check: the writer already receives pnpmMajorVersion/pnpmVersion, but pnpmWorkspaceMinimumReleaseAgeExemptionsPending(projectPath) takes only a path; its callers in vite-plus-bootstrap.ts do have detectedPackageManagerVersion / workspaceInfo.downloadPackageManager.version on hand, so a version-aware default is feasible without changing unrelated behavior for pnpm 9/10. Out of scope for the ≤ 0 fix.

    Regression evidence

    Existing adjacent tests that must keep passing: "exempts the vitest family from a pnpm minimumReleaseAge gate" (1440, migrator.spec.ts:4583), "does not add minimumReleaseAgeExclude when the pnpm age gate is absent" (migrator.spec.ts:4620), and "treats a pnpm workspace missing the minimumReleaseAge exemptions as pending" (migrator.spec.ts:4861). None cover the value 0, which is exactly the gap.

    Confidence: high

    The failing logic is proven by code inspection and matches the observed reproduction exactly.


    Verification

    Claim

    • Observed: with minimumReleaseAge: 0 (gate disabled), vp migrate writes the ten Vite+ exemptions into minimumReleaseAgeExclude, and re-adds the list on every subsequent migration after manual deletion, so the project never reaches the "already using Vite+" fast exit.
    • Reporter expects: a gate disabled by 0 (or any value ≤ 0) means nothing is held back, so no exemptions should be written and their absence should not be treated as pending.

    Intent research

    1. The code's own comment states the expected behavior. pnpmWorkspaceMinimumReleaseAgeExemptionsPending is documented (catalog.ts:1397–1403) as: "Gated on minimumReleaseAge being present, mirroring the writer (no gate -> nothing to exempt)." The intent is "gate off → no exemptions"; the implementation replaces "gate" with "key presence", which is not equivalent once the value can be 0.

    2. Vite+ itself treats 0 as "gate disabled" elsewhere. crates/vp_setup/src/install.rs:179–184 (write_release_age_overrides) writes minimum-release-age=0 into a local .npmrc explicitly to bypass pnpm's release-age gate, with a test asserting it (install.rs:1549–1552). The snapshot runner does the same (crates/vp_cli_snapshots/tests/cli_snapshots/main.rs:877–884) by exporting PNPM_CONFIG_MINIMUM_RELEASE_AGE=0. Within this repository's own semantics, minimumReleaseAge: 0 is an off gate, and the migrator's presence-only check contradicts it.

    3. Existing tests document the intent for an off gate. migrator.spec.ts:4620 ("does not add minimumReleaseAgeExclude when the pnpm age gate is absent") pins down that an off gate must not produce an exclude list. The 0 case is the same intent with the key present; no test or comment anywhere suggests 0 should behave differently from an absent key.

    4. History: both guards come from commit 327d23a4a (PR feat(migrate): upgrade existing Vite+ projects across versions #1891, 2026-07-02), which introduced the exemptions and the "mirroring" pending check together. Follow-up a9b17ec40 (chore(lint): adopt the Cloudflare Oxlint preset #3562, 2026-11-24) only hardened YAML shape handling. Nothing in either commit or PR body discusses the value 0; the presence check looks like an unnoticed shortcut. No intentional change chose this behavior.

    5. Prior discussions: gh search for minimumReleaseAge finds no issue or PR asserting that exemptions should be written when the gate is disabled. The closest prior issue, vp upgrade fails when minimumReleaseAge is configured #1260, was fixed by overriding the gate with minimum-release-age=0 — again treating 0 as "off".

    6. Documentation: no docs in docs/guide/, docs/config/, README.md, or rfcs/ mention minimumReleaseAge, so no documented behavior is contradicted.

    Verdict

    Bug — high confidence. The behavior contradicts the code's own comment, the existing absent-gate test intent, and the repository-wide convention that minimumReleaseAge: 0 disables the gate. The presence-only guards were never an intentional decision to treat 0 as an enabled gate.


    Fix

    Changed files

    • packages/cli/src/migration/migrator/catalog.ts — the fix.
    • packages/cli/src/migration/__tests__/migrator.spec.ts — regression tests.

    Rationale

    Both the writer and the pending check used key presence as a proxy for an enabled gate. Added one shared predicate, pnpmAgeGateEnabled(value), used by both sites so they cannot drift:

    • absent / null → no gate;

    • 0 or any negative value (numeric or numeric-string) → pnpm disables the gate (Vite+'s own installer writes minimum-release-age=0 for exactly this purpose);

    • a finite value > 0 → gate enabled;

    • non-numeric garbage → not treated as an enabled gate.

    • Writer: if (doc.has('minimumReleaseAge')) → if (pnpmAgeGateEnabled(doc.get('minimumReleaseAge'))) (doc.get unwraps the YAML scalar, so 0 arrives as the number 0).

    • Pending check: doc.minimumReleaseAge === undefined → !pnpmAgeGateEnabled(doc.minimumReleaseAge); comments updated to state the real rule.

    The deferred absent-key-on-pnpm-≥ 11 default (1440) is intentionally NOT addressed: it needs the pnpm version plumbed into the pending check and was explicitly left to maintainers by the reporter.

    Regression tests

    In migrator.spec.ts, beside the existing age-gate coverage:

    1. Writer (it.each([0, '0', -60]), "does not add minimumReleaseAgeExclude when the pnpm age gate is disabled by minimumReleaseAge: %s") — mirrors the existing absent-key test; asserts no minimumReleaseAgeExclude is introduced for a disabled gate (covers the string form too).
    2. Pending check ("does not treat a workspace whose age gate is disabled by minimumReleaseAge: 0 as pending") — a fully converged workspace with minimumReleaseAge: 0: detectVitePlusBootstrapPending is false before and after ensureVitePlusBootstrap, and no list is ever written.

    Confirmed test-first: with catalog.ts stashed, all 4 new cases fail (expected [ Array(10) ] to be undefined, expected true to be false); with the fix, all pass. A first draft of the pending test used a bare vite: 'catalog:' override, which overridesSatisfyVitePlus deliberately treats as unsatisfied for pnpm-ranged sinks — fixed the fixture to 'vite@*': 'catalog:' so the exemption check is the only variable.

    Validation

    • pnpm vitest run packages/cli/src/migration/__tests__/migrator.spec.ts → 429 passed (includes the 4 new cases).
    • pnpm vitest run packages/cli/src/migration/ → only vitest-v5.spec.ts/vitest-v5-lockfile.spec.ts fail; identical failure set on the stashed (clean) tree, i.e. pre-existing environment failures.
    • pnpm -F vite-plus build-ts → rebuilt the local packages/cli dist.
    • Original reproduction re-run from scratch in a fresh project:
      • minimumReleaseAge: 0 → no minimumReleaseAgeExclude written;
      • immediate second run → "This project is already using Vite+! Happy coding!" (the reported never-converging loop is gone);
      • control: flipping to minimumReleaseAge: 1440 → exemptions still written, preserving correct behavior for an enabled gate.
    • Snapshot cases: cargo build -p vp_global_cli then cargo test -p vp_cli_snapshots -- migration_oxlint → 39 passed, no snapshot diffs (these fixtures run vp migrate on workspaces with minimumReleaseAge: 0).
    • vp check → format pass; the 105 lint/type errors are all in docs/.vitepress/* and identical on the clean tree — pre-existing, none in the changed files.

    Skipped checks, with reasons

    • Full pnpm test:unit / just test: the migration suite is fully covered above; the remaining suites are untouched by this change and the job budget does not allow a full run.
    • Full just snapshot-test: only migrate-touched fixtures were reviewed; the three fixtures whose input carries minimumReleaseAge: 0 (migration_oxlint_*) were run and pass. core_* fixtures that mention minimumReleaseAge: 0 use vp install, not the migrator.

    Alternatives considered

    • Removing a stale exclusion list when the gate is later disabled: rejected — the writer never deletes user-visible entries it did not add in the same pass, and pnpm ignores the exclude list when no gate is active.
    • Plumbing the pnpm version into the pending check to also handle the pnpm ≥ 11 absent-key default (1440): rejected as out of scope for this minimal fix; recorded in the diagnosis for maintainers.

    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: #3602

  3. added
    - P3: minor bug
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugtriage: fix verified

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Target date

    None yet

    Start date

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions