Skip to content

feat(napi): pass the resolved directory to the readPackage hook - #12936

Merged
zkochan merged 2 commits into
mainfrom
feat/read-package-hook-project-dir
Jul 11, 2026
Merged

zkochan merged 2 commits into
mainfrom
feat/read-package-hook-project-dir

Conversation

@zkochan

@zkochan zkochan commented Jul 11, 2026 •

Copy link
Copy Markdown
Member

When the engine resolves a workspace project as an injected file: dependency, it feeds the host's readPackage callback that project's manifest as supplied in projects. A host that pre-transforms its importer manifests (Bit strips workspace-sibling deps there because it wires those links itself) has no way to recognize the call and restore the raw manifest — so the injected instance silently loses dependencies, and Bit's component graph loses its component edges (the BIT_FEATURES=deps-graph "should replace pending version in direct dependency" e2e cluster on teambit/bit#10293).

pnpm's TS engine never had this problem: it keeps raw project manifests and applies the host hook chain contextually — with the project dir for the importer view, without it for dependency manifests.

This PR gives the node-API host the same discrimination:

  • HookContext carries the lockfile-root-relative directory of a directory resolution (injected workspace projects and file: deps); other resolutions pass none.
  • The napi bridge forwards it as the JS callback's second argument: (manifest, resolvedDir?) => manifest. FnArgs is required for the two-argument spread — a bare tuple serializes into a single JSON array argument.
  • The .pnpmfile.cjs bridge deliberately does not expose it, matching pnpm's pnpmfile readPackage(pkg, context) contract.

A unit test pins the contract (directory resolution → Some(dir), registry → None).

Verified end-to-end against Bit with a locally built binding plus the matching lynx change (teambit/bit@9c45e72be): the deps-graph e2e file goes from 7 failing to 3 failing, and the remaining three are the pre-existing lockfile-resolution-reuse gap (plans/LOCKFILE_RESOLUTION_REUSE.md), unrelated to manifests. Full pacquet suite: 5157/5157 pass.


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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • readPackage hooks can now receive an optional resolvedDir value for directory/file-based dependency resolutions.
    • Updated public type definitions and JSDoc to reflect the new (manifest, resolvedDir?) => manifest hook signature.
  • Bug Fixes
    • Ensured the directory context is propagated consistently to readPackage for directory resolutions, while leaving it unset for registry-based resolutions.
  • Tests
    • Added regression coverage verifying resolvedDir is provided for directory dependencies and omitted for registry dependencies.

A host that pre-transforms its in-memory project manifests (Bit strips
workspace-sibling deps from importer manifests because it wires those
links itself) loses the raw manifest by the time the engine resolves the
same project as an injected "file:" dependency — the instance then drops
deps the host meant to keep, and Bit's component dependency graph loses
its component edges. pnpm's TS engine avoids this by keeping raw project
manifests and applying the host's hook chain contextually (with the
project dir for the importer view, without it for dependency manifests).

Give the node-API host the same discrimination: HookContext now carries
the lockfile-root-relative directory of a directory resolution, and the
napi bridge forwards it as the JS callback's second argument —
`(manifest, resolvedDir?) => manifest` — via FnArgs (a bare tuple would
serialize into a single JSON array argument). Registry and other
non-directory resolutions pass no directory. The `.pnpmfile.cjs` bridge
deliberately does not expose it: pnpm's pnpmfile `readPackage(pkg,
context)` contract has no directory either.

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

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

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7b0201cc-fc65-49a1-9efc-b58bb337114f

📥 Commits

Reviewing files that changed from the base of the PR and between a437bd5 and d94a68a.

📒 Files selected for processing (4)
  • pnpm/crates/hooks/src/lib.rs
  • pnpm/crates/hooks/tests/node_hooks.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/resolving-deps-resolver/src/tests.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/hooks/src/lib.rs
  • pnpm/crates/resolving-deps-resolver/src/tests.rs
  • pnpm/crates/hooks/tests/node_hooks.rs

📝 Walkthrough

Walkthrough

HookContext now carries an optional directory path. Directory-based resolutions pass this path through the resolver and N-API bridge to the JavaScript readPackage hook, while existing callers explicitly use None. Types, documentation, and regression tests were updated.

Changes

ReadPackage resolved-directory flow

Layer / File(s) Summary
Hook context and Node.js callback contract
pnpm/crates/hooks/src/lib.rs, pnpm/crates/napi/src/hooks.rs, pnpm/npm/napi/index.d.ts
HookContext and ReadPackageHook now support an optional lockfile-root-relative resolvedDir, which the N-API bridge forwards to JavaScript.
Resolver propagation and regression coverage
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs, pnpm/crates/resolving-deps-resolver/src/tests.rs, pnpm/crates/resolving-deps-resolver/Cargo.toml
Directory resolutions populate ctx.dir; registry resolutions use None, with tests recording and asserting both cases.
Existing hook context updates
pnpm/crates/cli/src/config_deps.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs, pnpm/crates/hooks/tests/node_hooks.rs
Existing hook contexts and Node.js hook tests explicitly initialize dir: None where no directory is available.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Resolver
  participant HookAdapter
  participant JavaScriptHook
  Resolver->>HookAdapter: readPackage(manifest, HookContext)
  HookAdapter->>JavaScriptHook: (manifest, resolvedDir?)
  JavaScriptHook-->>HookAdapter: transformed manifest
  HookAdapter-->>Resolver: transformed manifest
Loading

Possibly related PRs

  • pnpm/pnpm#12044: Established related PnpmfileHooks and HookContext Node-based hook infrastructure.
  • pnpm/pnpm#12125: Modified overlapping hook-context plumbing in dependency resolution and lockfile installation.
  • pnpm/pnpm#12822: Introduced the related N-API readPackage bridge extended by this change.

Suggested labels: product: pacquet

Suggested reviewers: qodo-code-review

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/read-package-hook-project-dir

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

feat(napi): pass resolved directory to readPackage hook

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds a dir field to HookContext carrying the lockfile-root-relative directory for directory
 resolutions (injected workspace projects, file: deps).
• napi bridge forwards it as a second resolvedDir? argument to the JS readPackage callback via
 FnArgs, so hosts (e.g. Bit) can restore raw manifests they pre-transform.
• .pnpmfile.cjs bridge intentionally omits it to match pnpm's existing readPackage(pkg, context)
 contract.
• Updates all HookContext construction sites and adds a unit test asserting directory vs. registry
 resolutions produce Some(dir) / None.
• Updates TypeScript type definitions and docs for the new callback signature.
Diagram

graph TD
  A["resolve_dependency_tree"] --> B["HookContext dir"] --> C{"Resolution type"}
  C -->|"Directory"| D["Some(dir)"]
  C -->|"Registry/other"| E["None"]
  D --> F["napi JsReadPackageHook"]
  E --> F
  F --> G["JS readPackage(manifest, resolvedDir?)"]
  B --> H[".pnpmfile.cjs bridge (no dir)"]
Loading
High-Level Assessment

Mirroring pnpm's TS engine behavior (contextual hook application based on resolution type) is the natural and minimal-risk approach here; alternatives like always passing a directory or restructuring HookContext into an enum were considered implicitly but would add complexity without benefit given the narrow, well-defined use case.

Files changed (9) +166 / -23

Enhancement (5) +43 / -9
config_deps.rsUpdate HookContext construction with new dir field +1/-1

Update HookContext construction with new dir field

• Adds 'dir: None' to the 'HookContext' literal used for the config-deps update hook chain since this call site has no directory resolution context.

pnpm/crates/cli/src/config_deps.rs

lib.rsAdd dir field to HookContext struct +10/-0

Add dir field to HookContext struct

• Introduces 'pub dir: Option<String>' on 'HookContext' to carry the lockfile-root-relative directory of a directory resolution, with doc comments explaining its purpose and consumers.

pnpm/crates/hooks/src/lib.rs

hooks.rsForward resolved directory to JS readPackage callback via FnArgs +21/-6

Forward resolved directory to JS readPackage callback via FnArgs

• Changes 'HookSink' type to use 'FnArgs<(Value, Option<String>)>' instead of a bare 'Value', forwarding 'ctx.dir' as the second callback argument so JS hosts receive '(manifest, resolvedDir?)'. Updates module docs explaining the FnArgs requirement and the pnpmfile contract distinction.

pnpm/crates/napi/src/hooks.rs

install_with_fresh_lockfile.rsUpdate HookContext construction with new dir field +1/-1

Update HookContext construction with new dir field

• Adds 'dir: None' to the 'HookContext' used for the 'after_all_resolved' hook call since this call site is not a directory resolution.

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

resolve_dependency_tree.rsPopulate HookContext.dir from directory resolutions +10/-1

Populate HookContext.dir from directory resolutions

• Derives the 'dir' value from 'LockfileResolution::Directory' when building 'HookContext' for the 'read_package' hook call, passing 'None' for other resolution types.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs

Tests (2) +109 / -9
node_hooks.rsUpdate tests for new HookContext.dir field +10/-9

Update tests for new HookContext.dir field

• Adds 'dir: None' to all 'HookContext' instantiations across existing node hook tests to accommodate the new struct field.

pnpm/crates/hooks/tests/node_hooks.rs

tests.rsAdd test verifying readPackage hook receives resolution directory +99/-0

Add test verifying readPackage hook receives resolution directory

• Adds a 'RecordingHooks' test stub implementing 'PnpmfileHooks' and a new async test asserting directory resolutions pass 'Some(dir)' and registry resolutions pass 'None' to 'read_package'.

pnpm/crates/resolving-deps-resolver/src/tests.rs

Documentation (1) +13 / -5
index.d.tsUpdate TypeScript types for readPackage hook signature +13/-5

Update TypeScript types for readPackage hook signature

• Updates 'ReadPackageHook' type and 'install' JSDoc to reflect the new optional 'resolvedDir' second argument.

pnpm/npm/napi/index.d.ts

Other (1) +1 / -0
Cargo.tomlAdd async-trait dev-dependency for tests +1/-0

Add async-trait dev-dependency for tests

• Adds 'async-trait' as a dev-dependency to support implementing the new 'RecordingHooks' test stub.

pnpm/crates/resolving-deps-resolver/Cargo.toml

@greptile-apps

greptile-apps Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Small, additive, backward-compatible change — all callsites updated, the one live path gated on LockfileResolution::Directory, and both bridges receive the correct contract. Safe to merge.

All HookContext construction sites compile against the new field. The test pins the exact contract for both directory and registry resolutions. The pnpmfile worker bridge correctly excludes dir from the context it passes to JS hooks. No logic regressions introduced.

No files require special attention.

Reviews (2): Last reviewed commit: "fix(pacquet): satisfy rustfmt/clippy and..." | Re-trigger Greptile

Comment thread pnpm/crates/hooks/src/lib.rs Resolved
@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Action required

1. Missing changeset for @pnpm/napi ✗ Dismissed 📘 Rule violation § Compliance
Description
This PR changes the published TypeScript surface of @pnpm/napi by extending ReadPackageHook to
accept resolvedDir, but no corresponding changeset is included. Without a changeset, the release
tooling may not publish/communicate this user-visible API change correctly.
Code

pnpm/npm/napi/index.d.ts[R62-71]

+/**
+ * A synchronous `readPackage` hook applied to resolved dependency manifests.
+ *
+ * `resolvedDir` is set when the manifest came from a directory resolution (an
+ * injected workspace project or a `file:` dependency); it is the directory
+ * recorded in the lockfile, relative to the lockfile root. Hosts use it to
+ * recognize a workspace project's dependency instance and substitute the
+ * project's raw manifest.
+ */
+export type ReadPackageHook = (manifest: PackageManifest, resolvedDir?: string) => PackageManifest
Evidence
The PR modifies the @pnpm/napi TypeScript API by changing ReadPackageHook to `(manifest,
resolvedDir?) => ..., and @pnpm/napi` is a published package. The repository is configured to use
Changesets, so this TypeScript package change requires a changeset entry.

Rule 713441: Require changeset for TypeScript package changes
pnpm/npm/napi/index.d.ts[62-71]
pnpm/npm/napi/package.json[1-32]
.changeset/config.json[1-9]

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 published TypeScript package (`@pnpm/napi`) has a user-visible API change (`ReadPackageHook` now receives an optional `resolvedDir`) but the PR does not include a changeset entry for it.

## Issue Context
This repo uses Changesets for release notes/versioning, and `@pnpm/napi` is a published package. The new optional parameter should be captured in a `.changeset/*.md` file with an appropriate bump type (likely `patch` since it is backwards-compatible and fixes host hook behavior).

## Fix Focus Areas
- pnpm/npm/napi/index.d.ts[62-71]
- pnpm/npm/napi/package.json[1-32]
- .changeset/config.json[1-9]

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



Remediation recommended

2. Redundant comment on type alias 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The comment above RecordedReadPackageCalls restates what the type alias name and definition
already make obvious. This adds noise without conveying intent or rationale.
Code

pnpm/crates/resolving-deps-resolver/src/tests.rs[3080]

+/// The `(name, dir)` pairs recorded by [`RecordingHooks`].
Evidence
The comment The (name, dir) pairs recorded by RecordingHooks. provides no additional information
beyond what RecordedReadPackageCalls = Arc<Mutex<Vec<(String, Option<String>)>>> already states,
which is the kind of redundant comment the rule prohibits.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/resolving-deps-resolver/src/tests.rs[3080-3081]

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 newly added comment is redundant because it only rephrases the immediately following type alias without adding intent, constraints, or rationale.

## Issue Context
Per the review guide, comments should explain *why* something exists or any non-obvious constraints, not just restate the code.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/tests.rs[3080-3081]

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


3. resolvedDir contract mismatch 🐞 Bug ⛨ Security
Description
HookContext.dir is populated from LockfileResolution::Directory.directory, but that field is not
guaranteed to be lockfile-root-relative (it can be absolute for link: deps or contain ..), while
the N-API TypeScript contract documents it as lockfile-root-relative. Hosts that treat resolvedDir
as a safe relative path may mis-handle path joins or project identification due to this mismatch.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[R1897-1903]

+        let dir = match &result_inner.resolution {
+            pacquet_lockfile::LockfileResolution::Directory(directory_resolution) => {
+                Some(directory_resolution.directory.clone())
+            }
+            _ => None,
+        };
+        let hook_ctx = pacquet_hooks::HookContext { log, dir };
Evidence
The resolver now forwards DirectoryResolution.directory into HookContext.dir, but the local
resolver explicitly describes and constructs dependency_path as absolute for link: dependencies,
and tests use an absolute DirectoryResolution.directory. This contradicts the new N-API docs that
state it is lockfile-root-relative.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1890-1907]
pnpm/crates/resolving-local-resolver/src/parse_bare_specifier.rs[23-33]
pnpm/crates/resolving-local-resolver/src/parse_bare_specifier.rs[156-165]
pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs[19-21]
pnpm/npm/napi/index.d.ts[62-71]
pnpm/crates/hooks/src/lib.rs[31-44]

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

## Issue description
`resolvedDir` is exported to the Node-API `readPackage` hook as `HookContext.dir`, and is documented as lockfile-root-relative. However, the underlying source (`DirectoryResolution.directory`) can be absolute (e.g. `link:`) or include `..` segments, so the exported value does not actually match the documented/safe-to-join contract.

## Issue Context
- `DirectoryResolution.directory` is used as a lockfile addressing field and can legitimately be absolute for some local dependency shapes.
- The new Node-API API docs currently imply it is always relative to the lockfile root, which can lead host implementations to do unsafe `join(lockfileRoot, resolvedDir)` style path handling.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1894-1903]
- pnpm/crates/hooks/src/lib.rs[31-44]
- pnpm/npm/napi/index.d.ts[62-71]
- pnpm/crates/napi/src/hooks.rs[36-75]

### Suggested fix direction
Pick one (or both):
1) **Enforce the documented invariant** before setting `HookContext.dir` for the N-API hook: only set it when it is a *normalized, lockfile-root-relative* path (reject/omit when `Path::is_absolute()` or when components contain `ParentDir`).
2) **Update docs/comments** to match reality: describe it as "the lockfile `DirectoryResolution.directory` string" and explicitly state it may be absolute / may contain `..` and must be treated as untrusted input (not safe to join without validation).

ⓘ 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 d94a68a

Results up to commit a437bd5


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


Action required
1. Missing changeset for @pnpm/napi ✗ Dismissed 📘 Rule violation § Compliance
Description
This PR changes the published TypeScript surface of @pnpm/napi by extending ReadPackageHook to
accept resolvedDir, but no corresponding changeset is included. Without a changeset, the release
tooling may not publish/communicate this user-visible API change correctly.
Code

pnpm/npm/napi/index.d.ts[R62-71]

+/**
+ * A synchronous `readPackage` hook applied to resolved dependency manifests.
+ *
+ * `resolvedDir` is set when the manifest came from a directory resolution (an
+ * injected workspace project or a `file:` dependency); it is the directory
+ * recorded in the lockfile, relative to the lockfile root. Hosts use it to
+ * recognize a workspace project's dependency instance and substitute the
+ * project's raw manifest.
+ */
+export type ReadPackageHook = (manifest: PackageManifest, resolvedDir?: string) => PackageManifest
Evidence
The PR modifies the @pnpm/napi TypeScript API by changing ReadPackageHook to `(manifest,
resolvedDir?) => ..., and @pnpm/napi` is a published package. The repository is configured to use
Changesets, so this TypeScript package change requires a changeset entry.

Rule 713441: Require changeset for TypeScript package changes
pnpm/npm/napi/index.d.ts[62-71]
pnpm/npm/napi/package.json[1-32]
.changeset/config.json[1-9]

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 published TypeScript package (`@pnpm/napi`) has a user-visible API change (`ReadPackageHook` now receives an optional `resolvedDir`) but the PR does not include a changeset entry for it.

## Issue Context
This repo uses Changesets for release notes/versioning, and `@pnpm/napi` is a published package. The new optional parameter should be captured in a `.changeset/*.md` file with an appropriate bump type (likely `patch` since it is backwards-compatible and fixes host hook behavior).

## Fix Focus Areas
- pnpm/npm/napi/index.d.ts[62-71]
- pnpm/npm/napi/package.json[1-32]
- .changeset/config.json[1-9]

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



Remediation recommended
2. resolvedDir contract mismatch 🐞 Bug ⛨ Security
Description
HookContext.dir is populated from LockfileResolution::Directory.directory, but that field is not
guaranteed to be lockfile-root-relative (it can be absolute for link: deps or contain ..), while
the N-API TypeScript contract documents it as lockfile-root-relative. Hosts that treat resolvedDir
as a safe relative path may mis-handle path joins or project identification due to this mismatch.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[R1897-1903]

+        let dir = match &result_inner.resolution {
+            pacquet_lockfile::LockfileResolution::Directory(directory_resolution) => {
+                Some(directory_resolution.directory.clone())
+            }
+            _ => None,
+        };
+        let hook_ctx = pacquet_hooks::HookContext { log, dir };
Evidence
The resolver now forwards DirectoryResolution.directory into HookContext.dir, but the local
resolver explicitly describes and constructs dependency_path as absolute for link: dependencies,
and tests use an absolute DirectoryResolution.directory. This contradicts the new N-API docs that
state it is lockfile-root-relative.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1890-1907]
pnpm/crates/resolving-local-resolver/src/parse_bare_specifier.rs[23-33]
pnpm/crates/resolving-local-resolver/src/parse_bare_specifier.rs[156-165]
pnpm/crates/package-manager/src/link_hoisted_modules/tests.rs[19-21]
pnpm/npm/napi/index.d.ts[62-71]
pnpm/crates/hooks/src/lib.rs[31-44]

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

## Issue description
`resolvedDir` is exported to the Node-API `readPackage` hook as `HookContext.dir`, and is documented as lockfile-root-relative. However, the underlying source (`DirectoryResolution.directory`) can be absolute (e.g. `link:`) or include `..` segments, so the exported value does not actually match the documented/safe-to-join contract.

## Issue Context
- `DirectoryResolution.directory` is used as a lockfile addressing field and can legitimately be absolute for some local dependency shapes.
- The new Node-API API docs currently imply it is always relative to the lockfile root, which can lead host implementations to do unsafe `join(lockfileRoot, resolvedDir)` style path handling.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1894-1903]
- pnpm/crates/hooks/src/lib.rs[31-44]
- pnpm/npm/napi/index.d.ts[62-71]
- pnpm/crates/napi/src/hooks.rs[36-75]

### Suggested fix direction
Pick one (or both):
1) **Enforce the documented invariant** before setting `HookContext.dir` for the N-API hook: only set it when it is a *normalized, lockfile-root-relative* path (reject/omit when `Path::is_absolute()` or when components contain `ParentDir`).
2) **Update docs/comments** to match reality: describe it as "the lockfile `DirectoryResolution.directory` string" and explicitly state it may be absolute / may contain `..` and must be treated as untrusted input (not safe to join without validation).

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


Qodo Logo

Comment thread pnpm/npm/napi/index.d.ts Resolved

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

🧹 Nitpick comments (1)
pnpm/crates/hooks/src/lib.rs (1)

34-43: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Trim TS engine implementation detail from the dir rustdoc.

Lines 39-40 ("pnpm's TS engine reaches the same effect by keeping raw project manifests and applying its hook chain contextually") describe how the TypeScript pnpm engine works internally. Per the coding guidelines, comments should avoid describing past implementation history, and per CODE_STYLE_GUIDE.md, doc comments should state the contract once. The contract is already fully covered by the surrounding text (what dir is, when it's set, how hosts use it, and the .pnpmfile.cjs exception).

♻️ Proposed refactor
 pub struct HookContext {
     pub log: Arc<dyn Fn(String) + Send + Sync>,
     /// Lockfile-root-relative directory of the resolution, set when the
     /// manifest being transformed was resolved from a local directory (an
     /// injected workspace project or a `file:` dependency). A host-supplied
     /// `readPackage` callback uses it to recognize a workspace project's
     /// dependency instance and substitute the project's raw manifest.
-    /// — pnpm's TS engine reaches the same effect by keeping raw project
-    /// manifests and applying its hook chain contextually. Only the
-    /// node-API bridge forwards it to JS; the `.pnpmfile.cjs` contract
-    /// (`readPackage(pkg, context)`) has no directory, matching pnpm.
+    /// Only the node-API bridge forwards it to JS; the `.pnpmfile.cjs`
+    /// contract (`readPackage(pkg, context)`) has no directory, matching pnpm.
     pub dir: Option<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 `@pnpm/crates/hooks/src/lib.rs` around lines 34 - 43, Trim the rustdoc on the
dir field by removing the sentence describing the TypeScript pnpm engine’s
internal implementation. Preserve the remaining contract documentation covering
what dir represents, when it is set, host usage, and the .pnpmfile.cjs
exception.

Sources: Coding guidelines, 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.

Nitpick comments:
In `@pnpm/crates/hooks/src/lib.rs`:
- Around line 34-43: Trim the rustdoc on the dir field by removing the sentence
describing the TypeScript pnpm engine’s internal implementation. Preserve the
remaining contract documentation covering what dir represents, when it is set,
host usage, and the .pnpmfile.cjs exception.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b02bde5-2c10-4aa4-9344-c1d0db364f1f

📥 Commits

Reviewing files that changed from the base of the PR and between 252f15e and a437bd5.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (9)
  • pnpm/crates/cli/src/config_deps.rs
  • pnpm/crates/hooks/src/lib.rs
  • pnpm/crates/hooks/tests/node_hooks.rs
  • pnpm/crates/napi/src/hooks.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/resolving-deps-resolver/Cargo.toml
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/resolving-deps-resolver/src/tests.rs
  • pnpm/npm/napi/index.d.ts

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Add Default for HookContext

Implement Default for HookContext to reduce boilerplate.

pnpm/crates/hooks/src/lib.rs [32-44]

-pub struct HookContext {
-    pub log: Arc<dyn Fn(String) + Send + Sync>,
-    pub dir: Option<String>,
+impl Default for HookContext {
+    fn default() -> Self {
+        HookContext {
+            log: Arc::new(|_| {}),
+            dir: None,
+        }
+    }
 }
  • Apply / Chat
Suggestion importance[1-10]: 2

__

Why: While providing a Default implementation could reduce test boilerplate, using a silent logger as a default in production code might suppress important logs if used unintentionally.

Low
  • More

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

github-actions Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.01      6.8±0.16ms   635.3 KB/sec    1.00      6.7±0.06ms   644.5 KB/sec

@codecov-commenter

codecov-commenter commented Jul 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.58%. Comparing base (bcb8b5a) to head (d94a68a).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12936      +/-   ##
==========================================
+ Coverage   85.45%   85.58%   +0.12%     
==========================================
  Files         474      475       +1     
  Lines       74555    74718     +163     
==========================================
+ Hits        63714    63945     +231     
+ Misses      10841    10773      -68     

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

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: a437bd52d468

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.136 ± 0.137 3.914 4.293 1.89 ± 0.13
pacquet@main 4.102 ± 0.196 3.909 4.460 1.87 ± 0.14
pnpr@HEAD 2.207 ± 0.169 2.012 2.472 1.01 ± 0.10
pnpr@main 2.193 ± 0.133 2.035 2.382 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.136408743740001,
      "stddev": 0.13747459863330458,
      "median": 4.173516725040001,
      "user": 3.9348695399999998,
      "system": 3.4413608599999996,
      "min": 3.9138196455400003,
      "max": 4.29322921254,
      "times": [
        4.29322921254,
        4.03294013854,
        4.26495412454,
        4.19650806154,
        4.25541325754,
        4.04651421554,
        4.24776147454,
        3.96242191854,
        3.9138196455400003,
        4.15052538854
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.102285383540001,
      "stddev": 0.19623251727248697,
      "median": 4.02671345204,
      "user": 3.9431406399999993,
      "system": 3.4577708599999992,
      "min": 3.90948433854,
      "max": 4.45982977254,
      "times": [
        4.01803841354,
        4.2567773755400005,
        4.03538849054,
        4.21086087454,
        3.95760154954,
        3.90948433854,
        3.91764194854,
        4.45982977254,
        3.9312424735400002,
        4.32598859854
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.2070192983399997,
      "stddev": 0.1690960294058743,
      "median": 2.19036619404,
      "user": 2.76075284,
      "system": 2.93339146,
      "min": 2.01208695454,
      "max": 2.47236287554,
      "times": [
        2.34872973854,
        2.06258801254,
        2.32396018854,
        2.10781066154,
        2.37561345654,
        2.01208695454,
        2.27292172654,
        2.06340478954,
        2.47236287554,
        2.03071457954
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.19253876794,
      "stddev": 0.13318162814160392,
      "median": 2.13187647604,
      "user": 2.7536162400000004,
      "system": 2.9553527599999994,
      "min": 2.03464903754,
      "max": 2.38164992954,
      "times": [
        2.06689395954,
        2.15167943954,
        2.38164992954,
        2.10619471454,
        2.37784194054,
        2.30406067554,
        2.2970780465400003,
        2.11207351254,
        2.09326642354,
        2.03464903754
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 657.4 ± 13.6 631.8 674.1 1.00
pacquet@main 672.9 ± 35.9 632.3 762.5 1.02 ± 0.06
pnpr@HEAD 744.4 ± 47.7 699.5 865.8 1.13 ± 0.08
pnpr@main 766.9 ± 95.3 697.7 1027.0 1.17 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6573994377600001,
      "stddev": 0.013622832495791938,
      "median": 0.66279410866,
      "user": 0.38723904,
      "system": 1.3383877800000001,
      "min": 0.63179356266,
      "max": 0.67405677866,
      "times": [
        0.64115891166,
        0.63179356266,
        0.66167492766,
        0.6626302966600001,
        0.6640466056600001,
        0.66547482166,
        0.66686556766,
        0.67405677866,
        0.66295792066,
        0.64333498466
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.67287311266,
      "stddev": 0.035888668831177015,
      "median": 0.66204734266,
      "user": 0.40337123999999996,
      "system": 1.33347788,
      "min": 0.63232365566,
      "max": 0.76248854566,
      "times": [
        0.6576930816600001,
        0.68106353966,
        0.64806237166,
        0.63232365566,
        0.65224679066,
        0.65914228966,
        0.68271735966,
        0.6649523956600001,
        0.76248854566,
        0.68804109666
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.74440344376,
      "stddev": 0.04772971150780814,
      "median": 0.72853049916,
      "user": 0.4039062400000001,
      "system": 1.40085598,
      "min": 0.6994629196600001,
      "max": 0.8658004796600001,
      "times": [
        0.71679085866,
        0.72801856266,
        0.71748920366,
        0.6994629196600001,
        0.73652961266,
        0.7184748496600001,
        0.8658004796600001,
        0.77210341066,
        0.72904243566,
        0.76032210466
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.7668553078599999,
      "stddev": 0.09532904453263889,
      "median": 0.74135894016,
      "user": 0.42055944,
      "system": 1.41585188,
      "min": 0.6977222576600001,
      "max": 1.02699184766,
      "times": [
        0.7467701276600001,
        0.75274237066,
        0.76455697166,
        0.73594775266,
        0.73333867066,
        0.6977222576600001,
        0.7167445196600001,
        0.78774564966,
        1.02699184766,
        0.70599291066
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.372 ± 0.066 4.278 4.477 1.97 ± 0.12
pacquet@main 4.312 ± 0.049 4.261 4.408 1.95 ± 0.11
pnpr@HEAD 2.216 ± 0.128 2.067 2.426 1.00
pnpr@main 2.224 ± 0.146 2.039 2.486 1.00 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.37163300714,
      "stddev": 0.06580030059006803,
      "median": 4.3723859130400005,
      "user": 3.8993290000000003,
      "system": 3.3573010400000003,
      "min": 4.27832394904,
      "max": 4.47664849504,
      "times": [
        4.41963004804,
        4.47664849504,
        4.37955283704,
        4.27832394904,
        4.29955243604,
        4.41497680204,
        4.36521898904,
        4.30592271904,
        4.33885456304,
        4.43764923304
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.31205193654,
      "stddev": 0.04913226680732316,
      "median": 4.30165224154,
      "user": 3.8639316,
      "system": 3.34188404,
      "min": 4.26050883804,
      "max": 4.40755703104,
      "times": [
        4.26337056004,
        4.26050883804,
        4.40755703104,
        4.30421486204,
        4.29495498704,
        4.27061863704,
        4.38360207104,
        4.32672836304,
        4.3098743950400005,
        4.29908962104
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.21588217094,
      "stddev": 0.12849291000975613,
      "median": 2.17377365354,
      "user": 2.5989671000000003,
      "system": 2.87251004,
      "min": 2.06686546404,
      "max": 2.42563082604,
      "times": [
        2.06686546404,
        2.18664148104,
        2.22741832304,
        2.13855190804,
        2.38316412104,
        2.10710431204,
        2.35798491304,
        2.42563082604,
        2.16090582604,
        2.10455453504
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.22423291524,
      "stddev": 0.14554709876151223,
      "median": 2.19656936104,
      "user": 2.5991935000000006,
      "system": 2.87433744,
      "min": 2.03944916604,
      "max": 2.48570264804,
      "times": [
        2.15551663004,
        2.37107702104,
        2.34237179604,
        2.03944916604,
        2.12148062104,
        2.29029367604,
        2.48570264804,
        2.23762209204,
        2.12802837904,
        2.07078712304
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.426 ± 0.032 1.384 1.484 2.12 ± 0.05
pacquet@main 1.441 ± 0.037 1.379 1.509 2.15 ± 0.06
pnpr@HEAD 0.672 ± 0.008 0.659 0.683 1.00
pnpr@main 0.684 ± 0.012 0.663 0.707 1.02 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.4256090577,
      "stddev": 0.03215252366032874,
      "median": 1.4168212479,
      "user": 1.36357988,
      "system": 1.7387381599999998,
      "min": 1.3842780044,
      "max": 1.4835256444,
      "times": [
        1.4835256444,
        1.4506787764,
        1.4569180663999999,
        1.4229715024,
        1.4458677994,
        1.3937427564,
        1.4067483194,
        1.3842780044,
        1.4106709934,
        1.4006887144
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.4409634936000002,
      "stddev": 0.037302219260985654,
      "median": 1.4455046773999998,
      "user": 1.4114177799999998,
      "system": 1.7223012599999996,
      "min": 1.3793615844,
      "max": 1.5086275454,
      "times": [
        1.4747932534,
        1.5086275454,
        1.4542480654,
        1.4156690704,
        1.4504207524,
        1.3793615844,
        1.4208164323999999,
        1.4046958444,
        1.4405886023999999,
        1.4604137853999999
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6715345442,
      "stddev": 0.00760377737901843,
      "median": 0.6715633679000002,
      "user": 0.34298298000000005,
      "system": 1.27365736,
      "min": 0.6585460414000001,
      "max": 0.6826972994000001,
      "times": [
        0.6751325124,
        0.6679937164,
        0.6798261674000001,
        0.6769187714000001,
        0.6826972994000001,
        0.6711319814000001,
        0.6695440694000001,
        0.6719947544000001,
        0.6585460414000001,
        0.6615601284000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6836771249000002,
      "stddev": 0.012399440426994294,
      "median": 0.6842068504000001,
      "user": 0.35795878000000003,
      "system": 1.29766776,
      "min": 0.6626586664000002,
      "max": 0.7071330944,
      "times": [
        0.6841777964000001,
        0.6793181794,
        0.6777348444000001,
        0.6911040634000001,
        0.6937103374000001,
        0.6862322094000001,
        0.7071330944,
        0.6842359044000002,
        0.6626586664000002,
        0.6704661534
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.125 ± 0.049 3.060 3.199 4.63 ± 0.10
pacquet@main 3.145 ± 0.071 3.045 3.295 4.66 ± 0.13
pnpr@HEAD 0.675 ± 0.011 0.658 0.686 1.00
pnpr@main 0.694 ± 0.018 0.681 0.739 1.03 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.1250486810199996,
      "stddev": 0.04873658528682151,
      "median": 3.1136300494199998,
      "user": 1.8145338600000003,
      "system": 2.0275327399999994,
      "min": 3.0604621424199996,
      "max": 3.1987313984199996,
      "times": [
        3.1926962884199996,
        3.0604621424199996,
        3.1143776114199997,
        3.09504254142,
        3.0644896334199996,
        3.11288248742,
        3.1352487014199997,
        3.1692360804199997,
        3.1073199254199997,
        3.1987313984199996
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.1445634501199997,
      "stddev": 0.07136812391532943,
      "median": 3.1452746764199997,
      "user": 1.8626192599999996,
      "system": 2.01861244,
      "min": 3.0447261654199997,
      "max": 3.2945038644199998,
      "times": [
        3.2945038644199998,
        3.20014482542,
        3.0745358914199996,
        3.0447261654199997,
        3.09948715042,
        3.1618310954199997,
        3.17726846942,
        3.1344284004199996,
        3.15612095242,
        3.1025876864199997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6751782264200001,
      "stddev": 0.010550368082863306,
      "median": 0.6774107649200001,
      "user": 0.34122076,
      "system": 1.2867403400000001,
      "min": 0.6577303254200001,
      "max": 0.6857707164200001,
      "times": [
        0.67000034042,
        0.68533878142,
        0.6821405314200001,
        0.6625585954200001,
        0.68421791342,
        0.6845868044200001,
        0.6857707164200001,
        0.6726809984200001,
        0.6577303254200001,
        0.66675725742
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6939635740199999,
      "stddev": 0.017856412997058695,
      "median": 0.68885903642,
      "user": 0.37172816,
      "system": 1.2935088399999999,
      "min": 0.6807937634200001,
      "max": 0.73903369442,
      "times": [
        0.6807937634200001,
        0.6953330724200001,
        0.6921278094200001,
        0.6922762424200001,
        0.68232470842,
        0.68235121342,
        0.6855902634200001,
        0.6823600484200001,
        0.7074449244200001,
        0.73903369442
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 712.1 ± 16.1 688.6 738.9 6.35 ± 0.15
pacquet@main 733.4 ± 19.6 699.1 759.6 6.54 ± 0.18
pnpr@HEAD 112.1 ± 0.7 110.5 113.4 1.00
pnpr@main 112.2 ± 1.1 109.9 114.6 1.00 ± 0.01
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7121171958200001,
      "stddev": 0.016104394015990082,
      "median": 0.71199371322,
      "user": 0.66531422,
      "system": 0.1604266,
      "min": 0.68859340422,
      "max": 0.73887892022,
      "times": [
        0.7130837762200001,
        0.69773140922,
        0.71090365022,
        0.68859340422,
        0.69287379922,
        0.7263009462200001,
        0.71429739922,
        0.73887892022,
        0.72866520922,
        0.70984344422
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.73337844162,
      "stddev": 0.01960075097639537,
      "median": 0.73308949372,
      "user": 0.6886043199999999,
      "system": 0.1583428,
      "min": 0.69911847222,
      "max": 0.75961416922,
      "times": [
        0.69911847222,
        0.71500585522,
        0.73124275322,
        0.74191197222,
        0.75961416922,
        0.73493623422,
        0.74921282722,
        0.7572420562200001,
        0.7146210992200001,
        0.7308789772200001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.11213991834499999,
      "stddev": 0.0006902886851278272,
      "median": 0.11216559322000001,
      "user": 0.027797561666666665,
      "system": 0.02258755833333333,
      "min": 0.11054965322000002,
      "max": 0.11340190722000001,
      "times": [
        0.11132951222000001,
        0.11054965322000002,
        0.11310016222000001,
        0.11193257422000001,
        0.11149256522,
        0.11215531422000001,
        0.11198448522000001,
        0.11301070222000001,
        0.11179355922000002,
        0.11270589522000002,
        0.11246290122000001,
        0.11185524222000001,
        0.11204382422000002,
        0.11265147422000002,
        0.11242169922000002,
        0.11236051822000001,
        0.11217587222000001,
        0.11340190722000001,
        0.11287966622000001,
        0.11076960622000001,
        0.11238554622000001,
        0.11164327422000002,
        0.11176822222000002,
        0.11248386322000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.11215088109500003,
      "stddev": 0.0010775095026914494,
      "median": 0.11207094022000001,
      "user": 0.027744061666666663,
      "system": 0.022898016666666663,
      "min": 0.10987917422000001,
      "max": 0.11464250522000001,
      "times": [
        0.11181111622,
        0.11166529822000001,
        0.11245673322000001,
        0.11210131122000001,
        0.11204056922000001,
        0.11278784822000001,
        0.11194717922000001,
        0.10997170222000001,
        0.11212076022000002,
        0.11191374922000001,
        0.11278158822,
        0.11303305522000001,
        0.11330628522000001,
        0.11114540422000001,
        0.11130652122000001,
        0.11225158622000002,
        0.11177035522000002,
        0.11175783622000002,
        0.11276233522000001,
        0.11391967322000002,
        0.11123716722000002,
        0.11301139222,
        0.11464250522000001,
        0.10987917422000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 6.820 ± 0.137 6.643 7.107 1.37 ± 0.04
pacquet@main 6.831 ± 0.097 6.670 6.994 1.38 ± 0.04
pnpr@HEAD 4.962 ± 0.106 4.819 5.118 1.00
pnpr@main 5.100 ± 0.178 4.843 5.368 1.03 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 6.820363642779999,
      "stddev": 0.1368933937185568,
      "median": 6.83236407908,
      "user": 4.11505906,
      "system": 3.66898866,
      "min": 6.64287777908,
      "max": 7.107051243080001,
      "times": [
        6.64287777908,
        6.87663521508,
        7.107051243080001,
        6.86134430608,
        6.888701144080001,
        6.81350972608,
        6.8160741830800005,
        6.705791392080001,
        6.6429974640800005,
        6.84865397508
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 6.8305896732799996,
      "stddev": 0.09655098452688392,
      "median": 6.81919125808,
      "user": 4.1073673600000005,
      "system": 3.6874810600000005,
      "min": 6.669606644080001,
      "max": 6.993976984080001,
      "times": [
        6.96644059808,
        6.85597647308,
        6.993976984080001,
        6.669606644080001,
        6.739392581080001,
        6.85242234008,
        6.78482163608,
        6.80543186908,
        6.8048769600800005,
        6.8329506470800006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 4.961797213780001,
      "stddev": 0.10627476568034148,
      "median": 4.93968939358,
      "user": 2.87964656,
      "system": 3.13705106,
      "min": 4.818770128080001,
      "max": 5.11831793208,
      "times": [
        4.926239216080001,
        4.818770128080001,
        5.1168242600800005,
        4.95313957108,
        4.83901125008,
        5.03233221208,
        4.90595988208,
        5.017012855080001,
        5.11831793208,
        4.89036483108
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 5.099629034980001,
      "stddev": 0.17772349955125455,
      "median": 5.057052946580001,
      "user": 2.89145466,
      "system": 3.13789586,
      "min": 4.842642152080001,
      "max": 5.36786718108,
      "times": [
        5.280128767080001,
        4.95589652708,
        5.161224601080001,
        4.9590918330800005,
        4.987083330080001,
        5.07865567708,
        5.328250065080001,
        4.842642152080001,
        5.03545021608,
        5.36786718108
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12936
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,371.63 ms
(+1.86%)Baseline: 4,291.72 ms
5,150.06 ms
(84.89%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,125.05 ms
(+3.45%)Baseline: 3,020.75 ms
3,624.90 ms
(86.21%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,425.61 ms
(+4.89%)Baseline: 1,359.12 ms
1,630.95 ms
(87.41%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
712.12 ms
(+11.41%)Baseline: 639.21 ms
767.05 ms
(92.84%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
4,136.41 ms
(-0.06%)Baseline: 4,138.96 ms
4,966.75 ms
(83.28%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
6,820.36 ms
(-7.26%)Baseline: 7,354.09 ms
8,824.91 ms
(77.29%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
657.40 ms
(+1.19%)Baseline: 649.67 ms
779.60 ms
(84.33%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12936
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,215.88 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
675.18 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
671.53 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
112.14 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,207.02 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
4,961.80 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
744.40 ms
🐰 View full continuous benchmarking report in Bencher

cargo fmt over the HookContext call sites, a type alias for the
recorded-calls Arc to satisfy clippy::type_complexity, and doc-comment
trims from review: drop the TS-engine rationale from the HookContext.dir
rustdoc and shrink the resolver test's doc comment to the non-obvious why.

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

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 d94a68a

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

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

@zkochan
zkochan merged commit 3e01bc5 into main Jul 11, 2026
34 checks passed
@zkochan
zkochan deleted the feat/read-package-hook-project-dir branch July 11, 2026 22:02
zkochan added a commit to zkochan/bit that referenced this pull request Jul 12, 2026
Carries the merged readPackage resolvedDir hook (pnpm/pnpm#12936) plus the
hoisted-peer range fix (pnpm/pnpm#12932). The resolvedDir hook resolves the
injected workspace-sibling failures under BIT_FEATURES=deps-graph — the
deps-graph e2e suite drops from 3 failing to 1. The remaining failure is the
separate lockfile resolution-reuse gap, not the manifest-injection path.

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