Repository navigation
fix(pacquet): napi resolveDependency resolver chain + root-component member reachability - #12849
Conversation
`resolveDependency` in the `@pnpm/napi` binding built a bare `NpmResolver`, so any non-npm specifier (a folder path, git URL, `file:` / `link:` / `workspace:` spec, `http(s)` tarball URL, or `<alias>:` named-registry spec) errored with "the specifier was not claimed by the npm resolver". Bit's `resolveRemoteVersion` passes exactly these shapes and expects a manifest back. Mirror the install path's `DefaultResolver` chain (`install_with_fresh_lockfile.rs`): npm -> git -> tarball -> localScheme -> node -> deno -> bun -> namedRegistry -> localPath. The single-resolve path runs the tarball resolver without a fetch context (there is no install store to extract into), and omits the pnpmfile custom resolvers (an install-time concern); everything else matches the install chain, so a folder path resolves to its manifest, a `file:` / `link:` spec resolves to its directory, a git URL pins a commit, and a normal npm spec still resolves as before. An unclaimed spec now surfaces the chain's `SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER` diagnostic. Adds offline unit tests covering the `file:` / `link:` directory cases and the no-resolver-claimed error.
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR expands N-API dependency resolution from npm-only to a multi-resolver install chain (git, tarball, local, node/deno/bun runtimes, named-registry) via ChangesResolver chain implementation
Root-component cross-linking
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant resolveDependency
participant DefaultResolver
participant ProtocolResolvers as Git/Tarball/Local/Runtime resolvers
participant NpmResolver
resolveDependency->>DefaultResolver: build ordered resolver chain
DefaultResolver->>ProtocolResolvers: attempt claim on wanted spec
ProtocolResolvers->>NpmResolver: reuse shared npm resolver metadata (node/deno/bun)
DefaultResolver-->>resolveDependency: resolved manifest or SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER
sequenceDiagram
participant InstallFlow as install flow
participant PackageManifest
participant LinkRootComponentMembers as link_root_component_members
participant VirtualStoreLayout
participant FileSystem as filesystem
InstallFlow->>PackageManifest: read installConfig.hoistingLimits
InstallFlow->>LinkRootComponentMembers: pass root component importer ids
LinkRootComponentMembers->>VirtualStoreLayout: collect member slot paths
LinkRootComponentMembers->>FileSystem: create sibling symlinks (skip existing/self)
LinkRootComponentMembers-->>InstallFlow: return success or symlink error
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoFix NAPI resolveDependency to support non-npm specifiers via DefaultResolver chain
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
51 rules 1.
|
| let git_resolver = GitResolver::new( | ||
| Arc::new(RealGitProbe::new(Arc::clone(&http_client))), | ||
| Arc::new(RealGitRunner::new()), | ||
| ); | ||
|
|
||
| // No fetch context on the single-resolve path: there's no install | ||
| // store to extract into, so an `http(s)` tarball is claimed with its | ||
| // normalized URL but no bundled manifest / integrity (see the module | ||
| // docs). The install path wires the full [`TarballFetchContext`]. | ||
| let tarball_resolver = | ||
| TarballResolver { http_client: Arc::clone(&http_client), fetch_context: None }; | ||
|
|
||
| // `preserveAbsolutePaths` isn't exposed by pacquet's `Config` yet, so | ||
| // the local-resolver context defaults to `false` here — same as the | ||
| // install path. | ||
| let local_ctx = LocalResolverContext { preserve_absolute_paths: false }; | ||
| let local_scheme_resolver = LocalSchemeResolver::new(local_ctx); | ||
| let local_path_resolver = LocalPathResolver::new(local_ctx); | ||
|
|
||
| let mut node_resolver = NodeResolver::new(Arc::clone(&http_client)); | ||
| node_resolver.offline = config.offline; | ||
| let deno_resolver = DenoResolver::new(Arc::clone(&http_client), Arc::clone(&npm_resolver)); | ||
| let bun_resolver = BunResolver::new(Arc::clone(&http_client), Arc::clone(&npm_resolver)); | ||
|
|
||
| // User-supplied named-registry aliases from | ||
| // `pnpm-workspace.yaml#namedRegistries`, merged with pacquet's | ||
| // built-ins (today: `gh:` → GitHub Packages). A malformed URL here | ||
| // fails fast with `ERR_PNPM_INVALID_NAMED_REGISTRY_URL`, matching the | ||
| // install path. | ||
| let user_named_registries: HashMap<String, String> = | ||
| config.named_registries.iter().map(|(name, url)| (name.clone(), url.clone())).collect(); | ||
| let merged_named_registries = | ||
| merge_named_registries(&user_named_registries).map_err(|error| to_napi_error(&error))?; | ||
| let named_registry_aliases: HashSet<String> = merged_named_registries.keys().cloned().collect(); | ||
| let named_registry_resolver = NamedRegistryResolver { | ||
| named_registries: merged_named_registries, | ||
| registry_names: named_registry_aliases, | ||
| http_client: Arc::clone(&http_client), | ||
| auth_headers: Arc::clone(&config.auth_headers), | ||
| meta_cache: shared_in_memory_cache(), | ||
| fetch_locker: shared_packument_fetch_locker(), | ||
| picked_manifest_cache: shared_picked_manifest_cache(), | ||
| cache_dir: Some(config.cache_dir.clone()), | ||
| offline: config.offline, | ||
| prefer_offline: config.prefer_offline, | ||
| ignore_missing_time_field: config.minimum_release_age_ignore_missing_time, | ||
| full_metadata, | ||
| filter_metadata: full_metadata, | ||
| retry_opts, | ||
| }; | ||
|
|
||
| // Chain order mirrors the install path | ||
| // (`install_with_fresh_lockfile.rs`): npm → git → tarball → | ||
| // localScheme → node → deno → bun → namedRegistry → localPath. The | ||
| // local-resolver split (scheme before the runtimes, path last) lets a | ||
| // `<alias>:@scope/pkg` named-registry specifier reach the | ||
| // named-registry resolver instead of being claimed by the path-shape | ||
| // detector on the strength of its embedded `/`. | ||
| let chain: Vec<Box<dyn Resolver>> = vec![ | ||
| Box::new(ArcResolver(Arc::clone(&npm_resolver))), | ||
| Box::new(git_resolver), | ||
| Box::new(tarball_resolver), | ||
| Box::new(local_scheme_resolver), | ||
| Box::new(node_resolver), | ||
| Box::new(deno_resolver), | ||
| Box::new(bun_resolver), | ||
| Box::new(named_registry_resolver), | ||
| Box::new(local_path_resolver), | ||
| ]; |
There was a problem hiding this comment.
2. Offline option bypassed 🐞 Bug ⛨ Security
resolveDependency accepts offline: true but the added git/tarball/deno/bun resolvers can still perform network access because they are not gated by config.offline and their implementations don’t consult ResolveOptions for offline behavior. This can trigger unexpected outbound requests/timeouts in offline CI/air-gapped environments and breaks the unit-test assumption that offline: true prevents any network escape.
Agent Prompt
## Issue description
`resolveDependency` exposes an `offline` option, but the new resolver chain still performs outbound network and git subprocess operations for non-npm specifiers (git URLs, http(s) tarball URLs, deno/bun runtime specs). This violates the implied contract that `offline: true` prevents any network access and can cause unexpected SSRF-like outbound calls and flaky failures in offline environments.
## Issue Context
- In `run_resolve_blocking`, `config.offline` is applied to `NpmResolver`, `NamedRegistryResolver`, and `NodeResolver` only.
- `TarballResolver` (with `fetch_context: None`) still issues an HTTP `HEAD`.
- `GitResolver` probes via HTTP and runs `git ls-remote`.
- `DenoResolver`/`BunResolver` fetch runtime assets over HTTP and do not check offline.
## Fix Focus Areas
- pacquet/crates/napi/src/resolve.rs[137-238]
- pacquet/crates/resolving-tarball-resolver/src/tarball_resolver.rs[83-159]
- pacquet/crates/resolving-git-resolver/src/git_resolver.rs[58-71]
- pacquet/crates/resolving-git-resolver/src/runners.rs[38-71]
- pacquet/crates/engine-runtime-deno-resolver/src/deno_resolver.rs[74-126]
- pacquet/crates/engine-runtime-bun-resolver/src/bun_resolver.rs[68-119]
## What to change
1. Ensure `offline: true` prevents *all* outbound network/subprocess activity from `resolveDependency`.
- Option A (localized to NAPI): pre-parse the wanted dependency in `run_resolve_blocking` and if `config.offline` is true and the specifier is one of {git, http(s) tarball, deno@runtime, bun@runtime}, return a structured offline error before invoking the chain.
- Option B (more correct / reusable): add an `offline` flag (or a richer policy) into `ResolveOptions`, and update git/tarball/deno/bun resolvers to honor it.
- Option C: extend the resolver structs to carry an `offline` boolean and early-error/decline when offline.
2. Add tests in `pacquet/crates/napi/src/resolve/tests.rs` asserting that with `offline: true`, git/tarball/runtime specs fail without making requests (or at least fail fast deterministically).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pacquet/crates/napi/src/resolve/tests.rs (1)
57-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMissing pre-assertion log per style guide.
Both
assert!calls (line 57 and lines 89-93) lack a log statement beforehand. Per the style guide, non-assert_eq!assertions should be preceded by aneprintln!/dbg!so failures are diagnosable.Suggested fix
- assert!(result.normalized_bare_specifier.is_some()); + dbg!(&result.normalized_bare_specifier); + assert!(result.normalized_bare_specifier.is_some());- assert!( + eprintln!("resolve error: {}", error.reason); + assert!( error.reason.contains("isn't supported by any available resolver"), "unexpected error message: {}", error.reason, );As per path instructions,
pacquet/CODE_STYLE_GUIDE.mdstates: "Test logging guidance: log before non-assert_eq!assertions; useeprintln!for multi-line strings anddbg!for complex structures."Also applies to: 89-93
🤖 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/napi/src/resolve/tests.rs` at line 57, The test assertions in the resolve tests are missing the required pre-assertion logging for non-`assert_eq!` checks. Update the affected `assert!` calls in the resolve test module to emit an `eprintln!` or `dbg!` immediately before each assertion, using `dbg!` for the structured result being inspected and `eprintln!` for any multi-line diagnostic text. Keep the assertion logic in place, and apply the same pattern to both the `normalized_bare_specifier` check and the other `assert!` block noted in the review.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/napi/src/resolve.rs`:
- Around line 188-191: The runtime resolvers are ignoring offline state, so
`resolve_impl` and the `DenoResolver`/`BunResolver` setup still allow network
fetches for GitHub release metadata. Thread `config.offline` (or the relevant
`ResolveOptions` offline/prefer-offline state) into the `DenoResolver` and
`BunResolver` paths in `resolve_impl`, and make their metadata fetch logic
short-circuit with the same offline error behavior used by the npm resolver when
offline is enabled.
---
Nitpick comments:
In `@pacquet/crates/napi/src/resolve/tests.rs`:
- Line 57: The test assertions in the resolve tests are missing the required
pre-assertion logging for non-`assert_eq!` checks. Update the affected `assert!`
calls in the resolve test module to emit an `eprintln!` or `dbg!` immediately
before each assertion, using `dbg!` for the structured result being inspected
and `eprintln!` for any multi-line diagnostic text. Keep the assertion logic in
place, and apply the same pattern to both the `normalized_bare_specifier` check
and the other `assert!` block noted in the review.
🪄 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: e76f9cae-b6e8-491e-9e70-48fe765a24ab
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (3)
pacquet/crates/napi/Cargo.tomlpacquet/crates/napi/src/resolve.rspacquet/crates/napi/src/resolve/tests.rs
PR Code Suggestions ✨Latest suggestions up to 8b7739e Warning
Previous suggestionsSuggestions up to commit 7c8fd4f
Suggestions up to commit 5bbed3a
Suggestions up to commit 2565cf1
Suggestions
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12849 +/- ##
==========================================
- Coverage 85.84% 85.31% -0.53%
==========================================
Files 448 451 +3
Lines 69558 70701 +1143
==========================================
+ Hits 59709 60318 +609
- Misses 9849 10383 +534 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.8245643145000003,
"stddev": 0.18107134584651505,
"median": 3.8566136288,
"user": 3.52318548,
"system": 3.3860282400000004,
"min": 3.6071815073,
"max": 4.1818723833,
"times": [
3.8616480993,
3.9618100223,
3.8610058573,
3.7129116913,
4.1818723833,
3.8522214003,
3.6071815073,
3.6110916813,
3.6593876883,
3.9365128143
]
},
{
"command": "pacquet@main",
"mean": 3.7303363126,
"stddev": 0.0991680122242239,
"median": 3.7276072193000003,
"user": 3.5369316799999995,
"system": 3.37113114,
"min": 3.6169244283,
"max": 3.9104485833,
"times": [
3.8266741353000002,
3.9104485833,
3.6366253183,
3.7276818693,
3.6169244283,
3.7275325693,
3.6566187783,
3.8082532833,
3.6211144962999997,
3.7714896642999998
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1469274788999995,
"stddev": 0.1593884730216839,
"median": 2.0767536232999997,
"user": 2.6513191799999998,
"system": 2.9748191399999997,
"min": 1.9718198412999999,
"max": 2.3565487413,
"times": [
2.0141638123,
2.3402292433,
1.9718198412999999,
2.3565487413,
2.3390479953,
2.0715347182999997,
2.0819725282999997,
2.0249270732999998,
1.9984255172999998,
2.2706053183
]
},
{
"command": "pnpr@main",
"mean": 2.1227925497999998,
"stddev": 0.1346539520975523,
"median": 2.1092618493,
"user": 2.6410122799999995,
"system": 3.0040893399999993,
"min": 1.9364168373,
"max": 2.3101655973,
"times": [
2.0960411163,
2.2902899283,
1.9907754663,
1.9364168373,
2.2892132683,
1.9937950173,
2.3101655973,
2.0701511512999997,
2.1285945333,
2.1224825823
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.66105155516,
"stddev": 0.00899851448664815,
"median": 0.6637859008600001,
"user": 0.37363403999999995,
"system": 1.34858264,
"min": 0.64252765986,
"max": 0.6735353418600001,
"times": [
0.6554979498600001,
0.6644510668600001,
0.6528970928600001,
0.6735353418600001,
0.6638614018600001,
0.6703991568600001,
0.6588708068600001,
0.6637103998600001,
0.6647646748600001,
0.64252765986
]
},
{
"command": "pacquet@main",
"mean": 0.6718240568600001,
"stddev": 0.036487891733412645,
"median": 0.66430082836,
"user": 0.39800793999999995,
"system": 1.3381294400000001,
"min": 0.6409610788600001,
"max": 0.7712747248600001,
"times": [
0.6650943798600001,
0.6450743688600001,
0.6596094108600001,
0.6689213008600001,
0.6409610788600001,
0.6611010478600001,
0.7712747248600001,
0.6635072768600001,
0.6756073278600001,
0.6670896518600001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.73277657666,
"stddev": 0.07003615218892793,
"median": 0.7154925913600001,
"user": 0.38662944,
"system": 1.37835354,
"min": 0.6825817298600001,
"max": 0.9208986598600001,
"times": [
0.7435478888600001,
0.68853310186,
0.7227035218600001,
0.7088573358600001,
0.7221278468600001,
0.6825817298600001,
0.7006568758600001,
0.6876207708600001,
0.9208986598600001,
0.7502380348600001
]
},
{
"command": "pnpr@main",
"mean": 0.7014584449599999,
"stddev": 0.03174677894412457,
"median": 0.6955248903600001,
"user": 0.40646924,
"system": 1.35806044,
"min": 0.6679614878600001,
"max": 0.7804623828600001,
"times": [
0.7205689918600001,
0.6794942378600001,
0.69561336786,
0.69910706186,
0.6679614878600001,
0.6954364128600001,
0.6784011688600001,
0.7804623828600001,
0.6878756748600001,
0.70966366286
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.18690668358,
"stddev": 0.027109855208369,
"median": 4.1976728444799996,
"user": 3.71468262,
"system": 3.3872453399999998,
"min": 4.123353391479999,
"max": 4.21083415548,
"times": [
4.202783023479999,
4.20998704548,
4.123353391479999,
4.19977075048,
4.192721393479999,
4.19710946648,
4.198236222479999,
4.1686617544799995,
4.21083415548,
4.16560963248
]
},
{
"command": "pacquet@main",
"mean": 4.205160815879999,
"stddev": 0.03545847379201703,
"median": 4.2133735859799994,
"user": 3.7225622199999995,
"system": 3.3878625399999995,
"min": 4.13640368848,
"max": 4.25819889148,
"times": [
4.21269102948,
4.21719737748,
4.20346481748,
4.13640368848,
4.16059298948,
4.21405614248,
4.25819889148,
4.18894169048,
4.228420789479999,
4.23164074248
]
},
{
"command": "pnpr@HEAD",
"mean": 2.21074026178,
"stddev": 0.10558975098381557,
"median": 2.2422108119799997,
"user": 2.46780892,
"system": 2.9323983399999998,
"min": 2.07816412648,
"max": 2.4188128754799996,
"times": [
2.0804774624799998,
2.2425281764799996,
2.07816412648,
2.24211966748,
2.4188128754799996,
2.2770980124799998,
2.1303994024799997,
2.1332641714799996,
2.24230195648,
2.2622367664799996
]
},
{
"command": "pnpr@main",
"mean": 2.22578932328,
"stddev": 0.142015315811669,
"median": 2.2196950174799994,
"user": 2.4412812199999996,
"system": 2.9257697400000007,
"min": 2.00421905148,
"max": 2.3893661524799996,
"times": [
2.2344594074799997,
2.08667689848,
2.38041519048,
2.00421905148,
2.2049306274799996,
2.3893661524799996,
2.3427543044799997,
2.09781799048,
2.13681006848,
2.38044354148
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3338935416600002,
"stddev": 0.014353998670491978,
"median": 1.33069635706,
"user": 1.29280746,
"system": 1.6847811799999999,
"min": 1.31920513456,
"max": 1.35793721656,
"times": [
1.33567538156,
1.35793721656,
1.34702224556,
1.33120857256,
1.31973903056,
1.32436606656,
1.3201258235600002,
1.3534718035600002,
1.31920513456,
1.33018414156
]
},
{
"command": "pacquet@main",
"mean": 1.36701020336,
"stddev": 0.021533229205900506,
"median": 1.35956790356,
"user": 1.34125696,
"system": 1.6998545799999998,
"min": 1.34199140056,
"max": 1.4009655035600002,
"times": [
1.3444526485600001,
1.35933421756,
1.3583494255600002,
1.39740387256,
1.4009655035600002,
1.38435894756,
1.3761928705600002,
1.34199140056,
1.34725155756,
1.35980158956
]
},
{
"command": "pnpr@HEAD",
"mean": 0.68791300716,
"stddev": 0.10220293007780396,
"median": 0.65800470306,
"user": 0.33234825999999995,
"system": 1.28975308,
"min": 0.6441083675600001,
"max": 0.9783234445600001,
"times": [
0.6591375315600001,
0.6634741375600001,
0.6589227025600001,
0.9783234445600001,
0.6531710765600001,
0.65447738856,
0.66123727856,
0.6570867035600001,
0.6491914405600001,
0.6441083675600001
]
},
{
"command": "pnpr@main",
"mean": 0.6582565912600001,
"stddev": 0.010609023771664696,
"median": 0.6572604720600002,
"user": 0.34319046,
"system": 1.2852425799999998,
"min": 0.64562344656,
"max": 0.68372626156,
"times": [
0.6579485875600001,
0.66261934856,
0.6507509155600001,
0.6565723565600001,
0.65351512556,
0.6600923925600001,
0.6625299695600001,
0.6491875085600001,
0.64562344656,
0.68372626156
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.99868428176,
"stddev": 0.021057689891860167,
"median": 3.0027243396600003,
"user": 1.7397140199999999,
"system": 1.9867304800000003,
"min": 2.96040615566,
"max": 3.03007734666,
"times": [
2.98155127566,
2.97631924866,
3.00070076166,
3.01688702966,
3.00564572166,
3.00474791766,
2.96040615566,
3.01619472966,
3.03007734666,
2.99431263066
]
},
{
"command": "pacquet@main",
"mean": 3.01720397566,
"stddev": 0.024619568256299414,
"median": 3.0156533856600003,
"user": 1.78258202,
"system": 2.0121011799999993,
"min": 2.97627479866,
"max": 3.06419939566,
"times": [
3.00689520766,
2.99453413566,
3.00587918466,
3.06419939566,
3.02691717466,
3.01728820066,
3.02256850066,
3.04346458766,
2.97627479866,
3.0140185706600002
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6650776634600002,
"stddev": 0.01038180176657687,
"median": 0.6650274091600001,
"user": 0.33118572,
"system": 1.2972548799999999,
"min": 0.6535029926600001,
"max": 0.68485110766,
"times": [
0.6535029926600001,
0.6662067586600001,
0.6570781946600001,
0.65377707466,
0.67428535966,
0.66384805966,
0.6552792476600001,
0.67060630166,
0.68485110766,
0.67134153766
]
},
{
"command": "pnpr@main",
"mean": 0.6599391643600001,
"stddev": 0.007834176310177427,
"median": 0.65710487866,
"user": 0.34655241999999997,
"system": 1.28810758,
"min": 0.6522254616600001,
"max": 0.67832010466,
"times": [
0.6568521246600001,
0.65735763266,
0.6532595196600001,
0.66694201366,
0.6593452146600001,
0.65505117566,
0.6522254616600001,
0.6632517666600001,
0.67832010466,
0.6567866296600001
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.61619367642,
"stddev": 0.01344339320935483,
"median": 0.61088867172,
"user": 0.5857873199999999,
"system": 0.14930645999999997,
"min": 0.60289108122,
"max": 0.64542503522,
"times": [
0.62306748322,
0.61532263222,
0.60289108122,
0.60402287122,
0.60995776822,
0.6118195752200001,
0.60989860422,
0.60802304222,
0.63150867122,
0.64542503522
]
},
{
"command": "pacquet@main",
"mean": 0.6158753924200001,
"stddev": 0.00637340432386225,
"median": 0.61785569722,
"user": 0.5810068199999999,
"system": 0.15262406,
"min": 0.60210323022,
"max": 0.62211260022,
"times": [
0.6167000272200001,
0.61785356822,
0.6220161122200001,
0.61919134322,
0.60210323022,
0.6178578262200001,
0.61488764322,
0.60742786322,
0.62211260022,
0.61860371022
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10815080794000004,
"stddev": 0.000941254064056101,
"median": 0.10798565722000002,
"user": 0.026499999999999996,
"system": 0.020019259999999997,
"min": 0.10698138922000001,
"max": 0.11200407822000001,
"times": [
0.10745911322000001,
0.10819500822000001,
0.10783518622,
0.10788355622000001,
0.10831670622000002,
0.10753776022000001,
0.10852714922000001,
0.10867935422000001,
0.10797444622,
0.10698138922000001,
0.10834553922000001,
0.10744651922000001,
0.10847954222000002,
0.10703782522000001,
0.10792709822000002,
0.11200407822000001,
0.10912936322000001,
0.10798565722000002,
0.10829134922000001,
0.10763757722000002,
0.10789402622000001,
0.10832038322000001,
0.10799389322000001,
0.10768198922000001,
0.10820568822000001
]
},
{
"command": "pnpr@main",
"mean": 0.10787624102000003,
"stddev": 0.0005895690859351588,
"median": 0.10786800722,
"user": 0.02600728,
"system": 0.02005086,
"min": 0.10617635522,
"max": 0.10880662122000001,
"times": [
0.10753215022000001,
0.10745214022,
0.10790563622000002,
0.10617635522,
0.10786800722,
0.10767058822000002,
0.10825409922000001,
0.10841890722000001,
0.10779408022,
0.10776157822000001,
0.10880662122000001,
0.10762507222,
0.10801521222,
0.10771803922,
0.10879084222000002,
0.10666332622000001,
0.10859843022000001,
0.10842521922000001,
0.10783522622000001,
0.10775956522,
0.10822413222,
0.10788469922,
0.10834385422000001,
0.10794283722,
0.10743940622
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.57432638642,
"stddev": 0.12780062016228283,
"median": 6.54216840832,
"user": 3.70340574,
"system": 3.6907499799999997,
"min": 6.43802016682,
"max": 6.83731246782,
"times": [
6.4913119978200005,
6.55891058282,
6.53159541682,
6.7382361608200005,
6.55274139982,
6.43802016682,
6.47837965482,
6.63978485082,
6.83731246782,
6.47697116582
]
},
{
"command": "pacquet@main",
"mean": 6.55224611542,
"stddev": 0.08179242340985231,
"median": 6.568373062820001,
"user": 3.74598214,
"system": 3.68387818,
"min": 6.431820080820001,
"max": 6.69593249582,
"times": [
6.61881151782,
6.59153581982,
6.48816274382,
6.44582709482,
6.431820080820001,
6.69593249582,
6.56652183382,
6.51752675182,
6.570224291820001,
6.59609852382
]
},
{
"command": "pnpr@HEAD",
"mean": 4.98503009552,
"stddev": 0.07716899914328386,
"median": 4.97496281032,
"user": 2.775297840000001,
"system": 3.2536248800000003,
"min": 4.8690827928200004,
"max": 5.13013109382,
"times": [
5.04510440182,
4.8690827928200004,
5.03654840782,
5.13013109382,
4.97269268782,
4.93150386082,
4.97723293282,
5.02766548282,
4.96114685982,
4.89919243482
]
},
{
"command": "pnpr@main",
"mean": 4.9378137972200005,
"stddev": 0.09167866230691354,
"median": 4.94603246582,
"user": 2.76048014,
"system": 3.2825144799999997,
"min": 4.7871926588200004,
"max": 5.121449885820001,
"times": [
4.9488208058200005,
4.7871926588200004,
4.89125379482,
4.95835486182,
4.93156924982,
4.82767873882,
5.121449885820001,
4.94324412582,
4.98238782882,
4.98618602182
]
}
]
} |
|
| Branch | pr/12849 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,210.74 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 665.08 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 687.91 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 108.15 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,146.93 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 4,985.03 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 732.78 ms |
…gLimits: workspaces
Bit's root-components install writes one importer per root under
node_modules/.bit_roots/<id> whose manifest injects the root's sibling
components as workspace deps and carries
installConfig: { hoistingLimits: "workspaces" }. Under nodeLinker:
isolated those injected members are materialized as file: deps, each in
its own global-virtual-store slot whose node_modules only holds that
member's own deps. A realpath-based resolution (Node default) that lands
in a member's slot never reaches a sibling, so require of a sibling
component throws MODULE_NOT_FOUND even though peer resolution is correct.
Parse installConfig.hoistingLimits from the manifest and, after the
isolated symlink pass, cross-link every one of a root's injected members
into every other member's slot node_modules so the upward walk from any
member finds its siblings. The pass is gated on hoistingLimits:
"workspaces" (a shape no non-Bit install produces) and is purely
additive, so ordinary installs are untouched. Because each root's peer
context is folded into its members' slot hashes, two roots get distinct
member slots and cross-linking one root can never leak a wrong sibling
into another. Wired into both the fresh and frozen isolated paths.
|
Code review by qodo was updated up to the latest commit 10e686a |
PR Code Suggestions ✨Warning
|
|||||||||
Addresses review feedback on the napi resolver-chain PR. - The resolve chain wired NodeResolver's offline flag but left the deno and bun runtime resolvers fetching GitHub release metadata unconditionally, so an offline resolve could still reach the network for their `runtime:` specifiers. Add an `offline` field (with matching NO_OFFLINE_DENO_RESOLUTION / NO_OFFLINE_BUN_RESOLUTION errors) to both resolvers, short-circuit before any fetch, and set it in both the napi and fresh-install paths so the node/deno/bun trio all fail fast offline. - Replace the two duplicated ArcResolver adapters (napi and package-manager) with a single `impl Resolver for Arc<dyn Resolver>` in resolving-resolver-base. - Add offline unit tests for the deno/bun runtime specifiers and the pre-assertion logging the style guide requires. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 2565cf1 |
`is_symlink_or_junction` propagated `junction::exists`'s ERROR_NOT_A_REPARSE_POINT (4390) for a plain directory instead of returning `false`, so the `injected_members_are_cross_linked` test panicked on Windows where it asserts a member's own package dir is not a symlink. Check `Path::is_symlink` first, then map the not-a-reparse-point error from `junction::exists` back to `false`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The deno and bun runtime resolvers accepted an `offline` flag but ignored it, reaching out to GitHub for release assets even when offline. Fail fast with NO_OFFLINE_DENO_RESOLUTION / NO_OFFLINE_BUN_RESOLUTION instead, matching the Node.js runtime resolver and the pacquet engine. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 5bbed3a |
Reverts the deno/bun offline fail-fast added earlier in this PR. It diverged from the tested behavior: the e2e tests test/install/denoRuntime.ts and test/install/bunRuntime.ts assert that an offline runtime install fails downstream (the "in package mirror" error), and the runtime resolvers intentionally do not short-circuit on `offline` — only the node resolver does, because it reaches the mirror at resolve time. The ArcResolver dedup and test-logging changes are kept. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 7c8fd4f |
Replace the all-to-all cross-link of a root component's injected members with pnpm's per-package child linking: each member's slot `node_modules/` gains symlinks only to the siblings it declares in its own manifest, so a transitive sibling resolves through the chain (comp3 -> comp2 -> comp1) instead of a clique. This mirrors how pnpm's isolated linker wires an injected package's own children and drops the "broader than the declared dependency set" caveat. The member's manifest is the source of truth — it survives Bit's `excludeLinksFromLockfile` / `dedupeInjectedDeps`, where the lockfile edges do not — so the function signature and both install call sites are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit d1d9bcc |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Satisfies the `perfectionist::macro-trailing-comma` dylint lint on the three multi-line `assert!` invocations in the root-component tests. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 8b7739e |
Two fixes to the
@pnpm/napibinding / pacquet, both needed by programmaticconsumers (Bit) and both gated so existing behavior is unchanged.
1.
resolveDependencyresolves non-npm specifiersresolveDependencybuilt a bareNpmResolver, so any non-npm specifier — afolder path,
file:/link:/workspace:spec, git URL,http(s)tarballURL, or
<alias>:named-registry spec — errored with "the specifier was notclaimed by the npm resolver". It now mirrors the install path's
DefaultResolverchain (npm → git → tarball → localScheme → node → deno → bun →namedRegistry → localPath), so a folder path resolves to its manifest,
file:/link:resolve locally, and git URLs are claimed. Normal npm specs unchanged.Deliberate deviations from the install chain (documented in the module doc): the
tarball resolver runs with no fetch context (no install store on a single
resolve), and pnpmfile custom resolvers are omitted.
2. Root-component member reachability (
installConfig.hoistingLimits: "workspaces")Bit's "root components" create per-root importers whose manifests inject sibling
components as
file:deps and carryinstallConfig: { hoistingLimits: "workspaces" }. The isolated linker materializes each injected member into theshared global virtual store, where a member's slot
node_modulesholds only itsown lockfile deps — so a realpath walk from one member (e.g.
resolveFrom,preserveSymlinks: false) can't reach a sibling member, failing withCannot find module.This parses
installConfig.hoistingLimitsfrom the manifest and, after theisolated symlink pass, cross-links every one of a root's injected members into
every other member's slot
node_modulesso the upward walk finds its siblings.The pass is gated on
hoistingLimits: "workspaces"— a shape no non-Bitinstall produces — and is purely additive (never clobbers an existing entry), so
ordinary installs are untouched. Each root's peer context is folded into its
members' slot hashes, so two roots get distinct member slots and cross-linking
one root can never leak a sibling into another's chain. Wired into the fresh and
frozen isolated paths.
Verification
resolveDependency: repro resolves folder path /file:/link:/ npm /git; 3 new offline tests.
MODULE_NOT_FOUND→ comp3-root reaches react 16.x, comp4-root 17.x(comp2 reachable from comp3); 6 new tests.
pacquet-package-managersuite (665) +pacquet-napi(10) +pacquet-package-manifest(42) green;fmt --check,clippy -D warnings,cargo doc -D warnings,cargo dylintall clean.Ref: #12822, #12844.
Written by an agent (Claude Code, claude-fable-5), on behalf of @zkochan.
Summary by CodeRabbit
New Features
Bug Fixes
Tests