Skip to content

fix(install): record pnpm@<release version> in .modules.yaml - #13087

Merged
zkochan merged 1 commit into
mainfrom
fix-modules-yaml-package-manager
Jul 16, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix-modules-yaml-package-manager

Conversation

@zkochan

@zkochan zkochan commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Summary

node_modules/.modules.yaml recorded packageManager: "[email protected]", which is wrong on both halves:

  • The name. pacquet is an in-repo crate name with no meaning outside this repository — the CLI ships as pnpm.
  • The version. CARGO_PKG_VERSION is the crate's version (0.0.1), not the release version the user installed (12.0.0-alpha.13).

The TypeScript CLI writes ${name}@${version} sourced from its own package.json, so it records [email protected]. It also branches on packageManager.name === 'pnpm' when deriving pnpmVersion (installing/deps-installer/src/install/index.ts:1133), which shows the name half is meaningful rather than decorative.

This PR uses pacquet_config::PNPM_VERSION — the constant pnpm --version already prints. Its doc comment records that pnpm bump keeps it in sync with the npm wrapper package's version (pnpm/npm/pnpm/package.json) and that the release workflow verifies the two match before building, so it is the release version by construction rather than by convention.

Risk

None to behavior. Neither stack reads the field back — I checked both: it is written by pacquet's install.rs and by the TypeScript deps-installer / deps-restorer, and read by neither. It is informational metadata. It is still part of the on-disk contract that external tooling can inspect, and it should not name a crate the user has never heard of.

Verified

$ pnpm add [email protected]
$ grep packageManager node_modules/.modules.yaml
  "packageManager": "[email protected]",
$ pnpm --version
12.0.0-alpha.13

cargo nextest run -p pacquet-package-manager — 730/730 pass.

The existing test checked only the starts_with("pacquet@") prefix, so it would not have caught the wrong version. It is now an exact comparison against pnpm@{PNPM_VERSION}, which fails if the recorded name or version ever drifts from the release version.

Found while confirming the fix for #13025. Related to #13086, which cleans up the same internal name leaking into error messages and --help text; this one is separate because it changes data written to disk rather than wording, and warrants its own release note.

Squash Commit Body

`.modules.yaml` recorded `packageManager: "[email protected]"`, which is wrong on
both halves. `pacquet` is an in-repo crate name that has no meaning outside this
repository — the CLI ships as `pnpm`. And `CARGO_PKG_VERSION` is the crate's
version (`0.0.1`), not the release version the user installed
(`12.0.0-alpha.13`).

The TypeScript CLI writes `${name}@${version}` sourced from its own package.json,
so it records `[email protected]`. It also branches on `packageManager.name === 'pnpm'`
when deriving `pnpmVersion` (`installing/deps-installer/src/install/index.ts`),
which shows the name half is meaningful and not decorative.

Use `pacquet_config::PNPM_VERSION`, the constant `pnpm --version` already prints.
Its doc comment records that `pnpm bump` keeps it in sync with the npm wrapper
package's version and that the release workflow verifies the two match, so it is
the release version by construction.

Nothing reads the field back in either stack — it is informational metadata — so
this changes no behavior. It is still part of the on-disk contract that external
tooling can inspect, and it should not name a crate the user has never heard of.

Tighten the test from a `starts_with("pacquet@")` prefix check to an exact
comparison against `pnpm@{PNPM_VERSION}`, so a future drift between the recorded
name/version and the release version fails.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

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


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Updated generated .modules.yaml metadata to report the correct pnpm@<version> package manager value.
    • Improved consistency between recorded package manager information and the version shown by the pnpm CLI.

`.modules.yaml` recorded `packageManager: "[email protected]"`, which is wrong
on both halves. `pacquet` is an in-repo crate name that has no meaning
outside this repository — the CLI ships as `pnpm`. And `CARGO_PKG_VERSION`
is the crate's version (`0.0.1`), not the release version the user
installed (`12.0.0-alpha.13`).

The TypeScript CLI writes `${name}@${version}` sourced from its own
package.json, so it records `[email protected]`. It also branches on
`packageManager.name === 'pnpm'` when deriving `pnpmVersion`
(`installing/deps-installer/src/install/index.ts`), which shows the name
half is meaningful and not decorative.

Use `pacquet_config::PNPM_VERSION`, the constant `pnpm --version` already
prints. Its doc comment records that `pnpm bump` keeps it in sync with the
npm wrapper package's version and that the release workflow verifies the
two match, so it is the release version by construction.

Nothing reads the field back in either stack — it is informational
metadata — so this changes no behavior. It is still part of the on-disk
contract that external tooling can inspect, and it should not name a crate
the user has never heard of.

Tighten the test from a `starts_with("pacquet@")` prefix check to an exact
comparison against `pnpm@{PNPM_VERSION}`, so a future drift between the
recorded name/version and the release version fails.
Copilot AI review requested due to automatic review settings July 16, 2026 21:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bf8fd9c4-6fa5-46ad-bc63-77860957cd10

📥 Commits

Reviewing files that changed from the base of the PR and between 33532b6 and 05435e8.

📒 Files selected for processing (3)
  • .changeset/modules-yaml-package-manager-pnpm.md
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install/tests.rs

📝 Walkthrough

Walkthrough

The package manager now writes pnpm@<PNPM_VERSION> to .modules.yaml instead of the pacquet crate version. The integration test and Changeset documentation reflect the updated metadata format.

Changes

Modules manifest version metadata

Layer / File(s) Summary
Update and validate manifest version metadata
pnpm/crates/package-manager/src/install.rs, pnpm/crates/package-manager/src/install/tests.rs, .changeset/modules-yaml-package-manager-pnpm.md
build_modules_manifest now writes pnpm@<PNPM_VERSION>, and the integration test asserts the exact value. A Changeset documents the format change.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • pnpm/pnpm#13049: Updates the PNPM_VERSION source used by this manifest metadata.

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-modules-yaml-package-manager

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix .modules.yaml packageManager to record pnpm@

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Write packageManager: "pnpm@" to node_modules/.modules.yaml (Rust install path).
• Use pacquet_config::PNPM_VERSION instead of crate name/version to avoid internal leakage.
• Tighten the .modules.yaml test to assert the exact recorded packageManager string.
Diagram

graph TD
A["package-manager install"] --> B["build_modules_manifest()"] --> C["node_modules/.modules.yaml"]
D["pacquet_config::PNPM_VERSION"] --> B
E["install_writes_modules_yaml test"] --> C
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Runtime derive version via `pnpm --version`
  • ➕ Would always match the currently executing pnpm binary, even in custom builds.
  • ➖ Adds a runtime dependency on spawning a process / capturing output.
  • ➖ Harder to keep deterministic in tests and in environments where spawning is restricted.
2. Build-time sync from wrapper package.json
  • ➕ Guarantees parity with the npm wrapper version without introducing a runtime dependency.
  • ➖ Requires wiring build tooling to locate/read the wrapper package.json during Rust build, increasing build complexity.

Recommendation: The chosen approach (formatting pnpm@{pacquet_config::PNPM_VERSION}) is best: it reuses the same constant already used for pnpm --version, keeps the value deterministic, and avoids leaking internal crate identity to disk while keeping the test guardrail strong.

Files changed (3) +12 / -8

Bug fix (1) +6 / -4
install.rsEmit 'pnpm@{PNPM_VERSION}' in '.modules.yaml' packageManager field +6/-4

Emit 'pnpm@{PNPM_VERSION}' in '.modules.yaml' packageManager field

• Switches '.modules.yaml''s 'package_manager' value from 'pacquet@${CARGO_PKG_VERSION}' to 'pnpm@{PNPM_VERSION}'. This ensures the recorded name and version match the public pnpm CLI release version rather than internal crate metadata.

pnpm/crates/package-manager/src/install.rs

Tests (1) +1 / -4
tests.rsStrengthen '.modules.yaml' packageManager assertion +1/-4

Strengthen '.modules.yaml' packageManager assertion

• Replaces a prefix-only assertion ('starts_with("pacquet@")') with an exact equality check against 'pnpm@{pacquet_config::PNPM_VERSION}', preventing future name/version drift.

pnpm/crates/package-manager/src/install/tests.rs

Documentation (1) +5 / -0
modules-yaml-package-manager-pnpm.mdAdd changeset documenting .modules.yaml packageManager fix +5/-0

Add changeset documenting .modules.yaml packageManager fix

• Adds a patch changeset noting that '.modules.yaml' now records 'pnpm@<release version>' rather than 'pacquet@<crate version>', aligning the on-disk metadata with the shipped CLI.

.changeset/modules-yaml-package-manager-pnpm.md

@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge. The change is a single-line correction to an informational metadata field that nothing in either stack reads back. The test is made strictly stronger, and PNPM_VERSION is already the canonical constant used everywhere else in the codebase.

The fix is minimal and correct: it replaces a compile-time string literal that embedded the wrong crate name and crate version with the same PNPM_VERSION constant that pnpm --version, the User-Agent header, and every other version-bearing output already use. No behavior changes, no new dependencies, and the strengthened test assertion will catch any future drift.

No files require special attention. The two test files in cli/src/cli_args/rebuild/tests.rs and ignored_builds/tests.rs that contain "pacquet@test" as a fixture value are unaffected — they are constructing .modules.yaml inputs for unrelated read paths, not the write path corrected here.

Reviews (1): Last reviewed commit: "fix(install): record pnpm@<release versi..." | Re-trigger Greptile

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Action required

1. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset file lists only pacquet and does not declare a bump type for the pnpm package.
This violates the changeset requirement and may prevent the user-facing change from being released
under the correct package.
Code

.changeset/modules-yaml-package-manager-pnpm.md[R1-3]

+---
+"pacquet": patch
+---
Evidence
PR Compliance ID 713436 requires each new/modified changeset to include an explicit pnpm entry
with a valid bump type. The added changeset front-matter includes only "pacquet": patch and omits
pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/modules-yaml-package-manager-pnpm.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changeset front-matter is missing an entry for the `pnpm` package.

## Issue Context
Per compliance requirements, changeset files must explicitly include `pnpm` with a valid bump type (`patch`/`minor`/`major`).

## Fix Focus Areas
- .changeset/modules-yaml-package-manager-pnpm.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment on lines +1 to +3
---
"pacquet": patch
---

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Changeset missing pnpm entry 📘 Rule violation § Compliance

The new changeset file lists only pacquet and does not declare a bump type for the pnpm package.
This violates the changeset requirement and may prevent the user-facing change from being released
under the correct package.
Agent Prompt
## Issue description
The changeset front-matter is missing an entry for the `pnpm` package.

## Issue Context
Per compliance requirements, changeset files must explicitly include `pnpm` with a valid bump type (`patch`/`minor`/`major`).

## Fix Focus Areas
- .changeset/modules-yaml-package-manager-pnpm.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.28     16.3±1.85ms    22.9 MB/sec    1.00     12.7±0.30ms    29.4 MB/sec
packument/parse                1.05     44.2±0.57µs  1499.2 MB/sec    1.00     42.1±0.35µs  1575.4 MB/sec
tarball/download_dependency    1.08      2.9±0.20ms  1502.7 KB/sec    1.00      2.7±0.14ms  1622.9 KB/sec

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.62%. Comparing base (1f5a097) to head (05435e8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13087   +/-   ##
=======================================
  Coverage   85.62%   85.62%           
=======================================
  Files         500      500           
  Lines       80147    80138    -9     
=======================================
- Hits        68628    68622    -6     
+ Misses      11519    11516    -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zkochan
zkochan merged commit 3f26498 into main Jul 16, 2026
35 checks passed
@zkochan
zkochan deleted the fix-modules-yaml-package-manager branch July 16, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants