chore(pacquet): fix Doc + Dylint CI failures

Doc job (`RUSTDOCFLAGS=-D warnings`):
- `cli/src/state.rs`: drop the doc-link to
  `pacquet_package_manager::PrefetchingResolver` (removed in the
  earlier batched-prefetch refactor); rewrite the comment to
  describe the current shape.
- `resolving-npm-resolver/src/pick_package.rs`: replace the
  unresolved `ResolveResult::manifest` link in `PickedManifestCache`'s
  doc with a fully-qualified path through `pacquet_resolving_resolver_base`.
- `resolving-npm-resolver/src/fetch_full_metadata.rs`: disambiguate
  the `crate::pick_package` link on `FetchFullMetadataOutcome` —
  the name resolves to both the function and the module, so route
  through `crate::pick_package()` and drop the bracketed link
  around the helper function name.

Dylint job (Perfectionist lints):
- `resolving-deps-resolver/src/resolve_dependency_tree.rs`: rename
  `lock_recoverable<T>` to `lock_recoverable<Inner>` so it doesn't
  trip `perfectionist::single-letter-generic`.
- `resolving-deps-resolver/src/resolve_peers.rs`: rewrite
  `pkg.result.clone()` (now `Arc<ResolveResult>`) as
  `Arc::clone(&pkg.result)` so the refcount bump is explicit at
  the call site, per `perfectionist::arc-rc-clone`.
- `resolving-npm-resolver/src/pick_package.rs`: replace the lone
  unicode `…` in the inline comment on the per-cache-key fetch
  serializer with ASCII `...`, per
  `perfectionist::unicode-ellipsis-in-comments`.
This commit is contained in:
Zoltan Kochan
2026-05-22 01:00:03 +02:00
parent 5d6a420777
commit 0343a47216
5 changed files with 18 additions and 18 deletions

View File

@@ -11,12 +11,10 @@ use std::{path::PathBuf, sync::Arc};
/// Application state when running `pacquet run` or `pacquet install`.
pub struct State {
/// Shared cache that store downloaded tarballs. Held behind
/// [`Arc`] so the resolve-time prefetch (see
/// [`pacquet_package_manager::PrefetchingResolver`]) can capture
/// an owned clone into the `tokio::spawn`ed background download
/// while every install sub-pipeline still takes a borrowed
/// `&MemCache` via deref.
/// Shared cache that storing downloaded tarballs. Held behind
/// [`Arc`] so every install sub-pipeline can share the same
/// handle without per-call clones; the per-package call takes a
/// borrowed `&MemCache` via deref.
pub tarball_mem_cache: Arc<MemCache>,
/// HTTP client to make HTTP requests. Held behind [`std::sync::Arc`] so
/// the lockfile-verification gate can own a clone for the

View File

@@ -23,7 +23,7 @@ use serde_json::Value;
/// install can keep going after the unrelated panic that poisoned
/// the lock — better than escalating into a hard install-wide
/// failure.
fn lock_recoverable<T>(mutex: &Mutex<T>) -> MutexGuard<'_, T> {
fn lock_recoverable<Inner>(mutex: &Mutex<Inner>) -> MutexGuard<'_, Inner> {
mutex.lock().unwrap_or_else(|err| err.into_inner())
}

View File

@@ -31,6 +31,7 @@
//! on anyway.
use std::collections::{BTreeMap, HashMap, HashSet};
use std::sync::Arc;
use node_semver::{Range, Version};
use pacquet_deps_path::{DepPath, PeerId, create_peer_dep_graph_hash};
@@ -489,7 +490,7 @@ impl<'tree> Walker<'tree> {
.or_insert(DependenciesGraphNode {
dep_path: dep_path.clone(),
resolved_package_id: pkg.id.clone(),
resolve_result: pkg.result.clone(),
resolve_result: Arc::clone(&pkg.result),
children: graph_children,
peer_dependencies: pkg.peer_dependencies.clone(),
transitive_peer_dependencies,

View File

@@ -66,8 +66,9 @@ pub struct FetchFullMetadataOptions<'a> {
/// Outcome of a [`fetch_full_metadata`] call. Mirrors upstream's
/// [`FetchMetadataResult | FetchMetadataNotModifiedResult`](https://github.com/pnpm/pnpm/blob/2a9bd897bf/resolving/npm-resolver/src/fetch.ts#L80-L86)
/// union — the caller (today: only
/// [`maybe_upgrade_abbreviated_meta_for_release_age`](crate::pick_package))
/// reacts differently to a 304 than to a 200. [`Package`] is boxed
/// `maybe_upgrade_abbreviated_meta_for_release_age` inside
/// [`crate::pick_package()`]) reacts differently to a 304 than to
/// a 200. [`Package`] is boxed
/// so the size of the enum stays small even though a full packument
/// can be many KB; mirrors the same boxing pattern used elsewhere in
/// the crate when a large struct sits next to a unit variant.

View File

@@ -139,13 +139,13 @@ pub fn shared_packument_fetch_locker() -> PackumentFetchLocker {
/// Per-`(pkg_name, version)` cache for the resolver's serialized
/// `manifest` JSON. The npm resolver builds
/// [`ResolveResult::manifest`] via `serde_json::to_value(picked)`;
/// when many resolves pick the same version of the same package
/// (the common case for shared deps like `react`, `lodash`, …)
/// every duplicate would otherwise re-walk and re-allocate the
/// same JSON tree. Cache the `Arc<Value>` once per
/// `(pkg_name, version)` pair so the second pick onwards is an
/// `Arc::clone` instead of a full reserialise.
/// [`pacquet_resolving_resolver_base::ResolveResult`]'s `manifest`
/// field via `serde_json::to_value(picked)`; when many resolves
/// pick the same version of the same package (the common case for
/// shared deps like `react`, `lodash`, ...) every duplicate would
/// otherwise re-walk and re-allocate the same JSON tree. Cache the
/// `Arc<Value>` once per `(pkg_name, version)` pair so the second
/// pick onwards is an `Arc::clone` instead of a full reserialise.
///
/// Shared across [`crate::NpmResolver`] and
/// [`crate::NamedRegistryResolver`] for the same reasons
@@ -419,7 +419,7 @@ pub async fn pick_package<Cache: PackageMetaCache>(
}
// Per-cache-key fetch serializer. Mirrors upstream's
// [`runLimited(pkgMirror, )`](https://github.com/pnpm/pnpm/blob/f657b5cb44/resolving/npm-resolver/src/pickPackage.ts#L52-L64)
// [`runLimited(pkgMirror, ...)`](https://github.com/pnpm/pnpm/blob/f657b5cb44/resolving/npm-resolver/src/pickPackage.ts#L52-L64)
// pLimit(1): concurrent picks for the same packument coalesce
// into a single network fetch. The first caller for `cache_key`
// acquires the permit and runs steps 2-5; the rest park here