Skip to content

Test shortcuts against the full path: equivalence, convergence, and v11/v12 differential harnesses #141

Closed
pnpm/pnpm
#17183

Description

@zkochan

Found by the defect-hotspots skill (pnpm/pnpm#17021) on 2026-10-17 over 90 days of main (086165da7a). The root cause comes from reading the commits and code; it was not reproduced. The design steps are proposals for a maintainer to settle.

All five clusters share two flaws:

  • One decision, several deciders. Every fix taught one decider one more case.
  • A shortcut with no oracle. A fast path, cache, lockfile reuse, or frozen check approximates a full computation, and no test states that they agree.

The existing tests are one example per bug, mostly added by the fix they guard. None of the clusters has an equivalence, convergence, matrix, or v11/v12 differential test.

Repo-wide test infrastructure that would cover several clusters:

  1. Equivalence harness (CLI suite). Run the shortcut and the full path on the same tree and compare snapshots: wanted lockfile, current lockfile, .modules.yaml, node_modules.
  2. Convergence assertions after every fixture: frozen install accepts the fresh lockfile, dedupe --check passes, a second install is byte-identical, the run gate is quiet after the install it spawned.
  3. v11/v12 differential. Extend pnpm_compatibility.rs to compare lockfiles and request logs, not only node_modules layout.
  4. Matrix runner. Cross fixtures with settings: shared lockfile or not, linker, injected, autoInstallPeers, dedupePeerDependents, autoDedupe, filtered/frozen.

The per-loop tasks (#142, #143, #144, #145, #146) name the matrix rows and assertions each loop needs.


Written by an agent (Claude Code, claude-opus-5-5).

Activity

  1. zkochan commented on Oct 17, 2026

    @zkochan
    MemberAuthor

    pnpm/pnpm#17030 (draft) adds harnesses 1, 2 and 4 for the repeat-install loop (#142). pnpm/crates/cli/tests/suite/repeat_install_oracle.rs runs install/edit sequences across a linker × lockfile layout × injected matrix:

    • Equivalence: the install fast path is checked against an in-place optimisticRepeatInstall: false install, comparing node_modules and the lockfiles. The run gate is checked against a clean install of a copy of the sources.
    • Convergence: each gate is checked after the install it satisfied.

    The other loops (#143 to #146) are not covered. The v11/v12 differential (item 3) is still open; it goes with the v11 follow-up for #139.


    Written by an agent (Claude Code, claude-opus-5-5).

  2. zkochan commented on Oct 17, 2026

    @zkochan
    MemberAuthor

    For the repeat-install gates, items 1, 2 and 4 landed in pnpm/pnpm#17030 as repeat_install_oracle.rs. Item 1 is each gate against a full install. Item 2 is the convergence after every step. Item 4 is the matrix over layouts, linkers, and injected packages. Item 3, the v11/v12 differential, is #148, now that pnpm/pnpm#17034 makes v11 write the same records.


    Written by an agent (Claude Code, claude-opus-5-5).

  3. zkochan commented on Oct 21, 2026

    @zkochan
    MemberAuthor

    Opened pnpm/pnpm#17183 covering the full scope of this issue (including the cross-version switch matrix deferred from #144 and the injected-freshness convergence/differential checks deferred from #148):

    1. Equivalence and convergence harnesses (repeat_install_oracle.rs, peer_convergence, injected_freshness_matrix.rs, _utils/mod.rs):

      • Extracted shared TreeView, workspace_lockfiles, and normalized workspace_modules_manifests helpers into pnpm/crates/cli/tests/suite/_utils/mod.rs.
      • Added .modules.yaml comparison and post-scenario convergence checks (install repeat byte-identity, install --frozen-lockfile, dedupe --check, and quiet repeat exec under verifyDepsBeforeRun=install) to repeat_install_oracle.rs.
      • Added check_repeat (second install byte-identity) and check_run_gate (--config.verify-deps-before-run=error exec node -e "") to peer_convergence::harness::check_row.
      • Added repeat-install lockfile byte-identity, verify-deps-before-run=error run-gate checks, dedupe --check, and PNPM_V11_BUNDLE differential lockfile comparison to injected_freshness_matrix::check.
    2. v11/v12 differential suite (pnpm_compatibility.rs, pnpm-testing-utils):

      • Wired CommandTempCwd::init() to use node <PNPM_V11_BUNDLE> whenever PNPM_V11_BUNDLE is set.
      • Un-ignored store_usable_by_pnpm_offline and same_global_virtual_store_layout_with_approved_postinstall.
      • Added differential comparisons for wanted lockfiles, current lockfiles, .modules.yaml, node_modules resolution tree, cross-CLI frozen handoffs, and registry request logs (add_recording_mocked_registry) across sharedWorkspaceLockfile, nodeLinker (isolated / hoisted), injectWorkspacePackages, autoInstallPeers, dedupePeerDependents, and --filter partial installs.
    3. Upward cross-version switch harness and nightly matrix (version.rs, .github/workflows/version-switch-matrix.yml, .github/workflows/pacquet-ci.yml):

      • Added switches_up_to_a_newer_pnpm_across_setting_sources_and_unknown_options and v11_switches_up_to_head_binary_from_local_registry in pnpm/crates/cli/tests/suite/version.rs using a local pnpr registry populated with synthetic @pnpm/exe platform packages.
      • Added .github/workflows/version-switch-matrix.yml to run the outer pnpm × pin × setting source × platform matrix nightly and on workflow_dispatch.
      • Wired pnpm_compatibility, injected_freshness_matrix, and upward version-switch tests into the convergence job of .github/workflows/pacquet-ci.yml.

    Generated with Antigravity (Claude Opus 4.6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions