Skip to content

fix(pacquet): restore Bit workspace/capsule install parity with the v11 engine - #12899

Merged
zkochan merged 10 commits into
mainfrom
fix/bit-e2e-engine-parity
Jul 10, 2026
Merged

zkochan merged 10 commits into
mainfrom
fix/bit-e2e-engine-parity

Conversation

@zkochan

@zkochan zkochan commented Jul 10, 2026 •

Copy link
Copy Markdown
Member

Fixes six pacquet regressions against the pnpm v11 engine, all surfaced by Bit's e2e suite after bit's pnpm11 branch moved to @pnpm/napi (12.0.0-alpha.5). Together they accounted for ~160 of the 163 e2e failures on Bit's CI (teambit/bit#10293).

Hoisted linker (nodeLinker: hoisted)

  • Peered snapshots were silently dropped from the graph. The walker resolved each hoister reference's metadata via packages[<full key>], but packages: keys are peer-stripped while references carry the peer suffix — every peered package (and its whole subtree) vanished from the materialized tree (even a plain react-dom@x(react@x) at the workspace root). lookup_package_metadata now falls back to the peer-stripped key.
  • Non-root importers were dropped from the hoister tree when hoistWorkspacePackages was off. v11's hoist() attaches every importer unconditionally; the knob only controls root-level name links for the workspace packages themselves. Any dependency used only by a non-root importer wasn't installed at all. Importers are now attached unconditionally.

Install pipeline

  • Root-component member linking crashed on manifest-less members. The sibling-linking pass added in alpha.5 read each injected member's manifest from its virtual-store slot; a Bit workspace component has no package.json on disk (its manifest is in-memory, and Bit's read-package hooks strip sibling edges from it), so every bit install in a workspace with root components failed with root_component_manifest_read_failed. A member without a slot manifest now falls back to linking the root's full member clique (additive, name-unique per root); a malformed manifest still errors.
  • .modules.yaml's injectedDeps was never populated. It is now derived from the lockfile's file: snapshots — virtual-store slots under the isolated linker, the walker's hoistedLocations under the hoisted linker. Bit's build task reads it back to hard-link compiled artifacts into every materialized copy of a component.
  • Declared projects outside the lockfile dir were rejected. Bit's nested capsule installs pass a project at ..; the alpha.5 unsafe-importer-path guard refused it. Importer ids backed by the install's own declared projects now bypass the check, which stays in force for ids that exist only in parsed lockfile input.
  • link: deps excluded by excludeLinksFromLockfile were never materialized. v11's linkDirectDeps worked from the project manifests; pacquet's symlink pass works from the lockfile importers, so the excluded links were lost — including Bit's link:-provided @teambit runtime in capsules and nmSelfReferences (link:.) entries. A new post-install pass links them from the in-memory manifests; aliases the lockfile tracks are left to the lockfile passes so dedupeDirectDeps decisions are not undone.

napi binding

  • Empty bareSpecifier fell off the resolver chain. v11 resolved an empty pref like an absent one (latest matching version); the binding passed it through verbatim and resolveDependency failed with SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER. Bit's resolveRemoteVersion sends exactly this shape for a versionless spec.

Verification

  • New unit tests for each fix (link_root_component_members, collect_injected_deps, hoisted-graph peered lookup, hoister tree membership, link_manifest_link_deps); full cargo test --workspace for pacquet is green, clippy clean.
  • Bit e2e against a locally built binding: app root components 38/38 across isolated/hoisted/yarn linkers (previously failed at before all / wrong peer variants / missing build side-effects), custom-env 26/26 (previously ~7 before all install crashes), and bit new react --aspect teambit.react/react-env works end-to-end (previously Refusing to install importer with unsafe path key "..").

No TypeScript-side port is needed: every change restores behavior the v11 TS engine already has.

Bit needs these in a published @pnpm/napi (12.0.0-alpha.6) plus the already-landed Bit-side fix (zkochan/bit@ee19e3327) for teambit/bit#10293's CI to go green.


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

Summary by CodeRabbit

  • New Features
    • Installations now generate and preserve file: injected workspace dependency mappings and carry them through .modules.yaml.
    • Manifest link: dependencies are now materialized as symlinks in project modulesDir (supports absolute, relative, and link:., plus safe modulesDir validation).
    • Workspace components missing package.json now link to all other sibling root members.
  • Bug Fixes
    • Empty/whitespace “no range” specifiers no longer break dependency resolution.
    • Peer-suffixed metadata is now resolved via peer-stripped lookups when needed.
    • Hoisted workspace importers are retained even when workspace-hoisting is disabled.
    • Trusted importer IDs prevent incorrect unsafe-path rejection during isolated symlinking.

zkochan and others added 3 commits July 10, 2026 11:15
…om the hoisted graph

Two hoisted-linker (nodeLinker: hoisted) bugs that silently removed
packages from the materialized tree:

- The walker resolved each hoister reference's metadata via
  `packages[full key]`, but `packages:` keys are peer-stripped while
  references carry the peer suffix — every peered snapshot (and its
  whole subtree) was dropped from the graph and never materialized.
  `lookup_package_metadata` now falls back to the peer-stripped key.

- `hoist()` attached non-root importers to the hoister tree only when
  `hoist_workspace_packages` was on. pnpm v11 attaches every importer
  unconditionally; the knob only controls root-level name links for
  the workspace packages themselves. With the gate, any dependency
  used only by a non-root importer vanished from the install. The
  importers are now attached unconditionally.

Restores Bit's per-root-component dependency variants (a root pinned
to is-odd@1 resolved the workspace root's is-odd@2 before this).

Co-Authored-By: Claude Fable 5 <[email protected]>
…lows rely on

Four install-pipeline gaps against the pnpm v11 engine, all surfaced
by Bit's e2e suite:

- Root-component member linking read each member's manifest from its
  materialized virtual-store slot; a Bit workspace component has no
  package.json on disk (its manifest is in-memory and Bit's hooks
  strip sibling edges from it), so the install failed with
  root_component_manifest_read_failed. A member without a slot
  manifest now falls back to linking every member of its root —
  additive and name-unique per root. A malformed manifest still errors.

- .modules.yaml's injectedDeps was never populated. It is now derived
  from the lockfile's file: snapshots — virtual-store slots under the
  isolated linker, the walker's hoistedLocations under the hoisted
  linker. Bit's build task reads it back to hard-link compiled
  artifacts into every materialized copy of a component.

- Importer keys naming the install's own declared projects may live
  outside the lockfile dir (Bit's nested capsule installs pass a
  project at ".."); they now bypass the malformed-lockfile
  unsafe-path rejection, which stays in force for ids that exist only
  in parsed lockfile input.

- link: direct deps excluded from the lockfile by
  excludeLinksFromLockfile were never materialized (v11's
  linkDirectDeps worked from the project manifests). A new
  post-install pass links them from the in-memory manifests; aliases
  the lockfile tracks are left to the lockfile passes so
  dedupeDirectDeps decisions are not undone. Covers Bit's link:-
  provided `@teambit` runtime in capsules and nmSelfReferences
  (link:.) entries.

Co-Authored-By: Claude Fable 5 <[email protected]>
…eDependency

pnpm v11 resolved an empty pref like an absent one (latest matching
version); the binding passed it through verbatim and the whole chain
fell off with SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER. Bit's
resolveRemoteVersion sends exactly this shape for a versionless spec.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 09:40

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 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR updates dependency resolution and workspace hoisting, adds manifest-based link: dependency materialization, supports trusted importer paths, handles missing workspace manifests, and propagates injectedDeps through fresh and frozen installs into .modules.yaml.

Changes

Dependency resolution and workspace hoisting

Layer / File(s) Summary
Resolution and workspace hoisting
pacquet/crates/napi/src/resolve.rs, pacquet/crates/package-manager/hoisted_dep_graph*, pacquet/crates/real-hoist/*
Empty bare specifiers are treated as absent, peer-suffixed metadata uses peer-stripped keys when needed, and non-root workspace importers remain in hoister traversal.

Manifest and workspace linking

Layer / File(s) Summary
Manifest link dependency materialization
pacquet/crates/package-manager/src/link_manifest_link_deps*, pacquet/crates/package-manager/src/install.rs, pacquet/crates/package-manager/src/lib.rs
link: dependencies are materialized from project manifests, lockfile-tracked aliases are skipped, and failures use a top-level install error variant.
Root component sibling linking
pacquet/crates/package-manager/src/link_root_component_members*
Missing member manifests cause full root-sibling linking, while malformed manifests remain errors and valid manifests use declared sibling dependencies.

Install path and injected dependencies

Layer / File(s) Summary
Trusted importer symlink validation
pacquet/crates/package-manager/src/symlink_direct_dependencies*, pacquet/crates/package-manager/src/install_frozen_lockfile.rs, pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
Configured project importer IDs bypass importer-path validation during isolated and hoisted linking.
Injected dependency result propagation
pacquet/crates/package-manager/src/virtual_store_layout*, pacquet/crates/package-manager/src/install*.rs
file: snapshots are mapped to virtual-store targets and propagated through install results into .modules.yaml as injectedDeps.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Install
  participant LinkManifestLinkDeps
  participant VirtualStoreLayout
  participant ModulesManifest
  Install->>LinkManifestLinkDeps: Materialize manifest link dependencies
  Install->>VirtualStoreLayout: Collect file snapshot targets
  VirtualStoreLayout->>Install: Return injected dependency map
  Install->>ModulesManifest: Serialize injectedDeps
Loading

Possibly related PRs

Suggested labels: product: pacquet

Suggested reviewers: qodo-code-review

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bit-e2e-engine-parity

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 pacquet pnpm v11 parity for Bit workspace/capsule installs

🐞 Bug fix 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Restore hoisted-linker correctness for peer-suffixed snapshots and non-root importer subtrees.
• Re-align install pipeline with pnpm v11 (trusted importer ids, injectedDeps, link:
 materialization).
• Add targeted unit tests covering each regression and the new post-install passes.
Diagram

graph TD
  NAPI["NAPI resolver"] --> INST["Install pipeline"] --> SFD["Symlink direct deps"]
  INST --> POST["Post-install link fixes"] --> MOD[(".modules.yaml")]
  HOIST["Hoisted linker"] --> INJ["Collect injectedDeps"] --> MOD
  INST --> INJ
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Re-introduce excluded `link:` deps into lockfile importers
  • ➕ Avoids a separate manifest-driven linking pass post-install
  • ➕ Keeps all materialization driven from a single source (lockfile)
  • ➖ Conflicts with excludeLinksFromLockfile intent and existing pnpm semantics
  • ➖ Risk of undoing lockfile-driven dedupeDirectDeps decisions (aliases, hoisted layout)
2. Track injected project copies during resolution instead of scanning snapshots
  • ➕ More direct provenance (no need to infer via snapshot-key parsing)
  • ➕ Potentially cheaper than scanning the snapshots map
  • ➖ More invasive plumbing through resolver/graph build stages
  • ➖ Still must handle hoisted vs isolated layouts; current approach is localized and deterministic

Recommendation: Keep the PR’s approach: it restores pnpm v11 behaviors while respecting existing pacquet pipeline boundaries. The post-install manifest-driven link: pass is appropriately scoped (only for lockfile-excluded aliases) to avoid breaking lockfile dedupe decisions, and collect_injected_deps provides a deterministic .modules.yaml contract needed by Bit without overhauling the resolver.

Files changed (18) +785 / -76

Bug fix (11) +398 / -59
resolve.rsTreat empty bareSpecifier as absent to match v11 resolution +5/-1

Treat empty bareSpecifier as absent to match v11 resolution

• Filters whitespace/empty 'bareSpecifier' values before building 'WantedDependency'. This prevents 'SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER' for versionless specs and restores pnpm v11 semantics.

pacquet/crates/napi/src/resolve.rs

hoisted_dep_graph.rsFix peer-suffixed metadata lookup for hoisted walker +14/-1

Fix peer-suffixed metadata lookup for hoisted walker

• Updates 'lookup_package_metadata' to first try the full depPath key, then fall back to a peer-stripped key. Prevents peered snapshots (and their subtrees) from being silently dropped from the hoisted dependency graph.

pacquet/crates/package-manager/src/hoisted_dep_graph.rs

install.rsThread injectedDeps into .modules.yaml and link excluded link: deps +36/-3

Thread injectedDeps into .modules.yaml and link excluded link: deps

• Adds 'InstallError::LinkManifestLinkDeps' and invokes a new post-install pass to materialize 'link:' direct deps excluded from the lockfile. Threads an 'injected_deps' map from install paths into 'build_modules_manifest', and serializes it into '.modules.yaml' when non-empty.

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

install_frozen_lockfile.rsTrust declared importer ids outside lockfileDir; compute injectedDeps +43/-0

Trust declared importer ids outside lockfileDir; compute injectedDeps

• Derives a trusted importer id set from the install’s declared projects and passes it into 'SymlinkDirectDependencies' to bypass unsafe-path rejection for legitimate '..' projects. Computes 'injected_deps' via 'collect_injected_deps' (virtual store or hoisted locations) and returns it in the frozen install output.

pacquet/crates/package-manager/src/install_frozen_lockfile.rs

install_with_fresh_lockfile.rsCompute injectedDeps and trust declared importers on fresh installs +31/-0

Compute injectedDeps and trust declared importers on fresh installs

• Adds 'injected_deps' to the fresh install result (empty for lockfile-only). Passes trusted importer ids (from 'importer_manifests') into 'SymlinkDirectDependencies', and computes 'injected_deps' before finalizing the result so '.modules.yaml' can include it.

pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs

lib.rsWire in new link_manifest_link_deps module and exports +2/-0

Wire in new link_manifest_link_deps module and exports

• Adds the new 'link_manifest_link_deps' module and re-exports its public API. Makes the new post-install pass callable from install orchestration.

pacquet/crates/package-manager/src/lib.rs

link_manifest_link_deps.rsNew pass: link manifest-excluded 'link:' direct deps +100/-0

New pass: link manifest-excluded 'link:' direct deps

• Introduces 'link_manifest_link_deps' to symlink 'link:' dependencies from in-memory manifests when 'excludeLinksFromLockfile' removed them from lockfile importers. Skips aliases already tracked in the lockfile importer snapshot to avoid undoing dedupe decisions, and force-replaces stale symlinks to match pnpm relink semantics.

pacquet/crates/package-manager/src/link_manifest_link_deps.rs

link_root_component_members.rsHandle root members without slot manifests (Bit workspace shape) +42/-17

Handle root members without slot manifests (Bit workspace shape)

• Changes sibling linking to tolerate missing 'package.json' in a member slot: manifest-less members fall back to linking the full root-member clique additively. Still errors on malformed manifests to avoid hiding genuine corruption.

pacquet/crates/package-manager/src/link_root_component_members.rs

symlink_direct_dependencies.rsAllow trusted importer ids to bypass unsafe-path validation +19/-2

Allow trusted importer ids to bypass unsafe-path validation

• Adds an optional 'trusted_importer_ids' set; importer ids in the set skip 'validate_importer_id' so declared projects outside 'lockfileDir' (e.g., '..') can be installed. Maintains strict validation for importer ids that originate only from lockfile input.

pacquet/crates/package-manager/src/symlink_direct_dependencies.rs

virtual_store_layout.rsDerive '.modules.yaml' injectedDeps from file: snapshots +71/-0

Derive '.modules.yaml' injectedDeps from file: snapshots

• Adds 'collect_injected_deps' to map each injected 'file:' source project to the set of materialized target directories (virtual store slots or hoistedLocations). Skips skipped snapshots, normalizes './' prefixes, drops empty target lists, and sorts targets for deterministic output.

pacquet/crates/package-manager/src/virtual_store_layout.rs

lib.rsAlways attach non-root importers to hoister tree (v11 parity) +35/-35

Always attach non-root importers to hoister tree (v11 parity)

• Removes gating of non-root importer tree membership on 'hoist_workspace_packages'. This ensures importer-only dependencies aren’t silently excluded from hoisted installs, aligning with pnpm v11 where the knob only affects root-level workspace-package name links.

pacquet/crates/real-hoist/src/lib.rs

Tests (7) +387 / -17
tests.rsAdd/adjust tests for hoisted importer membership and peered lookups +60/-12

Add/adjust tests for hoisted importer membership and peered lookups

• Renames and rewrites the hoistWorkspacePackages=false test to assert non-root importer deps remain in the walk. Adds a new regression test ensuring peer-suffixed snapshot references resolve metadata via peerless 'packages:' keys.

pacquet/crates/package-manager/src/hoisted_dep_graph/tests.rs

tests.rsUpdate modules manifest unit tests for new injected_deps param +2/-0

Update modules manifest unit tests for new injected_deps param

• Extends 'build_modules_manifest' call sites in tests to pass the new 'injected_deps' argument. Keeps existing assertions intact while aligning with the updated signature.

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

tests.rsUnit tests for manifest-driven link: materialization +143/-0

Unit tests for manifest-driven link: materialization

• Covers absolute, relative, and 'link:.' self-reference behaviors; verifies relink replaces stale symlinks; asserts lockfile-tracked aliases are skipped so lockfile passes retain ownership.

pacquet/crates/package-manager/src/link_manifest_link_deps/tests.rs

tests.rsRegression tests for manifest-less root members and malformed manifests +105/-0

Regression tests for manifest-less root members and malformed manifests

• Adds a test ensuring a member without a slot manifest links all root siblings, while members with manifests keep declared-only behavior. Adds a test confirming malformed manifests still surface as errors.

pacquet/crates/package-manager/src/link_root_component_members/tests.rs

tests.rsUpdate symlink direct deps tests for new trusted_importer_ids field +8/-0

Update symlink direct deps tests for new trusted_importer_ids field

• Updates all struct initializations in tests to include 'trusted_importer_ids: None'. Preserves existing behavior/coverage while matching the expanded API surface.

pacquet/crates/package-manager/src/symlink_direct_dependencies/tests.rs

tests.rsUnit tests for collect_injected_deps behavior in isolated and hoisted modes +57/-0

Unit tests for collect_injected_deps behavior in isolated and hoisted modes

• Verifies mapping of file-snapshot keys to lockfile-relative slot package dirs, aggregation across peer variants, and exclusion of registry/skipped snapshots. Also verifies hoisted-mode behavior uses hoistedLocations and drops unplaced sources.

pacquet/crates/package-manager/src/virtual_store_layout/tests.rs

tests.rsUpdate hoistWorkspacePackages=false test to assert importer tree membership +12/-5

Update hoistWorkspacePackages=false test to assert importer tree membership

• Renames and rewrites the test to assert the non-root importer remains a child in the hoister tree even when 'hoist_workspace_packages' is false. Ensures deterministic ordering via sorted expectations.

pacquet/crates/real-hoist/src/tests.rs

@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.06      7.4±0.54ms   584.2 KB/sec    1.00      7.0±0.71ms   620.2 KB/sec

@qodo-code-review

qodo-code-review Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (2) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 51 rules

Grey Divider


Action required

1. modulesDir dotdot escape ✓ Resolved 🐞 Bug ⛨ Security
Description
install.rs passes config.modules_dir.file_name() into link_manifest_link_deps(), and the
helper then does project_dir.join(modules_dir_name); if a workspace sets modulesDir to . or
.., this pass will create/replace symlinks in the project directory or its parent instead of under
node_modules. Because symlink_package() overwrites by renaming squatting files/dirs, a malicious
repo config can cause destructive filesystem changes outside the intended install tree during
install.
Code

pacquet/crates/package-manager/src/install.rs[R1490-1492]

+            // Honor a `modulesDir` override the same way the
+            // lockfile-driven symlink pass does.
+            config.modules_dir.file_name().unwrap_or_else(|| std::ffi::OsStr::new("node_modules")),
Evidence
The call site derives modules_dir_name from config.modules_dir.file_name() and passes it into
link_manifest_link_deps(), which then directly joins it onto project_dir. Config parsing
resolves modulesDir from pnpm-workspace.yaml using base.join(value) for relative values, so
modulesDir: .. is accepted. Finally, the symlink helper explicitly overwrites by renaming
squatting files/dirs, amplifying impact if the destination is redirected outside node_modules.

pacquet/crates/package-manager/src/install.rs[1484-1493]
pacquet/crates/package-manager/src/link_manifest_link_deps.rs[40-56]
pacquet/crates/config/src/workspace_yaml.rs[758-760]
pacquet/crates/config/src/workspace_yaml.rs[934-936]
pacquet/crates/package-manager/src/symlink_package.rs[36-48]

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

### Issue description
`link_manifest_link_deps()` is now parameterized by a `modules_dir_name` derived from `config.modules_dir.file_name()`. If the configured `modulesDir` resolves to `.` or `..`, then `project_dir.join(modules_dir_name)` points at the project dir or its parent, so this pass can create/replace symlinks outside `node_modules`. Because `symlink_package()` overwrites by renaming squatting entries, this becomes a destructive write primitive.

### Issue Context
- `modulesDir` is repo-controlled via `pnpm-workspace.yaml` and is resolved with a plain `base.join(value)` for relative values (so `..` is accepted).
- The new manifest-link pass joins `project_dir` with the basename without rejecting special directory components.

### Fix Focus Areas
- pacquet/crates/package-manager/src/install.rs[1489-1493]
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[40-56]

### Suggested fix
- Reject `modules_dir_name` values of `"."` and `".."` (and ideally any non-"normal" single-component directory name) before doing any filesystem writes.
 - Either:
   - Add validation in `install.rs` before calling `link_manifest_link_deps`, or
   - Add validation inside `link_manifest_link_deps` (preferred, since it centralizes the safety contract for this helper).
- Add a unit test that sets `modules_dir_name` to `OsStr::new("..")` (and `"."`) and asserts the pass errors before any filesystem writes.

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


2. modulesDir override ignored ✓ Resolved 🐞 Bug ≡ Correctness
Description
link_manifest_link_deps() always links into <project>/node_modules, ignoring
Config.modules_dir overrides; installs that use a custom modules directory will materialize these
link: deps into the wrong place and may create an unexpected node_modules/ alongside the
intended modules directory.
Code

pacquet/crates/package-manager/src/link_manifest_link_deps.rs[50]

+        let modules_dir = project_dir.join("node_modules");
Evidence
The new pass hardcodes the destination directory as project_dir/node_modules, but the existing
direct-dependency symlink logic intentionally supports custom modulesDir by joining project_dir
with the configured directory name (and tests assert node_modules/ must not be created under that
configuration). Because install.rs invokes link_manifest_link_deps() after the install paths,
this hardcoded join will still run and can create links in the wrong directory.

pacquet/crates/package-manager/src/link_manifest_link_deps.rs[45-52]
pacquet/crates/package-manager/src/link_manifest_link_deps.rs[50-70]
pacquet/crates/package-manager/src/install.rs[1476-1491]
pacquet/crates/package-manager/src/symlink_direct_dependencies.rs[181-238]
pacquet/crates/package-manager/src/symlink_direct_dependencies/tests.rs[684-692]

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

### Issue description
`link_manifest_link_deps()` hardcodes `project_dir/node_modules` as the destination for symlinks created from manifest `link:` deps. However, the main direct-deps linker (`SymlinkDirectDependencies`) supports `modulesDir` overrides by deriving the per-project modules directory from `config.modules_dir.file_name()`.

This mismatch means that when `modulesDir` is configured to something else (e.g. `custom_modules`), the new manifest-driven pass will write to the wrong directory and can create an unintended `node_modules/` tree.

### Issue Context
The new pass is invoked from `install.rs` after the frozen/fresh install paths complete, so it runs in normal installs and can affect real workspaces.

### Fix Focus Areas
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[45-52]
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[50-70]
- pacquet/crates/package-manager/src/install.rs[1476-1491]

### Suggested fix
1. Thread the configured modules directory *suffix* into `link_manifest_link_deps()` (e.g., `modules_dir_name: &OsStr`), computed the same way as in `SymlinkDirectDependencies` (`config.modules_dir.file_name().unwrap_or("node_modules")`).
2. Replace `project_dir.join("node_modules")` with `project_dir.join(modules_dir_name)`.
3. Add/extend a unit test for `link_manifest_link_deps` to cover a non-default modules dir and assert it does **not** create `project_dir/node_modules` when the suffix is different.

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


3. Manifest alias path escape ✓ Resolved 🐞 Bug ⛨ Security
Description
link_manifest_link_deps() joins the raw package.json dependency key into
project_dir/node_modules/<alias> without validating it as a safe npm package name, so a crafted
alias (e.g. ../.git) can escape node_modules and target arbitrary paths. Because the symlink
helper force-replaces existing entries by renaming squatting files/dirs, this can become a
destructive arbitrary rename/overwrite primitive within (and potentially above) the project
directory.
Code

pacquet/crates/package-manager/src/link_manifest_link_deps.rs[R45-60]

+        for (alias, spec) in manifest.dependencies([
+            DependencyGroup::Prod,
+            DependencyGroup::Dev,
+            DependencyGroup::Optional,
+        ]) {
+            let Some(target) = spec.strip_prefix("link:") else {
+                continue;
+            };
+            if importer_snapshot.is_some_and(|snapshot| snapshot_has_alias(snapshot, alias)) {
+                continue;
+            }
+            let target_path = resolve_link_target(project_dir, target);
+            let symlink_path = project_dir.join("node_modules").join(alias);
+            symlink_package(&target_path, &symlink_path).map_err(|source| {
+                LinkManifestLinkDepsError::Symlink { alias: alias.to_string(), source }
+            })?;
Evidence
The new pass constructs a symlink destination path directly from unvalidated manifest dependency
keys, and the symlink helper explicitly force-replaces existing entries by renaming squatting
files/dirs — making path traversal potentially destructive.

pacquet/crates/package-manager/src/link_manifest_link_deps.rs[40-60]
pacquet/crates/package-manifest/src/lib.rs[216-228]
pacquet/crates/package-manager/src/symlink_package.rs[36-49]
pacquet/crates/package-manager/src/safe_join_modules_dir.rs[26-40]

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

### Issue description
`link_manifest_link_deps()` uses the dependency key (`alias`) from `PackageManifest::dependencies()` directly in `project_dir.join("node_modules").join(alias)`. `PackageManifest::dependencies()` yields raw JSON object keys (unvalidated), so an attacker-controlled manifest can supply path traversal segments (e.g. `../.git`) and cause filesystem writes/renames outside `node_modules/`.

### Issue Context
This new pass runs post-install to materialize `link:` deps excluded from lockfile importers. Unlike lockfile-driven linking (which uses validated package-name types), this code path currently trusts raw strings.

### Fix Focus Areas
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[40-61]

### Recommended fix
1. Compute `let modules_dir = project_dir.join("node_modules");`.
2. Replace `project_dir.join("node_modules").join(alias)` with a validated join:
  - Use `crate::safe_join_modules_dir::safe_join_modules_dir(&modules_dir, alias)` and return a typed error on invalid alias, **or**
  - Validate via `pacquet_resolving_deps_resolver::is_valid_dependency_alias(alias)` and error if invalid.
3. Extend `LinkManifestLinkDepsError` with an `InvalidAlias(InvalidDependencyAliasError)` (or equivalent) so invalid aliases fail fast with a clear diagnostic.
4. Add a unit test that a dependency key containing `..` / absolute / backslash is rejected (no filesystem writes performed).

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



Remediation recommended

4. Peer-issues query logs noise 🐞 Bug ◔ Observability ⭐ New
Description
run_peer_issues_blocking() documents getPeerDependencyIssues as a silent query (no log sink),
but the fresh-resolve path still unconditionally emits tracing::warn! peer-issue logs per
importer. This can spam logs/interleave output for programmatic callers even though the API is meant
to be non-chatty.
Code

pacquet/crates/napi/src/install.rs[R726-728]

+    // No log sink for this query — engine events would interleave with
+    // the caller's own reporting for what is a silent resolution.
+    let _sink_guard = EngineCallGuard::new(None);
Evidence
The napi peer-issues entrypoint explicitly claims it is a silent resolution by not installing a log
sink, but the install pipeline still emits peer-issue warnings unconditionally during fresh
resolution, including when a peer_issues_sink is present for the programmatic query.

pacquet/crates/napi/src/install.rs[720-728]
pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs[1207-1221]

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 napi `getPeerDependencyIssues` path is intended to be a silent, programmatic query (it installs `EngineCallGuard::new(None)`), but the fresh resolve code path still emits `tracing::warn!` lines for peer issues. This causes unexpected log pollution/interleaving for callers using the API as a query.

### Issue Context
- `run_peer_issues_blocking()` explicitly avoids a log sink to keep the query silent.
- `InstallWithFreshLockfile::run()` always logs peer issues via `tracing::warn!` even when `peer_issues_sink` is present (the peer-issues query case).

### Fix Focus Areas
- pacquet/crates/napi/src/install.rs[725-728]
- pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs[1207-1221]

### Suggested fix
In `InstallWithFreshLockfile::run()`, gate the `tracing::warn!` loop so it only runs for CLI installs (e.g., when `peer_issues_sink.is_none()`), or introduce an explicit “silent” flag for the peer-issues query and suppress these warnings when set.

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


5. Before phrasing in comment 📘 Rule violation ⚙ Maintainability
Description
A newly added doc comment describes behavior using historical phrasing (Before the fallback...)
instead of stating the current contract. This can quickly become stale and violates the guideline to
keep comments about present behavior.
Code

pacquet/crates/package-manager/src/hoisted_dep_graph/tests.rs[R1055-1060]

+/// A peer-suffixed reference (`[email protected]([email protected])`) must resolve its
+/// metadata through the peer-stripped `packages:` key (`[email protected]`) —
+/// lockfile `packages:` keys never carry peer suffixes. Before the
+/// fallback in `lookup_package_metadata`, the walker silently dropped
+/// every peered node and its whole subtree from the graph, so the
+/// hoisted linker never materialized them.
Evidence
The comment explicitly uses historical phrasing (Before the fallback...), which the checklist
forbids in source comments.

Rule 772199: Comments must describe current behavior, not historical implementations
pacquet/crates/package-manager/src/hoisted_dep_graph/tests.rs[1055-1060]

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

## Issue description
A new doc comment uses historical phrasing (e.g., `Before ...`) instead of describing the current behavior/contract.

## Issue Context
Per compliance, comments should describe what the code does now, not what it did previously.

## Fix Focus Areas
- pacquet/crates/package-manager/src/hoisted_dep_graph/tests.rs[1055-1060]

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


6. Redundant link_manifest_link_deps comment 📘 Rule violation ⚙ Maintainability
Description
The newly added call-site comment above crate::link_manifest_link_deps(...) substantially repeats
the function’s own doc comment. This increases maintenance burden because the explanation must be
kept in sync in two places.
Code

pacquet/crates/package-manager/src/install.rs[R1476-1484]

+        // Materialize `link:` direct deps straight from the in-memory
+        // project manifests. `excludeLinksFromLockfile` keeps them out
+        // of the lockfile importers, so the lockfile-driven symlink
+        // passes inside the frozen/fresh paths never see them; pnpm
+        // v11's `linkDirectDeps` linked them from the projects
+        // regardless. Aliases the wanted lockfile *does* track are
+        // skipped — those belong to the lockfile passes (and their
+        // dedupe decisions). See [`crate::link_manifest_link_deps`].
+        crate::link_manifest_link_deps(
Evidence
The comment added at the call site repeats the same purpose/behavior already documented on
link_manifest_link_deps, violating the rule against redundant call-site comments.

Rule 713451: Avoid redundant call-site comments that duplicate callee documentation
pacquet/crates/package-manager/src/install.rs[1476-1484]
pacquet/crates/package-manager/src/link_manifest_link_deps.rs[11-35]

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

## Issue description
A new call-site comment duplicates the callee’s documentation for `link_manifest_link_deps`, making docs harder to maintain.

## Issue Context
The function `link_manifest_link_deps` already has a detailed doc comment describing the same behavior; the call site should either omit the comment or keep only call-specific rationale that is not already covered.

## Fix Focus Areas
- pacquet/crates/package-manager/src/install.rs[1476-1484]
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[11-35]

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



Informational

7. Unneeded replace allocation 🐞 Bug ➹ Performance
Description
collect_injected_deps() always allocates a new String via .replace('\\', "/") for every
injected snapshot entry, even on non-Windows where paths already use / and even when no
backslashes are present. This adds avoidable per-snapshot allocations on the install path where
collect_injected_deps() is called during installs.
Code

pacquet/crates/package-manager/src/virtual_store_layout.rs[R335-338]

+            // POSIX separators on every platform, matching the
+            // `hoistedLocations` entries the hoisted branch reuses
+            // (see `path_relative_to_lockfile_dir`).
+            targets.push(target.to_string_lossy().replace('\\', "/"));
Evidence
The new code performs .replace('\\', "/") inside the per-snapshot loop, which necessarily
allocates a new String each time. collect_injected_deps() is called during install execution, so
this allocation occurs on the install path.

pacquet/crates/package-manager/src/virtual_store_layout.rs[315-339]
pacquet/crates/package-manager/src/install_frozen_lockfile.rs[1348-1360]

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

### Issue description
`collect_injected_deps()` unconditionally calls `target.to_string_lossy().replace('\\', "/")`, which always allocates a new `String`. On non-Windows this normalization is unnecessary most of the time, and even on Windows it can be avoided when the rendered path contains no backslashes.

### Issue Context
This code runs inside a loop over snapshot keys and is invoked during install output assembly.

### Fix Focus Areas
- pacquet/crates/package-manager/src/virtual_store_layout.rs[335-338]

### Suggested change
- Render once to `Cow<str>` via `to_string_lossy()`.
- Only normalize separators on Windows (e.g. `if cfg!(windows) { ... } else { ... }`).
- Additionally, only call `.replace()` when the string actually contains `'\\'` to avoid allocating in the common case.

Example sketch:
```rust
let rendered = target.to_string_lossy();
let rendered = if cfg!(windows) {
   if rendered.contains('\\') { rendered.replace('\\', "/") } else { rendered.into_owned() }
} else {
   rendered.into_owned()
};
targets.push(rendered);
```

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


Grey Divider

Previous review results

Review updated until commit df90dd0

Results up to commit b6af99a


🐞 Bugs (0) 📘 Rule violations (2) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Manifest alias path escape ✓ Resolved 🐞 Bug ⛨ Security
Description
link_manifest_link_deps() joins the raw package.json dependency key into
project_dir/node_modules/<alias> without validating it as a safe npm package name, so a crafted
alias (e.g. ../.git) can escape node_modules and target arbitrary paths. Because the symlink
helper force-replaces existing entries by renaming squatting files/dirs, this can become a
destructive arbitrary rename/overwrite primitive within (and potentially above) the project
directory.
Code

pacquet/crates/package-manager/src/link_manifest_link_deps.rs[R45-60]

+        for (alias, spec) in manifest.dependencies([
+            DependencyGroup::Prod,
+            DependencyGroup::Dev,
+            DependencyGroup::Optional,
+        ]) {
+            let Some(target) = spec.strip_prefix("link:") else {
+                continue;
+            };
+            if importer_snapshot.is_some_and(|snapshot| snapshot_has_alias(snapshot, alias)) {
+                continue;
+            }
+            let target_path = resolve_link_target(project_dir, target);
+            let symlink_path = project_dir.join("node_modules").join(alias);
+            symlink_package(&target_path, &symlink_path).map_err(|source| {
+                LinkManifestLinkDepsError::Symlink { alias: alias.to_string(), source }
+            })?;
Evidence
The new pass constructs a symlink destination path directly from unvalidated manifest dependency
keys, and the symlink helper explicitly force-replaces existing entries by renaming squatting
files/dirs — making path traversal potentially destructive.

pacquet/crates/package-manager/src/link_manifest_link_deps.rs[40-60]
pacquet/crates/package-manifest/src/lib.rs[216-228]
pacquet/crates/package-manager/src/symlink_package.rs[36-49]
pacquet/crates/package-manager/src/safe_join_modules_dir.rs[26-40]

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

### Issue description
`link_manifest_link_deps()` uses the dependency key (`alias`) from `PackageManifest::dependencies()` directly in `project_dir.join("node_modules").join(alias)`. `PackageManifest::dependencies()` yields raw JSON object keys (unvalidated), so an attacker-controlled manifest can supply path traversal segments (e.g. `../.git`) and cause filesystem writes/renames outside `node_modules/`.

### Issue Context
This new pass runs post-install to materialize `link:` deps excluded from lockfile importers. Unlike lockfile-driven linking (which uses validated package-name types), this code path currently trusts raw strings.

### Fix Focus Areas
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[40-61]

### Recommended fix
1. Compute `let modules_dir = project_dir.join("node_modules");`.
2. Replace `project_dir.join("node_modules").join(alias)` with a validated join:
  - Use `crate::safe_join_modules_dir::safe_join_modules_dir(&modules_dir, alias)` and return a typed error on invalid alias, **or**
  - Validate via `pacquet_resolving_deps_resolver::is_valid_dependency_alias(alias)` and error if invalid.
3. Extend `LinkManifestLinkDepsError` with an `InvalidAlias(InvalidDependencyAliasError)` (or equivalent) so invalid aliases fail fast with a clear diagnostic.
4. Add a unit test that a dependency key containing `..` / absolute / backslash is rejected (no filesystem writes performed).

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



Remediation recommended
2. Before phrasing in comment 📘 Rule violation ⚙ Maintainability
Description
A newly added doc comment describes behavior using historical phrasing (Before the fallback...)
instead of stating the current contract. This can quickly become stale and violates the guideline to
keep comments about present behavior.
Code

pacquet/crates/package-manager/src/hoisted_dep_graph/tests.rs[R1055-1060]

+/// A peer-suffixed reference (`[email protected]([email protected])`) must resolve its
+/// metadata through the peer-stripped `packages:` key (`[email protected]`) —
+/// lockfile `packages:` keys never carry peer suffixes. Before the
+/// fallback in `lookup_package_metadata`, the walker silently dropped
+/// every peered node and its whole subtree from the graph, so the
+/// hoisted linker never materialized them.
Evidence
The comment explicitly uses historical phrasing (Before the fallback...), which the checklist
forbids in source comments.

Rule 772199: Comments must describe current behavior, not historical implementations
pacquet/crates/package-manager/src/hoisted_dep_graph/tests.rs[1055-1060]

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

## Issue description
A new doc comment uses historical phrasing (e.g., `Before ...`) instead of describing the current behavior/contract.

## Issue Context
Per compliance, comments should describe what the code does now, not what it did previously.

## Fix Focus Areas
- pacquet/crates/package-manager/src/hoisted_dep_graph/tests.rs[1055-1060]

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


3. Redundant link_manifest_link_deps comment 📘 Rule violation ⚙ Maintainability
Description
The newly added call-site comment above crate::link_manifest_link_deps(...) substantially repeats
the function’s own doc comment. This increases maintenance burden because the explanation must be
kept in sync in two places.
Code

pacquet/crates/package-manager/src/install.rs[R1476-1484]

+        // Materialize `link:` direct deps straight from the in-memory
+        // project manifests. `excludeLinksFromLockfile` keeps them out
+        // of the lockfile importers, so the lockfile-driven symlink
+        // passes inside the frozen/fresh paths never see them; pnpm
+        // v11's `linkDirectDeps` linked them from the projects
+        // regardless. Aliases the wanted lockfile *does* track are
+        // skipped — those belong to the lockfile passes (and their
+        // dedupe decisions). See [`crate::link_manifest_link_deps`].
+        crate::link_manifest_link_deps(
Evidence
The comment added at the call site repeats the same purpose/behavior already documented on
link_manifest_link_deps, violating the rule against redundant call-site comments.

Rule 713451: Avoid redundant call-site comments that duplicate callee documentation
pacquet/crates/package-manager/src/install.rs[1476-1484]
pacquet/crates/package-manager/src/link_manifest_link_deps.rs[11-35]

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

## Issue description
A new call-site comment duplicates the callee’s documentation for `link_manifest_link_deps`, making docs harder to maintain.

## Issue Context
The function `link_manifest_link_deps` already has a detailed doc comment describing the same behavior; the call site should either omit the comment or keep only call-specific rationale that is not already covered.

## Fix Focus Areas
- pacquet/crates/package-manager/src/install.rs[1476-1484]
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[11-35]

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


Results up to commit 8b28973


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. modulesDir override ignored ✓ Resolved 🐞 Bug ≡ Correctness
Description
link_manifest_link_deps() always links into <project>/node_modules, ignoring
Config.modules_dir overrides; installs that use a custom modules directory will materialize these
link: deps into the wrong place and may create an unexpected node_modules/ alongside the
intended modules directory.
Code

pacquet/crates/package-manager/src/link_manifest_link_deps.rs[50]

+        let modules_dir = project_dir.join("node_modules");
Evidence
The new pass hardcodes the destination directory as project_dir/node_modules, but the existing
direct-dependency symlink logic intentionally supports custom modulesDir by joining project_dir
with the configured directory name (and tests assert node_modules/ must not be created under that
configuration). Because install.rs invokes link_manifest_link_deps() after the install paths,
this hardcoded join will still run and can create links in the wrong directory.

pacquet/crates/package-manager/src/link_manifest_link_deps.rs[45-52]
pacquet/crates/package-manager/src/link_manifest_link_deps.rs[50-70]
pacquet/crates/package-manager/src/install.rs[1476-1491]
pacquet/crates/package-manager/src/symlink_direct_dependencies.rs[181-238]
pacquet/crates/package-manager/src/symlink_direct_dependencies/tests.rs[684-692]

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

### Issue description
`link_manifest_link_deps()` hardcodes `project_dir/node_modules` as the destination for symlinks created from manifest `link:` deps. However, the main direct-deps linker (`SymlinkDirectDependencies`) supports `modulesDir` overrides by deriving the per-project modules directory from `config.modules_dir.file_name()`.

This mismatch means that when `modulesDir` is configured to something else (e.g. `custom_modules`), the new manifest-driven pass will write to the wrong directory and can create an unintended `node_modules/` tree.

### Issue Context
The new pass is invoked from `install.rs` after the frozen/fresh install paths complete, so it runs in normal installs and can affect real workspaces.

### Fix Focus Areas
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[45-52]
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[50-70]
- pacquet/crates/package-manager/src/install.rs[1476-1491]

### Suggested fix
1. Thread the configured modules directory *suffix* into `link_manifest_link_deps()` (e.g., `modules_dir_name: &OsStr`), computed the same way as in `SymlinkDirectDependencies` (`config.modules_dir.file_name().unwrap_or("node_modules")`).
2. Replace `project_dir.join("node_modules")` with `project_dir.join(modules_dir_name)`.
3. Add/extend a unit test for `link_manifest_link_deps` to cover a non-default modules dir and assert it does **not** create `project_dir/node_modules` when the suffix is different.

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


Results up to commit 966a6d9


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. modulesDir dotdot escape ✓ Resolved 🐞 Bug ⛨ Security
Description
install.rs passes config.modules_dir.file_name() into link_manifest_link_deps(), and the
helper then does project_dir.join(modules_dir_name); if a workspace sets modulesDir to . or
.., this pass will create/replace symlinks in the project directory or its parent instead of under
node_modules. Because symlink_package() overwrites by renaming squatting files/dirs, a malicious
repo config can cause destructive filesystem changes outside the intended install tree during
install.
Code

pacquet/crates/package-manager/src/install.rs[R1490-1492]

+            // Honor a `modulesDir` override the same way the
+            // lockfile-driven symlink pass does.
+            config.modules_dir.file_name().unwrap_or_else(|| std::ffi::OsStr::new("node_modules")),
Evidence
The call site derives modules_dir_name from config.modules_dir.file_name() and passes it into
link_manifest_link_deps(), which then directly joins it onto project_dir. Config parsing
resolves modulesDir from pnpm-workspace.yaml using base.join(value) for relative values, so
modulesDir: .. is accepted. Finally, the symlink helper explicitly overwrites by renaming
squatting files/dirs, amplifying impact if the destination is redirected outside node_modules.

pacquet/crates/package-manager/src/install.rs[1484-1493]
pacquet/crates/package-manager/src/link_manifest_link_deps.rs[40-56]
pacquet/crates/config/src/workspace_yaml.rs[758-760]
pacquet/crates/config/src/workspace_yaml.rs[934-936]
pacquet/crates/package-manager/src/symlink_package.rs[36-48]

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

### Issue description
`link_manifest_link_deps()` is now parameterized by a `modules_dir_name` derived from `config.modules_dir.file_name()`. If the configured `modulesDir` resolves to `.` or `..`, then `project_dir.join(modules_dir_name)` points at the project dir or its parent, so this pass can create/replace symlinks outside `node_modules`. Because `symlink_package()` overwrites by renaming squatting entries, this becomes a destructive write primitive.

### Issue Context
- `modulesDir` is repo-controlled via `pnpm-workspace.yaml` and is resolved with a plain `base.join(value)` for relative values (so `..` is accepted).
- The new manifest-link pass joins `project_dir` with the basename without rejecting special directory components.

### Fix Focus Areas
- pacquet/crates/package-manager/src/install.rs[1489-1493]
- pacquet/crates/package-manager/src/link_manifest_link_deps.rs[40-56]

### Suggested fix
- Reject `modules_dir_name` values of `"."` and `".."` (and ideally any non-"normal" single-component directory name) before doing any filesystem writes.
 - Either:
   - Add validation in `install.rs` before calling `link_manifest_link_deps`, or
   - Add validation inside `link_manifest_link_deps` (preferred, since it centralizes the safety contract for this helper).
- Add a unit test that sets `modules_dir_name` to `OsStr::new("..")` (and `"."`) and asserts the pass errors before any filesystem writes.

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


Results up to commit 30c9bdf


🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Informational
1. Unneeded replace allocation 🐞 Bug ➹ Performance
Description
collect_injected_deps() always allocates a new String via .replace('\\', "/") for every
injected snapshot entry, even on non-Windows where paths already use / and even when no
backslashes are present. This adds avoidable per-snapshot allocations on the install path where
collect_injected_deps() is called during installs.
Code

pacquet/crates/package-manager/src/virtual_store_layout.rs[R335-338]

+            // POSIX separators on every platform, matching the
+            // `hoistedLocations` entries the hoisted branch reuses
+            // (see `path_relative_to_lockfile_dir`).
+            targets.push(target.to_string_lossy().replace('\\', "/"));
Evidence
The new code performs .replace('\\', "/") inside the per-snapshot loop, which necessarily
allocates a new String each time. collect_injected_deps() is called during install execution, so
this allocation occurs on the install path.

pacquet/crates/package-manager/src/virtual_store_layout.rs[315-339]
pacquet/crates/package-manager/src/install_frozen_lockfile.rs[1348-1360]

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

### Issue description
`collect_injected_deps()` unconditionally calls `target.to_string_lossy().replace('\\', "/")`, which always allocates a new `String`. On non-Windows this normalization is unnecessary most of the time, and even on Windows it can be avoided when the rendered path contains no backslashes.

### Issue Context
This code runs inside a loop over snapshot keys and is invoked during install output assembly.

### Fix Focus Areas
- pacquet/crates/package-manager/src/virtual_store_layout.rs[335-338]

### Suggested change
- Render once to `Cow<str>` via `to_string_lossy()`.
- Only normalize separators on Windows (e.g. `if cfg!(windows) { ... } else { ... }`).
- Additionally, only call `.replace()` when the string actually contains `'\\'` to avoid allocating in the common case.

Example sketch:
```rust
let rendered = target.to_string_lossy();
let rendered = if cfg!(windows) {
   if rendered.contains('\\') { rendered.replace('\\', "/") } else { rendered.into_owned() }
} else {
   rendered.into_owned()
};
targets.push(rendered);
```

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


Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to df90dd0

Warning

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

CategorySuggestion                                                                                                                                    Impact
General
Validate project option entries

Validate each entry in the projects array and return an error for malformed
objects rather than silently skipping them.

pacquet/crates/napi/src/install.rs [745-763]

 let projects: Vec<NodeApiProject> = obj
     .get("projects")
     .and_then(serde_json::Value::as_array)
     .map(|entries| {
         entries
             .iter()
-            .filter_map(|entry| {
-                let entry = entry.as_object()?;
-                Some(NodeApiProject {
-                    root_dir: entry.get("rootDir")?.as_str()?.to_string(),
+            .enumerate()
+            .map(|(index, entry)| {
+                let entry = entry.as_object().ok_or_else(|| {
+                    napi::Error::from_reason(format!(
+                        "getPeerDependencyIssues: `projects[{index}]` must be an object"
+                    ))
+                })?;
+                let root_dir = entry
+                    .get("rootDir")
+                    .and_then(serde_json::Value::as_str)
+                    .ok_or_else(|| {
+                        napi::Error::from_reason(format!(
+                            "getPeerDependencyIssues: `projects[{index}].rootDir` is required"
+                        ))
+                    })?
+                    .to_string();
+                Ok(NodeApiProject {
+                    root_dir,
                     manifest: entry
                         .get("manifest")
                         .cloned()
                         .unwrap_or_else(|| serde_json::json!({})),
                 })
             })
-            .collect()
+            .collect::<napi::Result<Vec<_>>>()
     })
+    .transpose()?
     .unwrap_or_default();
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: Silently dropping invalid projects makes debugging difficult for users; returning a clear N-API error improves robustness and developer experience.

Medium
Reject overflowing numeric options

Replace unchecked as u32 conversions with u32::try_from to detect potential
overflow and surface a validation error.

pacquet/crates/napi/src/install.rs [781-788]

 peers_suffix_max_length: obj
     .get("peersSuffixMaxLength")
     .and_then(serde_json::Value::as_u64)
-    .map(|value| value as u32),
+    .map(u32::try_from)
+    .transpose()
+    .map_err(|_| {
+        napi::Error::from_reason(
+            "getPeerDependencyIssues: `peersSuffixMaxLength` exceeds u32::MAX"
+        )
+    })?,
 virtual_store_dir_max_length: obj
     .get("virtualStoreDirMaxLength")
     .and_then(serde_json::Value::as_u64)
-    .map(|value| value as u32),
+    .map(u32::try_from)
+    .transpose()
+    .map_err(|_| {
+        napi::Error::from_reason(
+            "getPeerDependencyIssues: `virtualStoreDirMaxLength` exceeds u32::MAX"
+        )
+    })?,
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: While it's unlikely for these specific maximum length options to exceed u32::MAX in practice, using checked conversions prevents unintended silent truncation.

Low
  • More

Previous suggestions

Suggestions up to commit 30c9bdf
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve in-memory importer ownership

Thread the materialized importers directly from the install output to
link_manifest_link_deps, rather than relying on the optional fresh_lockfile.

pacquet/crates/package-manager/src/install.rs [1484-1494]

 crate::link_manifest_link_deps::<Reporter>(
     &workspace_root,
     &project_manifests,
-    fresh_lockfile.as_ref().or(lockfile).and_then(|lockfile| {
-        (!lockfile.importers.is_empty()).then_some(&lockfile.importers)
+    materialized_importers.as_ref().and_then(|importers| {
+        (!importers.is_empty()).then_some(importers)
     }),
     // Honor a `modulesDir` override the same way the
     // lockfile-driven symlink pass does.
     config.modules_dir.file_name().unwrap_or_else(|| std::ffi::OsStr::new("node_modules")),
 )
 .map_err(InstallError::LinkManifestLinkDeps)?;
Suggestion importance[1-10]: 9

__

Why: The suggestion catches a subtle but significant logic bug where fresh_lockfile is None when config.lockfile is false, causing the fallback to incorrect importer data.

High
Suggestions up to commit b683d79
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve dedupe without lockfiles

Use the in-memory resolved importer map for link_manifest_link_deps instead of
relying on the saved lockfile. This ensures deduplication works correctly even
when lockfile=false.

pacquet/crates/package-manager/src/install.rs [1484-1494]

 crate::link_manifest_link_deps::<Reporter>(
     &workspace_root,
     &project_manifests,
-    fresh_lockfile.as_ref().or(lockfile).and_then(|lockfile| {
-        (!lockfile.importers.is_empty()).then_some(&lockfile.importers)
+    link_manifest_importers.as_ref().and_then(|importers| {
+        (!importers.is_empty()).then_some(importers)
     }),
     // Honor a `modulesDir` override the same way the
     // lockfile-driven symlink pass does.
     config.modules_dir.file_name().unwrap_or_else(|| std::ffi::OsStr::new("node_modules")),
 )
 .map_err(InstallError::LinkManifestLinkDeps)?;
Suggestion importance[1-10]: 8

__

Why: This catches a subtle bug where lockfile=false causes fresh_lockfile to be None, losing the in-memory importers map and potentially breaking the deduplication of link: dependencies.

Medium
Normalize persisted path separators

Normalize the target paths in injectedDeps to use forward slashes. This prevents
.modules.yaml from containing backslashes on Windows, maintaining compatibility
with pnpm.

pacquet/crates/package-manager/src/virtual_store_layout.rs [331-335]

 let target = match target.strip_prefix(lockfile_dir) {
     Ok(relative) => relative.to_path_buf(),
     Err(_) => target,
 };
-targets.push(target.to_string_lossy().into_owned());
+targets.push(target.to_string_lossy().replace(std::path::MAIN_SEPARATOR, "/"));
Suggestion importance[1-10]: 7

__

Why: This fixes a cross-platform compatibility issue by ensuring that .modules.yaml uses forward slashes for paths, aligning with pnpm's expected format on Windows.

Medium
Suggestions up to commit 966a6d9
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve in-memory importer ownership

Thread the in-memory importer map from the install result to
link_manifest_link_deps, independent of whether the lockfile is saved. This
ensures link: dependencies are correctly checked against the built graph even
when config.lockfile is false.

pacquet/crates/package-manager/src/install.rs [1484-1494]

 crate::link_manifest_link_deps::<Reporter>(
     &workspace_root,
     &project_manifests,
-    fresh_lockfile.as_ref().or(lockfile).and_then(|lockfile| {
-        (!lockfile.importers.is_empty()).then_some(&lockfile.importers)
+    linked_importers.as_ref().and_then(|importers| {
+        (!importers.is_empty()).then_some(importers)
     }),
     // Honor a `modulesDir` override the same way the
     // lockfile-driven symlink pass does.
     config.modules_dir.file_name().unwrap_or_else(|| std::ffi::OsStr::new("node_modules")),
 )
 .map_err(InstallError::LinkManifestLinkDeps)?;
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a subtle bug where link_manifest_link_deps uses the wrong or outdated importer snapshot when config.lockfile is false, since wanted_lockfile evaluates to None.

Medium
Suggestions up to commit 8b28973
CategorySuggestion                                                                                                                                    Impact
Possible issue
Respect custom modules directory

Pass the configured modules directory name to avoid hardcoding node_modules.

pacquet/crates/package-manager/src/link_manifest_link_deps.rs [40-50]

 pub fn link_manifest_link_deps<Reporter: pacquet_reporter::Reporter>(
     workspace_root: &Path,
+    modules_dir_name: &std::ffi::OsStr,
     project_manifests: &[(PathBuf, &PackageManifest)],
     importers: Option<&HashMap<String, ProjectSnapshot>>,
 ) -> Result<(), LinkManifestLinkDepsError> {
     for (project_dir, manifest) in project_manifests {
         let importer_snapshot = importers.and_then(|importers| {
             importers
                 .get(&pacquet_workspace::importer_id_from_root_dir(workspace_root, project_dir))
         });
-        let modules_dir = project_dir.join("node_modules");
+        let modules_dir = project_dir.join(modules_dir_name);
Suggestion importance[1-10]: 9

__

Why: Hardcoding node_modules breaks support for custom modulesDir configurations, which is otherwise supported across the package manager.

High
Normalize manifest path separators

Normalize PathBuf paths to use POSIX-style forward slashes before serializing to
.modules.yaml.

pacquet/crates/package-manager/src/virtual_store_layout.rs [331-335]

 let target = match target.strip_prefix(lockfile_dir) {
     Ok(relative) => relative.to_path_buf(),
     Err(_) => target,
 };
-targets.push(target.to_string_lossy().into_owned());
+targets.push(
+    target
+        .components()
+        .map(|component| component.as_os_str().to_string_lossy())
+        .collect::<Vec<_>>()
+        .join("/"),
+);
Suggestion importance[1-10]: 9

__

Why: Failing to convert path separators to POSIX-style slashes will lead to broken paths in .modules.yaml on Windows, causing compatibility issues with other tools.

High
Pass configured modules directory

Update the caller link_manifest_link_deps to pass the configured modules_dir
basename.

pacquet/crates/package-manager/src/install.rs [1484-1491]

+let modules_dir_name = config.modules_dir.file_name().unwrap_or_else(|| std::ffi::OsStr::new("node_modules"));
 crate::link_manifest_link_deps::<Reporter>(
     &workspace_root,
+    modules_dir_name,
     &project_manifests,
     fresh_lockfile.as_ref().or(lockfile).and_then(|lockfile| {
         (!lockfile.importers.is_empty()).then_some(&lockfile.importers)
     }),
 )
 .map_err(InstallError::LinkManifestLinkDeps)?;
Suggestion importance[1-10]: 8

__

Why: This directly enables the fix proposed in the first suggestion, ensuring the caller threads the correct modulesDir name.

Medium
Suggestions up to commit 2fff932
CategorySuggestion                                                                                                                                    Impact
Possible issue
Link before build phase

Move the link_manifest_link_deps call to run before the build phase inside the
frozen and fresh install paths. This ensures manifest-only linked dependencies
are available during lifecycle script execution.

pacquet/crates/package-manager/src/install.rs [1484-1491]

+// Move this call into `InstallFrozenLockfile::run` and
+// `InstallWithFreshLockfile::run`, immediately after
+// `SymlinkDirectDependencies::run(...)` succeeds and before
+// any bin-linking/build phase starts.
 crate::link_manifest_link_deps::<Reporter>(
-    &workspace_root,
-    &project_manifests,
-    fresh_lockfile.as_ref().or(lockfile).and_then(|lockfile| {
-        (!lockfile.importers.is_empty()).then_some(&lockfile.importers)
-    }),
+    workspace_root,
+    project_manifests,
+    Some(importers),
+    modules_dir_name,
 )
-.map_err(InstallError::LinkManifestLinkDeps)?;
+.map_err(...)?
Suggestion importance[1-10]: 8

__

Why: Moving the link_manifest_link_deps pass before the build phase prevents missing dependency errors when lifecycle scripts or bin resolutions execute.

Medium
Honor custom modules directory

Thread the configured modules directory basename into the helper instead of
hardcoding node_modules. This ensures the manifest-only link: dependencies
correctly follow the user's layout configuration.

pacquet/crates/package-manager/src/link_manifest_link_deps.rs [50]

-let modules_dir = project_dir.join("node_modules");
+let modules_dir = project_dir.join(modules_dir_name);
Suggestion importance[1-10]: 8

__

Why: Avoiding a hardcoded node_modules ensures correct symlink creation when a custom modulesDir is configured.

Medium

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pacquet/crates/package-manager/src/symlink_direct_dependencies/tests.rs (1)

588-600: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a regression test for the trusted-importer bypass

pacquet/crates/package-manager/src/symlink_direct_dependencies/tests.rs: add a case that passes an unsafe importer id through trusted_importer_ids: Some(...) and asserts the symlink is allowed. The current test only covers the untrusted None path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pacquet/crates/package-manager/src/symlink_direct_dependencies/tests.rs`
around lines 588 - 600, Add a regression test alongside the existing
SymlinkDirectDependencies test, using an unsafe importer ID with
trusted_importer_ids set to Some(...) and asserting the dependency symlink is
created or otherwise allowed. Retain the existing trusted_importer_ids: None
case to verify the untrusted path remains covered.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pacquet/crates/package-manager/src/install.rs`:
- Around line 1476-1492: Update link_manifest_link_deps and its callers to emit
a pnpm:root added event whenever a manifest-linked link: dependency is
successfully symlinked, including the package name and relevant root-event
metadata. Ensure these events flow through the same reporting/NDJSON path used
by pnpm’s linkDirectDeps so they contribute to the +N -M summary without logging
skipped lockfile-tracked aliases.

In `@pacquet/crates/real-hoist/src/lib.rs`:
- Around line 287-323: The hoisting logic ignores
Config::hoist_workspace_packages, leaving the option inert and lacking
pnpm-compatible workspace package linking. Update the linker and hoisting flow
around the non-root importer handling and relevant configuration consumers to
implement hoistedWorkspacePackages behavior: keep importer dependency tree
membership unconditional, but conditionally create root hoisted name-links for
workspace packages based on the flag.

---

Outside diff comments:
In `@pacquet/crates/package-manager/src/symlink_direct_dependencies/tests.rs`:
- Around line 588-600: Add a regression test alongside the existing
SymlinkDirectDependencies test, using an unsafe importer ID with
trusted_importer_ids set to Some(...) and asserting the dependency symlink is
created or otherwise allowed. Retain the existing trusted_importer_ids: None
case to verify the untrusted path remains covered.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6983bbc2-5205-44e0-985b-b5876021ed89

📥 Commits

Reviewing files that changed from the base of the PR and between d2ed60a and b6af99a.

📒 Files selected for processing (18)
  • pacquet/crates/napi/src/resolve.rs
  • pacquet/crates/package-manager/src/hoisted_dep_graph.rs
  • pacquet/crates/package-manager/src/hoisted_dep_graph/tests.rs
  • pacquet/crates/package-manager/src/install.rs
  • pacquet/crates/package-manager/src/install/tests.rs
  • pacquet/crates/package-manager/src/install_frozen_lockfile.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/package-manager/src/link_manifest_link_deps.rs
  • pacquet/crates/package-manager/src/link_manifest_link_deps/tests.rs
  • pacquet/crates/package-manager/src/link_root_component_members.rs
  • pacquet/crates/package-manager/src/link_root_component_members/tests.rs
  • pacquet/crates/package-manager/src/symlink_direct_dependencies.rs
  • pacquet/crates/package-manager/src/symlink_direct_dependencies/tests.rs
  • pacquet/crates/package-manager/src/virtual_store_layout.rs
  • pacquet/crates/package-manager/src/virtual_store_layout/tests.rs
  • pacquet/crates/real-hoist/src/lib.rs
  • pacquet/crates/real-hoist/src/tests.rs

Comment thread pacquet/crates/real-hoist/src/lib.rs Resolved
@codecov-commenter

codecov-commenter commented Jul 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.67249% with 116 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.31%. Comparing base (fecfe83) to head (df90dd0).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pacquet/crates/napi/src/install.rs 33.12% 105 Missing ⚠️
...tes/package-manager/src/link_manifest_link_deps.rs 94.11% 4 Missing ⚠️
pacquet/crates/package-manager/src/hoist.rs 90.90% 3 Missing ⚠️
...package-manager/src/install_with_fresh_lockfile.rs 93.75% 2 Missing ⚠️
...et/crates/package-manager/src/hoisted_dep_graph.rs 85.71% 1 Missing ⚠️
...crates/package-manager/src/virtual_store_layout.rs 97.43% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12899      +/-   ##
==========================================
- Coverage   85.34%   85.31%   -0.04%     
==========================================
  Files         453      454       +1     
  Lines       71074    71474     +400     
==========================================
+ Hits        60657    60976     +319     
- Misses      10417    10498      +81     

☔ 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.

Review follow-ups for the manifest link: pass:

- A dependency key is a raw package.json object string; joining it
  into node_modules/<alias> unvalidated let a crafted alias
  (../.git, an absolute path, a backslash) escape node_modules and,
  combined with the force-replace symlink helper, rename or overwrite
  arbitrary paths. The join now routes through safe_join_modules_dir
  — the same ERR_PNPM_INVALID_DEPENDENCY_NAME guard the lockfile
  passes apply — and a traversal test pins the rejection.

- Each manifest-linked dep now emits the same pnpm:root added event
  the lockfile-driven pass emits, so these links show up in the +N
  summary and NDJSON output like v11's linkDirectDeps reported them.
  Reused (already-correct) symlinks stay silent.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 10:07

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.

…t ids

A declared project at `..` must link (Bit's nested capsule installs),
while the same id without the trusted set keeps the unsafe-path
rejection. Review follow-up on the trusted_importer_ids change.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 10:10

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.

@zkochan

zkochan commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

All review findings addressed:

  • Manifest alias path escape (qodo, security): fixed in 2fff932 — the alias join routes through safe_join_modules_dir, invalid aliases fail with ERR_PNPM_INVALID_DEPENDENCY_NAME before any write, traversal test added.
  • Missing pnpm:root added events (CodeRabbit): fixed in 2fff932 — the manifest link pass now emits per-dependency root events through the shared reporter path.
  • hoist_workspace_packages inert (CodeRabbit): pre-existing feature gap, already pinned by the known-failure CLI test hoist_workspace_packages_hoists_all_workspace_projects; this PR only stops the flag from wrongly gating hoister-tree membership. Details in the inline reply.
  • Trusted-importer regression test (CodeRabbit, outside-diff): added in 8b28973 — a declared project at .. links, an untrusted .. id still errors.

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

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pacquet/crates/package-manager/src/link_manifest_link_deps.rs (1)

40-108: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the linked package version here, not the raw link: spec. pacquet/crates/package-manager/src/link_manifest_link_deps.rs:85-89 should mirror pnpm’s pnpm:root added payload, where version comes from the linked package manifest (or 0.0.0 fallback), not the link:../... string.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pacquet/crates/package-manager/src/link_manifest_link_deps.rs` around lines
40 - 108, Update the RootMessage::Added construction in link_manifest_link_deps
so AddedRoot.version uses the linked target package manifest’s version, falling
back to "0.0.0" when unavailable, instead of spec.to_string() containing the raw
link: value. Reuse the resolved target_path or existing manifest-loading
utilities while preserving the current per-group reporting behavior.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pacquet/crates/package-manager/src/link_manifest_link_deps.rs`:
- Around line 40-108: Update the RootMessage::Added construction in
link_manifest_link_deps so AddedRoot.version uses the linked target package
manifest’s version, falling back to "0.0.0" when unavailable, instead of
spec.to_string() containing the raw link: value. Reuse the resolved target_path
or existing manifest-loading utilities while preserving the current per-group
reporting behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 16cee336-9307-423a-95ff-30ef66187c3c

📥 Commits

Reviewing files that changed from the base of the PR and between b6af99a and 2fff932.

📒 Files selected for processing (3)
  • pacquet/crates/package-manager/src/install.rs
  • pacquet/crates/package-manager/src/link_manifest_link_deps.rs
  • pacquet/crates/package-manager/src/link_manifest_link_deps/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pacquet/crates/package-manager/src/install.rs

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 8b28973

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 10, 2026
link_manifest_link_deps hardcoded <project>/node_modules while the
lockfile-driven symlink pass derives the per-project modules dir from
config.modules_dir's basename — a modulesDir override would grow a
stray node_modules/ next to the intended tree. The caller now threads
the same basename in, with a test pinning the custom-dir placement.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 10:42

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.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 966a6d9

…k pass

The install call site derives the name from
config.modules_dir.file_name(), which never yields `.`, `..`, or a
separator — but the helper is public and the joined path decides where
force-replacing symlinks land, so it now enforces the single-normal-
component contract itself and errors before any filesystem write. A
test pins the rejection for `.`, `..`, empty, separator-bearing, and
absolute names.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 11:11

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.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit b683d79

The isolated-linker branch of collect_injected_deps built its targets
with native separators, so .modules.yaml carried backslashes on
Windows — inconsistent with the hoistedLocations entries the hoisted
branch reuses (normalized in path_relative_to_lockfile_dir) and with
the existing unit test's expectations, which failed on the Windows CI
runner. Normalize to forward slashes on every platform.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 11:45

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.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 30c9bdf

@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: df90dd0d561d

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.108 ± 0.129 3.982 4.351 1.91 ± 0.12
pacquet@main 4.108 ± 0.119 3.932 4.238 1.91 ± 0.12
pnpr@HEAD 2.145 ± 0.117 1.998 2.325 1.00
pnpr@main 2.170 ± 0.134 1.940 2.309 1.01 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.107688237440001,
      "stddev": 0.12932164068438204,
      "median": 4.05971658374,
      "user": 3.80264606,
      "system": 3.4776781999999997,
      "min": 3.98237320524,
      "max": 4.35115123024,
      "times": [
        4.28740454624,
        4.08842659624,
        4.04905870824,
        4.35115123024,
        3.98237320524,
        3.9898784102400002,
        4.07037445924,
        4.01847427224,
        4.20904696024,
        4.03069398624
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.10820730574,
      "stddev": 0.1186923341318949,
      "median": 4.15821173774,
      "user": 3.80232626,
      "system": 3.4513808999999993,
      "min": 3.93218003024,
      "max": 4.23787524224,
      "times": [
        4.21767048024,
        3.94292316824,
        4.23787524224,
        4.18688877824,
        3.95433303624,
        4.11759401224,
        4.17618483424,
        4.15071448924,
        4.16570898624,
        3.93218003024
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.14532010424,
      "stddev": 0.11700021424952618,
      "median": 2.11845699224,
      "user": 2.65063056,
      "system": 2.9927297,
      "min": 1.99841318024,
      "max": 2.32495337924,
      "times": [
        2.07724804624,
        2.10191857924,
        2.07481424624,
        2.00494641224,
        2.32495337924,
        2.31484471524,
        1.99841318024,
        2.19043914724,
        2.13499540524,
        2.23062793124
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.17028781244,
      "stddev": 0.13351329407839996,
      "median": 2.20705901124,
      "user": 2.63406716,
      "system": 2.997778,
      "min": 1.93961029424,
      "max": 2.3089964802400003,
      "times": [
        2.23573788524,
        1.93961029424,
        2.3089964802400003,
        2.04097249024,
        2.27356581124,
        2.27196891324,
        2.30573956724,
        2.17838013724,
        2.14101696924,
        2.00688957624
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 654.3 ± 9.6 640.9 667.9 1.00
pacquet@main 671.8 ± 40.0 628.4 777.0 1.03 ± 0.06
pnpr@HEAD 702.1 ± 29.1 667.6 768.8 1.07 ± 0.05
pnpr@main 731.6 ± 89.8 676.7 984.3 1.12 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6543168588399999,
      "stddev": 0.009615619206173277,
      "median": 0.65357341164,
      "user": 0.38916202,
      "system": 1.32892756,
      "min": 0.64092540014,
      "max": 0.66786251314,
      "times": [
        0.66032495914,
        0.64201411614,
        0.6467725641400001,
        0.66250209614,
        0.65436145514,
        0.66590955514,
        0.66786251314,
        0.64092540014,
        0.64971056114,
        0.65278536814
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6718111864399999,
      "stddev": 0.04002045616051102,
      "median": 0.66339302414,
      "user": 0.38330422,
      "system": 1.33120986,
      "min": 0.6284028391400001,
      "max": 0.77695359814,
      "times": [
        0.65062156714,
        0.65774620814,
        0.6284028391400001,
        0.67240097214,
        0.67256271514,
        0.66392223214,
        0.66286381614,
        0.68399895314,
        0.64863896314,
        0.77695359814
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.7020989531399999,
      "stddev": 0.02907702471242113,
      "median": 0.6980168196400001,
      "user": 0.39440652,
      "system": 1.34930906,
      "min": 0.66756406514,
      "max": 0.76879172614,
      "times": [
        0.70932737214,
        0.70555148914,
        0.70113530114,
        0.67041145014,
        0.69489833814,
        0.68764395714,
        0.66756406514,
        0.69090768514,
        0.72475814714,
        0.76879172614
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.73159156714,
      "stddev": 0.08979616074115364,
      "median": 0.70667610364,
      "user": 0.40604472,
      "system": 1.36206816,
      "min": 0.67669688014,
      "max": 0.9842587501400001,
      "times": [
        0.71945898014,
        0.7075141781400001,
        0.71285822814,
        0.70240013814,
        0.68446406314,
        0.67669688014,
        0.70524565714,
        0.9842587501400001,
        0.71718076714,
        0.70583802914
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.276 ± 0.026 4.226 4.315 1.97 ± 0.09
pacquet@main 4.289 ± 0.033 4.239 4.335 1.98 ± 0.09
pnpr@HEAD 2.248 ± 0.123 2.059 2.423 1.04 ± 0.07
pnpr@main 2.171 ± 0.103 2.052 2.411 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.275639985080001,
      "stddev": 0.026239450117484638,
      "median": 4.27577690018,
      "user": 3.76790142,
      "system": 3.38621762,
      "min": 4.226192092680001,
      "max": 4.3154447646800005,
      "times": [
        4.27774155968,
        4.258124044680001,
        4.27879024968,
        4.27120747868,
        4.273812240680001,
        4.29736973468,
        4.25307102268,
        4.226192092680001,
        4.304646662680001,
        4.3154447646800005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.289408362580001,
      "stddev": 0.03287373392299391,
      "median": 4.29311935318,
      "user": 3.7518535199999996,
      "system": 3.3845509199999997,
      "min": 4.23879265668,
      "max": 4.33525066468,
      "times": [
        4.23879265668,
        4.27508228768,
        4.273046083680001,
        4.296399768680001,
        4.304189126680001,
        4.30826977468,
        4.33105225268,
        4.28983893768,
        4.33525066468,
        4.24216207268
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.2475089947799995,
      "stddev": 0.12285650724189091,
      "median": 2.2689741131799996,
      "user": 2.4842650199999996,
      "system": 2.9003441199999997,
      "min": 2.0594584236799998,
      "max": 2.42296778668,
      "times": [
        2.19996375468,
        2.28005248768,
        2.31584462868,
        2.1150849416799997,
        2.32568668368,
        2.25789573868,
        2.3868078596799998,
        2.42296778668,
        2.11132764268,
        2.0594584236799998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.17129489568,
      "stddev": 0.10292739917025986,
      "median": 2.1438045521799998,
      "user": 2.48829332,
      "system": 2.91786122,
      "min": 2.05210370968,
      "max": 2.41065419368,
      "times": [
        2.15386794468,
        2.28140478968,
        2.14362948568,
        2.14397961868,
        2.41065419368,
        2.14152377368,
        2.09281780668,
        2.17504510268,
        2.05210370968,
        2.11792253168
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.362 ± 0.016 1.343 1.397 2.01 ± 0.09
pacquet@main 1.362 ± 0.029 1.328 1.427 2.01 ± 0.10
pnpr@HEAD 0.677 ± 0.029 0.653 0.755 1.00
pnpr@main 0.688 ± 0.035 0.662 0.784 1.02 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.36220484292,
      "stddev": 0.01622342380405314,
      "median": 1.3615612594200002,
      "user": 1.3156804799999997,
      "system": 1.70293128,
      "min": 1.34325360992,
      "max": 1.39740436892,
      "times": [
        1.34325360992,
        1.36003287892,
        1.35546157192,
        1.36308963992,
        1.37422921092,
        1.37013714792,
        1.39740436892,
        1.34388683992,
        1.36527769892,
        1.34927546192
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.3618684863200001,
      "stddev": 0.02934140419719299,
      "median": 1.3477853734199998,
      "user": 1.3206954799999997,
      "system": 1.67134958,
      "min": 1.32817071292,
      "max": 1.42709074592,
      "times": [
        1.3496211599199999,
        1.34594958692,
        1.37738427292,
        1.42709074592,
        1.37262113092,
        1.34589908392,
        1.34587943492,
        1.33973606892,
        1.38633266592,
        1.32817071292
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6774082585200001,
      "stddev": 0.028767254914916433,
      "median": 0.67176180692,
      "user": 0.33766818,
      "system": 1.28555908,
      "min": 0.65259035692,
      "max": 0.75453864892,
      "times": [
        0.66801300692,
        0.65652986392,
        0.75453864892,
        0.67799128692,
        0.6758938599200001,
        0.65259035692,
        0.66146570492,
        0.67234307992,
        0.68353624292,
        0.67118053392
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6882661691199999,
      "stddev": 0.03548581991892535,
      "median": 0.6798366224200001,
      "user": 0.33753878,
      "system": 1.3097717799999997,
      "min": 0.66187658092,
      "max": 0.78370555492,
      "times": [
        0.68877631092,
        0.6811592709200001,
        0.67985050292,
        0.67982274192,
        0.66187658092,
        0.70085944992,
        0.66334352092,
        0.6705789869200001,
        0.67268877092,
        0.78370555492
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.057 ± 0.049 3.018 3.158 4.60 ± 0.08
pacquet@main 3.051 ± 0.045 2.995 3.137 4.59 ± 0.08
pnpr@HEAD 0.664 ± 0.006 0.654 0.672 1.00
pnpr@main 0.667 ± 0.005 0.658 0.674 1.00 ± 0.01
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.05669677522,
      "stddev": 0.04877192738506732,
      "median": 3.03528872552,
      "user": 1.79392006,
      "system": 1.9898369799999998,
      "min": 3.0176569830199997,
      "max": 3.15797692002,
      "times": [
        3.03440539502,
        3.03617205602,
        3.02744109702,
        3.02842007802,
        3.04423918102,
        3.0176569830199997,
        3.01770044102,
        3.1276150610199998,
        3.15797692002,
        3.07534054002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.05126624692,
      "stddev": 0.04511407011146454,
      "median": 3.04613468402,
      "user": 1.7941742599999997,
      "system": 1.9488628799999996,
      "min": 2.99514804502,
      "max": 3.1371190910199998,
      "times": [
        3.04171614702,
        3.05129223502,
        3.04238102302,
        3.04988834502,
        2.99514804502,
        3.0661382220199997,
        3.00055525702,
        3.1371190910199998,
        3.11163320602,
        3.01679089802
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6643381508200001,
      "stddev": 0.0056948827764310055,
      "median": 0.66503506702,
      "user": 0.34481126,
      "system": 1.28073458,
      "min": 0.65406097902,
      "max": 0.6723877460200001,
      "times": [
        0.66844508702,
        0.66634949302,
        0.65406097902,
        0.66264730502,
        0.67092792302,
        0.6644978420200001,
        0.6723877460200001,
        0.6599068920200001,
        0.6585859490200001,
        0.66557229202
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.66665004182,
      "stddev": 0.00513779156207562,
      "median": 0.66678219302,
      "user": 0.34701326,
      "system": 1.27814338,
      "min": 0.6575686270200001,
      "max": 0.6740894110200001,
      "times": [
        0.6575686270200001,
        0.67145104702,
        0.67242529102,
        0.66744241902,
        0.6612152290200001,
        0.66740761402,
        0.66615677202,
        0.6653698670200001,
        0.66337414102,
        0.6740894110200001
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 634.6 ± 9.6 622.6 648.4 5.88 ± 0.09
pacquet@main 635.1 ± 6.2 625.6 647.0 5.88 ± 0.06
pnpr@HEAD 108.0 ± 0.4 107.1 108.6 1.00 ± 0.01
pnpr@main 108.0 ± 0.5 106.5 108.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6346147199999999,
      "stddev": 0.009584659235510381,
      "median": 0.637524492,
      "user": 0.6027113999999999,
      "system": 0.14985833999999998,
      "min": 0.6226424285,
      "max": 0.6483727245,
      "times": [
        0.6425016305,
        0.6249382415,
        0.6354049735,
        0.6226424285,
        0.6239109215,
        0.6415080825,
        0.6250005705,
        0.6422236165,
        0.6483727245,
        0.6396440105
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6351098421000001,
      "stddev": 0.006194926657461654,
      "median": 0.6349302885,
      "user": 0.6063903999999999,
      "system": 0.14847154,
      "min": 0.6255552675,
      "max": 0.6470407025,
      "times": [
        0.6409555045,
        0.6365320355,
        0.6338029395,
        0.6470407025,
        0.6255552675,
        0.6333325705,
        0.6383463815,
        0.6288421155,
        0.6306332665,
        0.6360576375
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10800982022,
      "stddev": 0.000360423929314787,
      "median": 0.1080089865,
      "user": 0.027102839999999996,
      "system": 0.01942426,
      "min": 0.1071482675,
      "max": 0.1086476865,
      "times": [
        0.1071482675,
        0.1078453725,
        0.1080964965,
        0.1078628825,
        0.1082951585,
        0.1077908775,
        0.1081145865,
        0.1080089865,
        0.1081431535,
        0.1078223165,
        0.1085721095,
        0.1075656575,
        0.1084798575,
        0.1083324465,
        0.1080116625,
        0.1077483075,
        0.1086208735,
        0.1075621205,
        0.1079247765,
        0.1079016105,
        0.1077947845,
        0.1086476865,
        0.1082366975,
        0.1076637275,
        0.1080550895
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10796635594000001,
      "stddev": 0.0004512734736377591,
      "median": 0.1080795735,
      "user": 0.02869792,
      "system": 0.01773434,
      "min": 0.1065398555,
      "max": 0.1086225955,
      "times": [
        0.1073275845,
        0.1079854395,
        0.1082339595,
        0.1082262595,
        0.1077903825,
        0.1077683845,
        0.1086225955,
        0.1079541705,
        0.1075882395,
        0.1078780985,
        0.1082017815,
        0.1074864355,
        0.1082921105,
        0.1081698425,
        0.1074497805,
        0.1080203565,
        0.1082891635,
        0.1083612085,
        0.1076704415,
        0.1080795735,
        0.1081577995,
        0.1082976195,
        0.1081662525,
        0.1086015635,
        0.1065398555
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 6.867 ± 0.096 6.713 7.059 1.38 ± 0.04
pacquet@main 6.855 ± 0.113 6.736 7.124 1.38 ± 0.05
pnpr@HEAD 5.041 ± 0.122 4.904 5.265 1.01 ± 0.04
pnpr@main 4.978 ± 0.141 4.864 5.272 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 6.8671285742200014,
      "stddev": 0.09605064160071305,
      "median": 6.889921017420001,
      "user": 4.02553376,
      "system": 3.71989814,
      "min": 6.71256343692,
      "max": 7.05917838892,
      "times": [
        7.05917838892,
        6.71256343692,
        6.7840656719200005,
        6.78421876192,
        6.92093749992,
        6.82391490192,
        6.897496745920001,
        6.890803264920001,
        6.90906829992,
        6.88903876992
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 6.855389324620001,
      "stddev": 0.11337411795845533,
      "median": 6.82720741642,
      "user": 3.9904512599999995,
      "system": 3.7106499399999997,
      "min": 6.736040362920001,
      "max": 7.1235503299200005,
      "times": [
        6.81305459892,
        6.85235385892,
        6.89584991392,
        6.74830588992,
        7.1235503299200005,
        6.836977456920001,
        6.785622415920001,
        6.736040362920001,
        6.94470104292,
        6.81743737592
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 5.04095313762,
      "stddev": 0.12218153662529183,
      "median": 5.010655185420001,
      "user": 2.73654756,
      "system": 3.23752054,
      "min": 4.90443991692,
      "max": 5.264592487920001,
      "times": [
        4.947924293920001,
        4.98085988892,
        4.963851532920001,
        4.9346822479200005,
        5.108671307920001,
        5.040450481920001,
        5.04535504992,
        5.21870416792,
        4.90443991692,
        5.264592487920001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 4.97807809712,
      "stddev": 0.14139151911227305,
      "median": 4.91218348492,
      "user": 2.77094886,
      "system": 3.2313981399999996,
      "min": 4.86444181592,
      "max": 5.27243360992,
      "times": [
        5.1258223349200005,
        4.878960111920001,
        5.27243360992,
        4.86444181592,
        5.11469195992,
        4.90587968292,
        4.89121146292,
        4.866406924920001,
        4.9184872869200005,
        4.942445780920001
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12899
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
4,275.64 ms
(+0.30%)Baseline: 4,263.00 ms
5,115.60 ms
(83.58%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,056.70 ms
(+0.80%)Baseline: 3,032.44 ms
3,638.93 ms
(84.00%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,362.20 ms
(+0.58%)Baseline: 1,354.40 ms
1,625.28 ms
(83.81%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
634.61 ms
(-1.61%)Baseline: 645.01 ms
774.02 ms
(81.99%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
4,107.69 ms
(+1.23%)Baseline: 4,057.93 ms
4,869.52 ms
(84.36%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
6,867.13 ms
(+0.69%)Baseline: 6,820.26 ms
8,184.31 ms
(83.91%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
654.32 ms
(+2.93%)Baseline: 635.71 ms
762.85 ms
(85.77%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12899
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,247.51 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
664.34 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
677.41 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
108.01 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,145.32 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
5,040.95 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
702.10 ms
🐰 View full continuous benchmarking report in Bencher

zkochan and others added 2 commits July 10, 2026 15:11
… parity follow-ups

Follow-ups closing the remaining v11-parity gaps flagged on the
Bit-parity PR:

- hoistWorkspacePackages (v11's hoistedWorkspacePackages) is now
  implemented instead of inert: every named non-root project becomes a
  lowest-precedence root-level hoist candidate; where a hoist pattern
  matches, <hoisted modules dir>/<name> symlinks straight to the
  project dir. Matching v11, placements stay out of .modules.yaml's
  hoistedDependencies and contribute no bins; one deliberate
  divergence — a placed name claims its alias so an equally-named
  transitive can't clobber the link nondeterministically. The pinned
  known-failure CLI test is replaced by a real end-to-end test
  covering both the default-on and opted-out shapes.

- The manifest link: pass now links the placed deps' declared bins
  into <modules dir>/.bin (v11's linkDirectDeps bin-linked every
  direct dep, link: included); targets without a package.json are
  skipped, so Bit's manifest-less component links stay bin-less
  no-ops.

- injectedDeps is restricted to directory-resolution snapshots: v11
  derived the map from injected workspace projects, so a file: tarball
  dep — whose extracted copy mirrors no source directory — no longer
  appears.

- Groundwork for the napi peer-issues query: Install/fresh-path gain
  an optional peer_issues_sink that captures the resolver's
  per-importer peer-dependency issues, and a sink-driven dry run
  suppresses the CLI's stdout diff report. Always None for CLI
  installs; the binding consumes it in the follow-up commit.

- plans/MULTI_LEVEL_HOISTING.md documents the remaining per-importer
  hoisting-roots gap (layout-density only — nested placement stays
  resolution-correct), with the upstream reference and an
  implementation sketch.

Co-Authored-By: Claude Fable 5 <[email protected]>
The last stubbed engine operation. The binding maps the
PeerIssuesOptions subset onto the install options and runs a
sink-driven dry_run resolve — a full fresh resolution that writes
nothing (no lockfile, no node_modules, no CLI report) — then returns
the per-importer issues in v11's PeerDependencyIssuesByProjects wire
shape.

conflicts / intersections are derived the way v11's mergePeers does:
all-optional peers are skipped, a single wanted range passes through
verbatim, and multiple ranges intersect via node-semver's bound-set
intersection (an empty intersection or unparsable range records a
conflict, matching v11's swallow-errors safeIntersect). Bit consumes
exactly the intersections field to auto-add missing peers.

autoInstallPeers defaults to false for this query, unlike install:
with peers auto-installed the resolver satisfies them itself and
nothing would ever be reported. Callers can opt back in; the shipped
index.d.ts documents the difference.

Known limitation: parents[].version is empty — the resolver's issue
chain is name-only today (noted in parents_from_chain).

The now-unused ERR_PNPM_NAPI_UNIMPLEMENTED helper is removed; no
stubbed operations remain.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 13:13

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.

@zkochan

zkochan commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

Two follow-up commits close the parity gaps discussed in this review:

d2a3d00 — hoistWorkspacePackages + pipeline follow-ups

  • hoistWorkspacePackages is now implemented rather than inert (closing the loop on the earlier hoister-membership finding): named workspace projects become lowest-precedence root-level hoist candidates, name-linked from the hoisted modules dir to the project dir. Matching v11: no .modules.yaml hoistedDependencies entries, no bins; one documented divergence — a placed name claims its alias so an equally-named transitive cannot clobber the link. The pinned known-failure CLI test is replaced by a real end-to-end test (default-on + hoistWorkspacePackages: false).
  • The manifest link: pass links placed deps' declared bins into .bin (v11 linkDirectDeps parity); manifest-less targets stay bin-less no-ops.
  • injectedDeps is restricted to directory-resolution snapshots, removing the file: tarball superset noted in the PR description.

df90dd0 — getPeerDependencyIssues implemented in the binding
The last stubbed engine operation. A sink-driven dry_run resolve (no lockfile, no node_modules, no CLI report) returns v11's PeerDependencyIssuesByProjects shape; conflicts/intersections are derived per v11's mergePeers via semver bound-set intersection. autoInstallPeers defaults to false for the query (documented in index.d.ts) — with it on, the resolver satisfies the peers itself and nothing is ever reported. Verified end-to-end through Bit's lynx wrapper. Known limitation: parents[].version is empty (the resolver's issue chain is name-only today).

The remaining structural gap — per-importer multi-level hoisting roots — is layout-density only (nested placement stays resolution-correct) and is written up with an implementation sketch in pacquet/plans/MULTI_LEVEL_HOISTING.md.

Bit's app root components e2e (38/38 across all linkers) re-verified against the final binding.


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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit df90dd0

@zkochan
zkochan merged commit 5333a25 into main Jul 10, 2026
32 checks passed
@zkochan
zkochan deleted the fix/bit-e2e-engine-parity branch July 10, 2026 14:02
zkochan pushed a commit to zkochan/bit that referenced this pull request Jul 10, 2026
Carries the engine fixes for Bit's e2e failures (pnpm/pnpm#12899):
root-component member linking without on-disk manifests, injectedDeps
in .modules.yaml, hoisted-linker peered-snapshot and importer-subtree
materialization, out-of-root declared importers, lockfile-excluded
link: deps, empty-specifier resolution, hoistWorkspacePackages
name-links, and an implemented getPeerDependencyIssues.

Co-Authored-By: Claude Fable 5 <[email protected]>
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