Skip to content

style: adopt perfectionist's new size and shape rules - #14730

Merged
zkochan merged 145 commits into
mainfrom
fix-14562
Sep 9, 2026
Merged

zkochan merged 145 commits into
mainfrom
fix-14562

Conversation

@zkochan

@zkochan zkochan commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Pins dylint.toml to a perfectionist revision instead of a tag and turns on the
four rules that revision adds. Everything else in the PR is the work of making
the tree pass them.

Rule Upstream PR Configuration
excessive_cognitive_complexity KSXGitHub/perfectionist#402 max_complexity = 10
arbitrary_source_item_ordering KSXGitHub/perfectionist#396 active by default
core_instead_of_std KSXGitHub/perfectionist#397 enabled
redundant_derive_more_forward_template KSXGitHub/perfectionist#383 active by default

The pin moves from tag = "0.0.0-rc.22" to a revision so the enabled rule set
cannot change under the repository. CI's cargo-dylint and dylint-link move
from 6.0.0 to 6.0.4, because cargo-dylint refuses a library built against a
newer dylint_linting; the 6.0.1 bootstrap failure the old pin worked around is
fixed in 6.0.4.

No #[expect], no #[allow], no raised limit. Every violation is
refactored away, so cargo dylint --all -- --all-targets --workspace is clean at
max_complexity = 10 across pacquet and pnpr.

Related to #14562, which plans seven
size-and-shape rules. Two have landed upstream: excessive_cognitive_complexity
(adopted here) and too_many_local_bindings
(KSXGitHub/perfectionist#403),
which merged one commit past the revision this PR pins. That one gets its own
PR: measured against this branch it is 688 sites at the issue's
max_bindings = 12 (332 in production, 356 in tests; 325 of them would still
fire at the upstream default of 15), a campaign of the same order as this one,
and folding it in would roughly double a diff that both review bots already
decline for size. The remaining five rules and the clippy-side changes in
that issue stay open. This PR also settles the issue's open question about
arbitrary_source_item_ordering by fixing the ordering rather than disabling the
rule.

That issue proposed generating a per-site #[expect(...)] for every existing
violation as a visible debt marker. This PR does not take that route: a marker
left on 300 functions is a marker nobody clears, and the point of the limit is
the code it produces, not the count of exemptions.

What the refactoring looks like

The commits are one file or one closely related group at a time, each named for
what it separates. The rules are turned on only once the tree already passes
them, so the commit that edits dylint.toml is near the end rather than at the
start.

Recurring shapes:

  • A long command handler becomes a sequence of named steps, so run reads as
    what the command does rather than how each part works — sbom, self-update,
    update, version, view, why, stars, and the python install among
    them.
  • A predicate buried in a condition gets a name: plan_is_outdated,
    releases_pending_major, is_dangling_link, is_preserved_key.
  • A three-way outcome that was expressed by falling through gets an enum:
    SubcommandScan, MarkerProbe, PinOutcome.
  • Repeated parameter lists become a type that owns the shared values:
    StarsRequest, PythonPrepare, AliasScan, FileSummary.
  • Nearly sixty CLI config overrides that repeated the same three shapes are
    driven from four macro_rules! tables in config_overrides.rs, leaving only
    the overrides with logic of their own written out.

Every extracted helper is declared below the item that first uses it, so a file
still reads caller-first. A separate commit sweeps the ones that landed above
their caller.

Behavior is preserved throughout, with two exceptions worth a reviewer's
attention:

  • pnpr's URL redaction no longer re-encodes a harmless query. Splitting
    the three redaction passes gave each its own changed flag. The single
    shared flag meant that redacting a URL's credentials also re-serialized its
    query, rewriting ?options=a%20b as ?options=a+b and turning a bare
    ?token into ?token= — in a query that carries no secret. A test now pins
    the query being left as written.
  • A split-SBOM output collision no longer overwrites the first file.
    Extracting the write moved the collision check after it, so the second
    package's SBOM replaced the first on the way to
    ERR_PNPM_SBOM_OUT_PATH_COLLISION. Caught in review, fixed by claiming the
    path before writing, and covered by a regression test — the collision had no
    test at all before.

Where a rewrite would otherwise have changed behavior, the original branch is
kept and named: the unreadable-ancestor case in prefix.rs, the
unverifiable-artifact case in shared_side_effects.rs, and the with current
resume in the argv boundary scan are the ones worth pointing a reviewer at.

Squash Commit Body

Pin the perfectionist dylint library to a revision instead of a tag and
enable the four rules that revision adds: arbitrary_source_item_ordering,
core_instead_of_std, excessive_cognitive_complexity with a limit of 10,
and redundant_derive_more_forward_template.

The tree is made to pass them by refactoring rather than by exemptions:
no #[expect], no #[allow], and no raised limit. Oversized functions are
split into named steps, conditions that carried a meaning are given
names, three-way outcomes become enums, repeated parameter lists become
types that own the shared values, and the nearly sixty CLI config
overrides that repeated the same three shapes are driven from macro
tables.

cargo-dylint refuses a library built against a newer dylint_linting, so
CI moves to cargo-dylint/dylint-link 6.0.4 to match the pinned revision.
The 6.0.1 bootstrap failure the previous 6.0.0 pin worked around is fixed
there.

Related to https://github.com/pnpm/pnpm/issues/14562. That issue plans
seven size-and-shape rules; only excessive_cognitive_complexity has
landed upstream so far. It also proposed a per-site #[expect] for every
existing violation, which this PR deliberately does not do.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added or updated tests.
  • Updated the documentation if needed.

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

🤖 Generated with Claude Code

https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6

zkochan and others added 30 commits September 9, 2026 00:09
Prepares the workspace for the newer perfectionist revision pinned in a
later commit, which adds `arbitrary_source_item_ordering`,
`redundant_derive_more_forward_template` and `core_instead_of_std`.

Module bodies now lead with their `pub mod` declarations, then their
`pub use` re-exports, then private imports and everything else.
`derive_more` formatting templates that only restate the forward the
derive already performs are gone, and the one `core::` path in a `std`
crate is spelled `std::`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
…rage

Brings the route classifier, the registry-graph validators, the storage
walks and the publish journal under a cognitive complexity of 10, which
the perfectionist revision pinned in a later commit enforces. Each split
names one responsibility: a router source's validation, a directory
entry's classification, one journaled package's promotion.

`redact_parseable_url_candidate` no longer re-serializes a URL's query
string when only its userinfo was redacted. The query rewrite ran
whenever anything about the URL had changed, not only when a sensitive
query key was found.

The one `pub(crate) mod tests;` in the workspace moves above the imports
of its file, where `arbitrary_source_item_ordering` puts a `pub mod`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
…d upstream

Continues bringing pnpr under a cognitive complexity of 10. The htpasswd
parser reads one line at a time, capped and uncapped user registration
are separate paths, an OSV range event answers for itself, and the OCI
fetch loop delegates credential attachment and redirect resolution.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
The publication path now reads as its phases: resolve the blobs a
publication brings, charge the quota, claim the scopes, store, settle.
Reclamation, the usage-document mutation and the write-failure test
double are split the same way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Covers the CLI override folding, the OCI garbage collector's inventory
and sweep phases, and the resolver's request validation, which now
collects the specs a request could fetch in one place instead of twice.

The capped-user insert in the libsql auth backend is repaired: the
counter-slot helper it was split into took the cap as a `usize`, which
only the `libsql` feature build compiles.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
`handle_npm_resolve` now reads as its stages: refuse, verify the input
lockfile, answer from a frozen lockfile or the resolution cache, else
stream. The detached resolve task and the temp-workspace writing each
moved into their own function.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
The referrers scan is now a page with its own read and response budgets,
a filter that answers whether a manifest must be read, and a step per
indexed entry. Blob reads, upload appends and token scope checks each
moved their branching into a named helper.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
…handlers

Token issue now grants scope by scope and action by action. The manifest
proxy separates its `HEAD` answer, its bounded read and its digest
verification. Blob deletion's two-phase write is one attempt per call,
and manifest staging checks its referenced blobs on its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Version immutability is checked field by field, a batch validates its
documents and stages them in separate passes, and a publish's
already-published check reads on its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Route mounting is separated from state construction, and the registry
surface's ecosystems mount together. The registry directory builds one
entry at a time, and the PyPI project list gathers the names a caller can
see on its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
The OCI collector's inventory is a type of its own, whose methods take an
exclusive borrow: `rusqlite::Connection` is `Send` but not `Sync`, so a
shared borrow held across an await would have made every collector future
`!Send`.

Also restores the doc comment an inserted helper had separated from
`unique_tmp_path`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Completes the pnpr side: every function in the registry server is now
under a cognitive complexity of 10.

Search and the org package map each gather one source at a time, with a
named predicate deciding what a caller may see. The upstream search
budget charges its own pages and results. The OSV packument filter
separates the versions pass from the dist-tag and time passes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Covers the files the first pass missed: a crate root whose `pub use`
block sat below its private `mod` declarations, two `pub mod` and two
test-module declarations written at the bottom of their file, and the
`crate::` imports two blocks each that had to merge once they became
neighbours.

The `login_fake!` test macro is exported at the crate root, so its
re-export no longer has to follow the definition. The module is
`#[cfg(test)]`, so nothing is added to the crate's published surface.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Covers env-replace, git-utils, deps-path, modules-yaml and
package-is-installable: placeholder scanning, `.git` pointer resolution,
suffix sanitizing, stored-layout normalization and platform matching each
read as one step now.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
… crates

The Cargo resolver registers one package's candidate versions in its own
function, the Node resolver separates the four SHASUMS fetch paths from
the per-platform asset it builds, and the git fetcher resolves one
prepublish script's stage and command on its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
…er crates

Injected-dep bin removal, lockfile-seeded version weighting, the project
graph's index building and per-importer edge resolution, and pack's two
identity checks each read on their own now.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
…ator crates

Adding a dependency drops it from the other install groups in a named
step, the runtime failure policy reads and stamps `engines.runtime`
separately, and the install coordinator rolls back through its
projections on its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
…iting

Project discovery separates pattern splitting, parse-checking, the
parallel merge and the per-root grouping. The publish-time
`workspace:` rewrite shares one helper for the installed directory and
one for the specifier a published manifest records.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Entry resolution is one function per mode: confined to the directory,
following links, or plain. A vanished path reads as "skip this entry" in
one shared helper instead of at every stat call.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
The bundled-dependency closure decides what it admits in one function,
and a package's own file list reads as the three passes it always was:
the ignore-filtered walk, the always-included root names, and the
force-included `main` / `bin` paths.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Array and object serialization are separate functions, the reverse
dependency index builds on its own, and each lockfile format reads one
entry at a time.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Cache compaction separates picking the surviving records from replacing
the file. The verification gate reads the cached verdict and records a
new one through named helpers instead of inline `if let` blocks at three
call sites.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
One terminal poll answers with what it saw, and a successful poll's
token is read in its own function.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Batch publish groups one packed package at a time and sends one
registry's batch in its own function. Single publish separates the
endpoint, the authorization header, the provenance attachment and the
registry's answer.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
One index file becomes at most one candidate in its own function, wheel
metadata reads a line at a time, and a `file:` tarball resolves apart
from the directory branch. Local specifier parsing separates the
protocol choice from the path it fetches.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
An uploaded blob is decoded and checked in its own function, and one
added manifest file's mode, size and integrity are checked apart from the
running artifact-size total.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Scoped-package collection, the shim already on disk, the Windows
siblings and the write itself are each their own function. The `sh` shim
separates its `NODE_PATH` block, its runtime `exec` block and the MSYS
branch that wraps it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
POSIX normalization appends one component at a time, the retry loop
sleeps its backoff in a named step, lock acquisition reports what one
create attempt settled, and forced symlinking separates creating the
parent from clearing an occupant.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Credential lookup retries without the port in one shared helper instead
of four inline blocks. Client construction separates the proxy setting,
the redirect policy, one builder and the platform-roots fallback.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
The worker's line dispatch hands a fetcher callback to its own function,
which replies through a shared stdin writer. The fetcher adapter decides
what resolution the next fetcher sees in one place.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
`cargo_deps.rs` gained `mod checksum_cache;` on main while this branch was
sorting the module declarations. Keep it with the other private modules.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
@qodo-code-review

qodo-code-review Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to d8f9e48

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Remove invalid static lifetime requirement

Change the lifetime of config from 'static to 'a. This makes the struct more
flexible by not requiring a process-lifetime reference.

pnpm/crates/package-manager/src/install/run.rs [1138-1139]

 struct UpToDateCheck<'a> {
-    config: &'static Config,
+    config: &'a Config,

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: Replacing the 'static lifetime with 'a for config improves the struct's flexibility and prevents potential compilation errors with non-static references.

Medium
  • Update

Previous suggestions

Suggestions up to commit 6e02b4b
CategorySuggestion                                                                                                                                    Impact
Possible issue
Handle filename-only output paths

Skip calling create_dir_all when the parent path is empty.

pnpm/crates/cli/src/cli_args/sbom.rs [1352-1359]

 fn write_sbom_file(file_path: &str, output: &str) -> miette::Result<()> {
     let path = std::path::Path::new(file_path);
-    if let Some(parent) = path.parent() {
+    if let Some(parent) = path.parent().filter(|parent| !parent.as_os_str().is_empty()) {
         std::fs::create_dir_all(parent)
             .map_err(|err| miette::miette!("create directory for {file_path}: {err}"))?;
     }
     std::fs::write(path, output).map_err(|err| miette::miette!("write SBOM to {file_path}: {err}"))
 }
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies and prevents a bug where create_dir_all would fail when the output file path lacks directory components, which would unexpectedly crash the command.

High
Suggestions up to commit 0f3225e
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve error handling for unapproved ignored builds

Remove the early return for build marker failures to ensure the strict
dependency builds check is evaluated. This prevents silently bypassing the
InstallError::IgnoredBuilds fatal error.

pnpm/crates/package-manager/src/install/run.rs [1225-1256]

 fn build_state_allows_short_circuit(check: &UpToDateCheck<'_>) -> Result<bool, InstallError> {
+    let mut safe = true;
     if gvs_build_markers_may_require_recovery(check.config) {
         match check.lockfile.get() {
             Ok(Some(wanted)) => {
                 if gvs_build_marker_present(
                     wanted,
                     check.config,
                     check.workspace_root,
                     check.effective_node_version,
                 ) {
-                    return Ok(false);
+                    safe = false;
                 }
             }
             Ok(None) => {}
-            Err(_) => return Ok(false),
+            Err(_) => safe = false,
         }
     }
     if !check.config.strict_dep_builds {
-        return Ok(true);
+        return Ok(safe);
     }
     match pnpm_modules_yaml::read_modules_layout::<Host>(&check.config.modules_dir) {
         Ok(Some(modules)) => match unapproved_recorded_ignored_builds(&modules, check.config) {
             Ok(Some(package_names)) => Err(InstallError::IgnoredBuilds { package_names }),
-            Ok(None) => Ok(true),
+            Ok(None) => Ok(safe),
             // Unreadable state or a malformed `allowBuilds`: can't trust the
             // fast path, run the full install.
             Err(_) => Ok(false),
         },
-        Ok(None) => Ok(true),
+        Ok(None) => Ok(safe),
         Err(_) => Ok(false),
     }
 }
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a subtle regression introduced during refactoring, where an early return prevents a necessary check for fatal InstallError::IgnoredBuilds from running, accurately restoring the original behavior.

Medium
Prevent overwriting files before detecting a path collision

Check for output path collisions before writing to the file to prevent
overwriting existing files.

pnpm/crates/cli/src/cli_args/sbom.rs [1274-1285]

 let Some(out_template) = self.out.as_deref() else {
     ndjson_lines.push(output);
     continue;
 };
-let file_path = write_sbom_file(out_template, &result, &output)?;
-if !written_paths.insert(file_path.clone()) {
+let expected_path = {
+    let name = sanitize_path_segment(&sanitize_package_name(&result.root_name));
+    let ver = sanitize_path_segment(&result.root_version);
+    out_template.replace("%s", &name).replace("%v", &ver)
+};
+if !written_paths.insert(expected_path.clone()) {
     return Err(miette::miette!(
         code = "ERR_PNPM_SBOM_OUT_PATH_COLLISION",
-        r#"Multiple workspace packages resolve to the same output path "{file_path}". Include %v in the --out pattern to disambiguate."#
+        r#"Multiple workspace packages resolve to the same output path "{expected_path}". Include %v in the --out pattern to disambiguate."#
     ));
 }
+let file_path = write_sbom_file(out_template, &result, &output)?;
 files.push(file_path);
Suggestion importance[1-10]: 8

__

Why: The PR refactoring mistakenly moved the collision check to after the file is written, which would cause an earlier file to be overwritten before the program exits with an error. Checking before writing restores the correct behavior.

Medium

zkochan and others added 3 commits September 9, 2026 11:47
Extracting the write moved the collision check after it, so a second
workspace package rendering the same `--out` path overwrote the first
package's SBOM on the way to the error. Compute the path, claim it, then
write.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
Splitting the redaction passes gave each its own "changed" flag, so a URL
whose credentials are redacted no longer has its query re-encoded when no
key in it is sensitive. Pin that, and drop a route comment that only
restated the function's name.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Notes on the two review findings that are not code changes.

Changeset for pnpr — added in 6e02b4b. The refactor itself is behavior-preserving, but splitting redact_parseable_url_candidate into three passes gave each its own changed flag, and the single shared flag used to make credential redaction re-serialize the URL's query too (?options=a%20b became ?options=a+b, and a bare ?token became ?token=) even when no key in it was sensitive. That is observable in released pnpr output, so it gets a release note. pnpm change status now lists it under @pnpm/pnpr.

The SBOM collision fix does not get one: the bug was introduced and fixed inside this PR, so no release ever carried it.

"URL redaction fix is hard to isolate" — fair, and here is the trade-off. The old behavior is not a design choice to preserve; it is one flag doing three jobs, and restoring it would mean deliberately re-encoding a query that carries no secret and rewriting a valueless key. Rather than carry that forward, the new behavior is pinned by log_message_keeps_a_non_sensitive_query_verbatim (verified to fail against the shared-flag logic), called out in the PR description, and carried by a commit of its own, so a bisect lands on the test rather than on the tree-wide refactor.


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

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

r#"Multiple workspace packages resolve to the same output path "{file_path}". Include %v in the --out pattern to disambiguate."#
));
}
write_sbom_file(&file_path, &output)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Case-only package names overwrite files 🐞 Bug ≡ Correctness

write_split_sboms records file_path using case-sensitive HashSet<String> equality and then
write_sbom_file writes each accepted path directly. On case-insensitive filesystems, workspace
manifests named foo and FOO generate distinct set keys but the same --out file, so the second
package replaces the first while the command reports both as generated.
Agent Prompt
## Issue description
Split SBOM collision detection compares generated paths as case-sensitive strings. Filesystem aliases such as `foo.json` and `FOO.json` can therefore bypass the check and overwrite one another on case-insensitive filesystems.

## Issue Context
Package names are copied from manifests without case normalization, while the path sanitizers preserve case. The repository already uses a separate lowercased path set when validating portable artifact paths.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/sbom.rs[1278-1288]
- pnpm/crates/cli/src/cli_args/sbom.rs[1342-1356]
- pnpm/crates/cli/tests/suite/sbom.rs[768-831]

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 6e02b4b

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.16     12.5±0.17ms    29.9 MB/sec    1.00     10.8±0.18ms    34.6 MB/sec
packument/parse                                  1.09     42.1±1.48µs  1574.2 MB/sec    1.00     38.8±0.61µs  1709.5 MB/sec
tarball/download_dependency                      1.17      5.6±0.32ms   771.8 KB/sec    1.00      4.8±0.19ms   902.7 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.22    217.4±7.90ms 73.6 KElem/sec    1.00    178.2±6.12ms 89.8 KElem/sec
workspace_resolution/hoist_heavy                 1.19    276.0±6.84ms        ? ?/sec    1.00    232.8±6.30ms        ? ?/sec
workspace_sort/chained_projects                  1.17     14.2±1.31ms        ? ?/sec    1.00     12.2±0.47ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.57185% with 781 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.16%. Comparing base (2f3ed22) to head (c224629).

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/pkg.rs 54.71% 96 Missing ⚠️
pnpm/crates/cli/src/cli_args/self_update.rs 0.00% 78 Missing ⚠️
pnpm/crates/cli/src/cli_args/update.rs 56.66% 39 Missing ⚠️
pnpm/crates/cli/src/cli_args/pre_command.rs 81.48% 35 Missing ⚠️
pnpm/crates/cli/src/cli_args/sbom.rs 95.20% 30 Missing ⚠️
pnpm/crates/cli/src/cli_args/global.rs 78.83% 29 Missing ⚠️
pnpm/crates/cli/src/cli_args/run/recursive.rs 91.66% 26 Missing ⚠️
pnpm/crates/cli/src/shim_dispatch.rs 66.23% 26 Missing ⚠️
pnpm/crates/cli/src/cli_args/licenses.rs 88.09% 25 Missing ⚠️
pnpm/crates/cli/src/cli_args/deps_tree_finders.rs 59.64% 23 Missing ⚠️
... and 54 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14730      +/-   ##
==========================================
+ Coverage   89.37%   90.16%   +0.79%     
==========================================
  Files         793      793              
  Lines      143597   152219    +8622     
==========================================
+ Hits       128345   137255    +8910     
+ Misses      15252    14964     -288     

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

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

zkochan and others added 2 commits September 9, 2026 12:35
Splitting `descendant_processes` lifted the `ps` invocation, the wait
loop, and the listing parser out of a `#[cfg(unix)]` function without
carrying the attribute, so Windows compiled code whose imports it does
not have. Gate all three, and the two test helpers that only unix tests
reach.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
The repo reads top-down: a caller first, the helpers it uses below it.
The functions this branch extracted landed on either side of their
callers depending on where the edit was made. Move each one below the
item that first uses it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 6e02b4bfd78b

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.360 ± 0.122 2.229 2.576 1.70 ± 0.17
pacquet@main 2.380 ± 0.105 2.230 2.566 1.71 ± 0.17
pnpr@HEAD 1.434 ± 0.146 1.281 1.637 1.03 ± 0.14
pnpr@main 1.388 ± 0.120 1.300 1.644 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.36047022394,
      "stddev": 0.12207207224552605,
      "median": 2.32707731024,
      "user": 1.36242358,
      "system": 1.3760350399999999,
      "min": 2.22913391574,
      "max": 2.57605300674
    },
    {
      "command": "pacquet@main",
      "mean": 2.3796138468400003,
      "stddev": 0.10455072086626585,
      "median": 2.3711328497400004,
      "user": 1.37867818,
      "system": 1.37104024,
      "min": 2.2300278327400003,
      "max": 2.56573709274
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.43417142294,
      "stddev": 0.14576657420480177,
      "median": 1.38111559074,
      "user": 1.39621678,
      "system": 1.37210454,
      "min": 1.28054286974,
      "max": 1.6370490287400001
    },
    {
      "command": "pnpr@main",
      "mean": 1.38807208984,
      "stddev": 0.11976021830918646,
      "median": 1.3410383992400001,
      "user": 1.31424088,
      "system": 1.31516724,
      "min": 1.2995472917400002,
      "max": 1.6440132007400001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 202.2 ± 11.1 191.9 229.4 1.00
pacquet@main 208.0 ± 6.3 200.1 217.4 1.03 ± 0.06
pnpr@HEAD 223.8 ± 9.7 215.1 247.2 1.11 ± 0.08
pnpr@main 213.7 ± 7.9 205.0 228.7 1.06 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.20219676145999999,
      "stddev": 0.011062085181146495,
      "median": 0.20115761036000002,
      "user": 0.2074191,
      "system": 0.47166245999999995,
      "min": 0.19193169436000002,
      "max": 0.22944756636
    },
    {
      "command": "pacquet@main",
      "mean": 0.20801878176000002,
      "stddev": 0.006288140361452805,
      "median": 0.20549404686,
      "user": 0.20371819999999996,
      "system": 0.48209225999999994,
      "min": 0.20006386136,
      "max": 0.21739577736000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.22380896896000002,
      "stddev": 0.00965773585755734,
      "median": 0.22228197636,
      "user": 0.2000756,
      "system": 0.48166106,
      "min": 0.21508501236,
      "max": 0.24719327436000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.21372381336,
      "stddev": 0.00787910984113062,
      "median": 0.21139270636000002,
      "user": 0.1899154,
      "system": 0.47854215999999994,
      "min": 0.20503963536,
      "max": 0.22865855036000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.2 ± 1.3 6.7 12.9 1.00 ± 0.22
pacquet@main 8.9 ± 1.2 6.9 13.5 1.08 ± 0.22
pnpr@HEAD 8.2 ± 1.3 6.8 14.3 1.00
pnpr@main 8.2 ± 1.2 6.8 13.2 1.00 ± 0.21
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.008245506950697675,
      "stddev": 0.0012865557027103897,
      "median": 0.00779545396,
      "user": 0.0048490781395348825,
      "system": 0.003970042046511625,
      "min": 0.0067431259600000005,
      "max": 0.012929197960000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.008912615477647063,
      "stddev": 0.0012302863063040127,
      "median": 0.008689417460000001,
      "user": 0.004523219999999999,
      "system": 0.004980191176470586,
      "min": 0.00689310396,
      "max": 0.01351124496
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.008232138847573966,
      "stddev": 0.0012652072343234493,
      "median": 0.0077904954600000005,
      "user": 0.004571344260355031,
      "system": 0.00421615828402367,
      "min": 0.00677188996,
      "max": 0.014295472960000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.00824755115020172,
      "stddev": 0.0012097145228772302,
      "median": 0.00782630996,
      "user": 0.00491108599423631,
      "system": 0.003905675734870318,
      "min": 0.00675214996,
      "max": 0.01320489596
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.7 ± 1.4 6.8 14.2 1.09 ± 0.24
pacquet@main 8.3 ± 1.4 6.7 14.0 1.05 ± 0.23
pnpr@HEAD 7.9 ± 1.2 6.8 13.5 1.00
pnpr@main 8.5 ± 1.1 6.9 15.0 1.07 ± 0.21
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.00869412400269663,
      "stddev": 0.0014150215156815955,
      "median": 0.00827726516,
      "user": 0.0049217453932584275,
      "system": 0.004332397228464417,
      "min": 0.006812830160000001,
      "max": 0.01416184316
    },
    {
      "command": "pacquet@main",
      "mean": 0.008345943392673269,
      "stddev": 0.0013518121350482289,
      "median": 0.00787799666,
      "user": 0.0046194312871287125,
      "system": 0.004265240000000002,
      "min": 0.006742656160000001,
      "max": 0.01399736616
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007946924859619772,
      "stddev": 0.0012033040334161155,
      "median": 0.007555467160000002,
      "user": 0.004337318555133082,
      "system": 0.00410320608365019,
      "min": 0.006764422160000001,
      "max": 0.01354547516
    },
    {
      "command": "pnpr@main",
      "mean": 0.008465799194246573,
      "stddev": 0.0011277408519856772,
      "median": 0.00815227566,
      "user": 0.004571357739726026,
      "system": 0.004425105136986301,
      "min": 0.006889897160000001,
      "max": 0.014975324160000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.432 ± 0.017 2.405 2.461 1.61 ± 0.15
pacquet@main 2.451 ± 0.018 2.422 2.476 1.62 ± 0.15
pnpr@HEAD 1.513 ± 0.137 1.391 1.733 1.00
pnpr@main 1.526 ± 0.115 1.375 1.661 1.01 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4316047961399994,
      "stddev": 0.016949455411869617,
      "median": 2.4303403273399997,
      "user": 1.7566089999999999,
      "system": 1.4859240000000002,
      "min": 2.40504584384,
      "max": 2.46080537184
    },
    {
      "command": "pacquet@main",
      "mean": 2.45060998024,
      "stddev": 0.017773344381149365,
      "median": 2.45344201334,
      "user": 1.8442125999999994,
      "system": 1.5450488,
      "min": 2.42235908884,
      "max": 2.47595714584
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5128556171399998,
      "stddev": 0.13691218971429056,
      "median": 1.4399346678399998,
      "user": 1.2729692,
      "system": 1.3499432,
      "min": 1.39084822584,
      "max": 1.73263445884
    },
    {
      "command": "pnpr@main",
      "mean": 1.52552642464,
      "stddev": 0.11464597867371988,
      "median": 1.5315571058400002,
      "user": 1.2155850999999998,
      "system": 1.2851332000000002,
      "min": 1.37467088684,
      "max": 1.66082495784
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 327.1 ± 7.9 316.1 343.2 1.33 ± 0.04
pacquet@main 318.7 ± 9.0 307.9 333.5 1.29 ± 0.04
pnpr@HEAD 246.4 ± 3.6 239.7 251.5 1.00
pnpr@main 257.1 ± 6.2 249.6 265.4 1.04 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3270529388,
      "stddev": 0.007928495257630765,
      "median": 0.3253841863,
      "user": 0.4445536,
      "system": 0.7348663,
      "min": 0.3161088613,
      "max": 0.3431639913
    },
    {
      "command": "pacquet@main",
      "mean": 0.31866813390000004,
      "stddev": 0.008975030525073653,
      "median": 0.31528769580000005,
      "user": 0.42065460000000005,
      "system": 0.7281942000000001,
      "min": 0.3078834083,
      "max": 0.3334790553
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2464404007,
      "stddev": 0.003645828854585635,
      "median": 0.2466175893,
      "user": 0.1729896,
      "system": 0.4328688999999999,
      "min": 0.2396907743,
      "max": 0.2515115423
    },
    {
      "command": "pnpr@main",
      "mean": 0.25713222179999995,
      "stddev": 0.006170153399581465,
      "median": 0.2584584728,
      "user": 0.1737876,
      "system": 0.46290489999999995,
      "min": 0.2495782123,
      "max": 0.2654365003
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.542 ± 0.016 1.523 1.570 5.77 ± 0.19
pacquet@main 1.533 ± 0.017 1.514 1.560 5.73 ± 0.19
pnpr@HEAD 0.267 ± 0.008 0.255 0.281 1.00
pnpr@main 0.269 ± 0.006 0.260 0.281 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.5417518531799999,
      "stddev": 0.0159696451089744,
      "median": 1.54014215918,
      "user": 0.7570333,
      "system": 0.9154457399999998,
      "min": 1.5231207606800001,
      "max": 1.5702773186799999
    },
    {
      "command": "pacquet@main",
      "mean": 1.53262383348,
      "stddev": 0.017208223734052477,
      "median": 1.5259142266799999,
      "user": 0.7663169999999999,
      "system": 0.8794948399999999,
      "min": 1.51358106268,
      "max": 1.5601141566799999
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26737287978,
      "stddev": 0.008397424949004733,
      "median": 0.26474883868,
      "user": 0.1886659,
      "system": 0.47464303999999996,
      "min": 0.25509889368000005,
      "max": 0.28073464068000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.26945331148000007,
      "stddev": 0.0062025388309090304,
      "median": 0.26966444118000005,
      "user": 0.1810099,
      "system": 0.49401204000000004,
      "min": 0.25994826168,
      "max": 0.28134360468
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 217.3 ± 15.7 193.4 254.0 2.23 ± 0.18
pacquet@main 209.5 ± 19.4 189.8 250.8 2.15 ± 0.21
pnpr@HEAD 97.5 ± 3.4 91.1 105.9 1.00
pnpr@main 99.2 ± 4.0 94.0 111.5 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2173473730338462,
      "stddev": 0.015696711575949002,
      "median": 0.21246175188,
      "user": 0.20148704769230769,
      "system": 0.08825258769230769,
      "min": 0.19336649088,
      "max": 0.25400411288
    },
    {
      "command": "pacquet@main",
      "mean": 0.2095410723415385,
      "stddev": 0.019441154789222058,
      "median": 0.20321204688,
      "user": 0.19198227846153845,
      "system": 0.08241081846153847,
      "min": 0.18984065288000002,
      "max": 0.25080732088
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09747250495142858,
      "stddev": 0.003382626983672514,
      "median": 0.09679619338,
      "user": 0.037601347142857136,
      "system": 0.01570380571428571,
      "min": 0.09107847488000001,
      "max": 0.10591017388000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.09921675732827587,
      "stddev": 0.004007818374850608,
      "median": 0.09816171388000001,
      "user": 0.036182291724137935,
      "system": 0.018852132413793105,
      "min": 0.09402961988000001,
      "max": 0.11145214688
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 724.7 ± 77.7 591.5 820.5 1.05 ± 0.17
pacquet@main 690.1 ± 81.2 554.7 795.0 1.00
pnpm@HEAD 3312.0 ± 144.2 3150.9 3574.2 4.80 ± 0.60
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7246570502066667,
      "stddev": 0.07765414746346938,
      "median": 0.7195723095400001,
      "user": 0.7184833666666667,
      "system": 0.20869582000000003,
      "min": 0.5915275855400001,
      "max": 0.82047522854
    },
    {
      "command": "pacquet@main",
      "mean": 0.6900973578733334,
      "stddev": 0.08115222401146267,
      "median": 0.70065831954,
      "user": 0.6857061444444444,
      "system": 0.17791470888888888,
      "min": 0.55473238554,
      "max": 0.79499781554
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.3119758169844444,
      "stddev": 0.1441524560876719,
      "median": 3.2883068765399996,
      "user": 4.751173588888888,
      "system": 0.31490859777777774,
      "min": 3.15085042754,
      "max": 3.57421005354
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.462 ± 0.142 4.333 4.772 1.29 ± 0.05
pacquet@main 4.389 ± 0.145 4.304 4.736 1.27 ± 0.05
pnpr@HEAD 3.451 ± 0.083 3.354 3.664 1.00
pnpr@main 3.467 ± 0.104 3.366 3.695 1.00 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.46151328362,
      "stddev": 0.14194703160400576,
      "median": 4.4070544292200005,
      "user": 1.6140946,
      "system": 1.6167779600000003,
      "min": 4.332931196720001,
      "max": 4.77162695972
    },
    {
      "command": "pacquet@main",
      "mean": 4.38852729142,
      "stddev": 0.144966588788684,
      "median": 4.3322889272200005,
      "user": 1.6410787999999996,
      "system": 1.5879470599999999,
      "min": 4.30421957272,
      "max": 4.73571899572
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.4507104874200003,
      "stddev": 0.08270919027266166,
      "median": 3.43982259522,
      "user": 1.4950803000000001,
      "system": 1.47778266,
      "min": 3.35380830672,
      "max": 3.66379027772
    },
    {
      "command": "pnpr@main",
      "mean": 3.46739487292,
      "stddev": 0.10354958140607635,
      "median": 3.43331130122,
      "user": 1.5402999,
      "system": 1.49930586,
      "min": 3.3659397687199997,
      "max": 3.69503494472
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store — the layout pnpm 12 installs into by default. Comparable to that scenario head-to-head.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 118.8 ± 2.3 114.5 123.4 1.00
pacquet@main 129.5 ± 15.6 111.2 176.7 1.09 ± 0.13
pnpr@HEAD 142.3 ± 11.0 131.0 164.3 1.20 ± 0.10
pnpr@main 138.3 ± 11.0 125.7 163.4 1.16 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.11877897389809526,
      "stddev": 0.002318817917008188,
      "median": 0.11906863766,
      "user": 0.16017732666666668,
      "system": 0.1555779133333333,
      "min": 0.11449820866,
      "max": 0.12338947466000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.12953164839913042,
      "stddev": 0.015633627201989235,
      "median": 0.12311684366000002,
      "user": 0.17659731217391303,
      "system": 0.16037153652173913,
      "min": 0.11122765266000001,
      "max": 0.17668552566
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1422591219757895,
      "stddev": 0.011030518515084896,
      "median": 0.13751416866000002,
      "user": 0.16252960736842104,
      "system": 0.1710214747368421,
      "min": 0.13098238066,
      "max": 0.16426903366
    },
    {
      "command": "pnpr@main",
      "mean": 0.13826540341,
      "stddev": 0.011024204070499862,
      "median": 0.13441562116,
      "user": 0.16969541,
      "system": 0.15624193,
      "min": 0.12572815166,
      "max": 0.16338948866000003
    }
  ]
}

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/14730
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
114.50 ms
(-12.00%)Baseline: 130.12 ms
156.14 ms
(73.33%)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,405.05 ms
(-2.30%)Baseline: 2,461.79 ms
2,954.15 ms
(81.41%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,523.12 ms
(-1.24%)Baseline: 1,542.24 ms
1,850.69 ms
(82.30%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
316.11 ms
(-11.39%)Baseline: 356.73 ms
428.08 ms
(73.84%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
193.37 ms
(-1.27%)Baseline: 195.85 ms
235.03 ms
(82.27%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,229.13 ms
(-1.57%)Baseline: 2,264.65 ms
2,717.58 ms
(82.03%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,332.93 ms
(+0.42%)Baseline: 4,314.93 ms
5,177.92 ms
(83.68%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
191.93 ms
(-9.41%)Baseline: 211.88 ms
254.25 ms
(75.49%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
591.53 ms
(+0.13%)Baseline: 590.77 ms
708.92 ms
(83.44%)
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
6.81 ms
(+3.75%)Baseline: 6.57 ms
7.88 ms
(86.46%)
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
6.74 ms
(+4.70%)Baseline: 6.44 ms
7.73 ms
(87.25%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/14730
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)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
130.98 ms
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,390.85 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
255.10 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
239.69 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
91.08 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,280.54 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,353.81 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
215.09 ms
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
6.76 ms
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
6.77 ms
🐰 View full continuous benchmarking report in Bencher

The entry led with what no longer happens, mixing the old behavior into
the sentence describing the new one. Say what pnpr does now, then give
the old behavior its own past-tense sentence.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019pVwWVfUqvpS6RgUP2nfQ6
@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Two more from the latest pass.

Release note mixes old and new behavior — fixed in c224629. The entry led with what no longer happens, which folds the old behavior into the sentence describing the new one. AGENTS.md asks for the reverse, so it now reads:

pnpr records a URL's query exactly as it was written when it redacts the credentials in an error message. It used to re-encode the query, rewriting ?options=a%20b as ?options=a+b.

Case-only package names overwrite files — real, but not from this PR. written_paths is a HashSet<String> compared case-sensitively on main too, so two workspace packages differing only in case already overwrite each other's SBOM on a case-insensitive filesystem. This PR moved the check ahead of the write; it did not change how paths are compared. Out of scope for a lint-adoption PR, and worth its own issue with a decision on whether --out should normalize case or reject a collision that only some filesystems have.


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

@qodo-code-review

Copy link
Copy Markdown

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

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Some registries hide starred packages — not reproducible; the two endpoints have been conflated.

The is_array() || is_object() guard only ever applied to -/user/v1/star, the endpoint used when no username is given. main:

if is_self {
    ...
    if response.status().is_success() {
        let body: Value = response.json().await.into_diagnostic()?;
        drop(client);
        if body.is_array() || body.is_object() {
            return Ok(parse_stars_response(&body));   // guard is here
        }
    } else { drop(client); }
}
// falls through to -/user/<name>/stars
let (client, response) = send_with_retry(http_client, &stars_url, ...)?;
if !response.status().is_success() {
    // -/util/ fallback
}
let body: Value = response.json().await.into_diagnostic()?;   // no guard here, on main either
Ok(parse_stars_response(&body))

The branch keeps both halves as they were. own_stars returns Some(body) only on success and is_array() || is_object(), so a scalar still falls through to the per-user endpoint; user_stars still reaches -/util/ only on a non-success status, exactly as main does. The cited hunk at L99-102 is inside own_stars, where the guard is preserved and simply expressed as (body.is_array() || body.is_object()).then_some(body) instead of an early return.

So the described failure ("a registry answers -/user/<name>/stars with a successful non-list document and serves the list from -/util/") is unchanged by this PR: main prints nothing there too. Worth its own issue if a registry actually behaves that way, but it is not a regression here.


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

@zkochan zkochan changed the title Adopt perfectionist's new size and shape rules style: adopt perfectionist's new size and shape rules Sep 9, 2026
@qodo-code-review

Copy link
Copy Markdown

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

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

@zkochan
zkochan merged commit 2fa2829 into main Sep 9, 2026
32 of 34 checks passed
@zkochan
zkochan deleted the fix-14562 branch September 9, 2026 11:16
biisal pushed a commit to biisal/pnpm that referenced this pull request Sep 15, 2026
Pin the perfectionist dylint library to a revision instead of a tag and
enable the four rules that revision adds: arbitrary_source_item_ordering,
core_instead_of_std, excessive_cognitive_complexity with a limit of 10,
and redundant_derive_more_forward_template.

The tree is made to pass them by refactoring rather than by exemptions:
no #[expect], no #[allow], and no raised limit. Oversized functions are
split into named steps, conditions that carried a meaning are given
names, three-way outcomes become enums, repeated parameter lists become
types that own the shared values, and the nearly sixty CLI config
overrides that repeated the same three shapes are driven from macro
tables.

cargo-dylint refuses a library built against a newer dylint_linting, so
CI moves to cargo-dylint/dylint-link 6.0.4 to match the pinned revision.
The 6.0.1 bootstrap failure the previous 6.0.0 pin worked around is fixed
there.

Related to pnpm#14562. That issue plans
seven size-and-shape rules; only excessive_cognitive_complexity has
landed upstream so far. It also proposed a per-site #[expect] for every
existing violation, which this PR deliberately does not do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants