Repository navigation
feat(pacquet): support the changed-packages filter selector ([<since>]) - #12914
Conversation
📝 WalkthroughWalkthroughChanged-project filtering now supports additional pattern options through the native CLI, resolves git worktrees using the nearest ChangesConfiguration and CLI plumbing
Changed-project resolution
Command validation and release records
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant RecursiveSelection
participant WorkspaceFilter
participant Git
CLI->>RecursiveSelection: provide filter and pattern options
RecursiveSelection->>WorkspaceFilter: pass FilterWorkspaceProjectsOptions
WorkspaceFilter->>Git: resolve diff revision and changed paths
Git-->>WorkspaceFilter: changed files
WorkspaceFilter-->>RecursiveSelection: selected projects
RecursiveSelection-->>CLI: execute selected command
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 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 Qodofeat(pacquet): support changed-packages filter selector ([<since>])
AI Description
Diagram
High-Level Assessment
Files changed (17)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1. Windows CI test early-return
|
Micro-Benchmark ResultsLinux |
PR Code Suggestions ✨Latest suggestions up to f4be7ef Warning
Previous suggestionsSuggestions up to commit 7b13c0c
Suggestions up to commit 473821e
Suggestions up to commit a67082e
Suggestions up to commit c7d46f0
Suggestions up to commit fef7058
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Code review by qodo was updated up to the latest commit c7d46f0 |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
pacquet/crates/workspace-projects-filter/src/get_changed_projects.rs (1)
112-113: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winUse
-z(NUL-separated) output for robust path parsing.Git wraps paths with special characters in C-style quotes (e.g.,
"foo\"bar.txt"). The currentstrip_prefix/strip_suffixapproach only removes outer quotes without unescaping\",\\, etc., producing incorrect paths for files containing quotes or backslashes. Usinggit diff --name-only -zoutputs NUL-separated paths without quoting, avoiding this entirely.♻️ Proposed refactor: switch to NUL-separated parsing
let output = Command::new("git") - .args(["diff", "--name-only", commit, "--"]) + .args(["diff", "--name-only", "-z", commit, "--"]) .arg(opts.workspace_dir) .current_dir(opts.workspace_dir) .output() .map_err(|err| FilterError::FilterChanged { stderr: err.to_string() })?; if !output.status.success() { return Err(FilterError::FilterChanged { stderr: String::from_utf8_lossy(&output.stderr).trim_end().to_string(), }); } - let stdout = String::from_utf8_lossy(&output.stdout); - let diff = stdout.trim_end_matches('\n'); - if diff.is_empty() { + let stdout = String::from_utf8_lossy(&output.stdout); + if stdout.is_empty() { return Ok(IndexMap::new()); } let ignore_globs = compile_globs(opts.changed_files_ignore_pattern)?; let test_globs = compile_globs(opts.test_pattern)?; let mut changed_dirs: IndexMap<PathBuf, ChangeType> = IndexMap::new(); - for line in diff.split('\n') { - // git wraps paths with non-ASCII characters in quotes. - let changed_file = line.strip_prefix('"').unwrap_or(line); - let changed_file = changed_file.strip_suffix('"').unwrap_or(changed_file); + for changed_file in stdout.split('\0') { + if changed_file.is_empty() { + continue; + } if ignore_globs.iter().any(|glob| glob.is_match(changed_file)) { continue; }🤖 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/workspace-projects-filter/src/get_changed_projects.rs` around lines 112 - 113, Update the git diff invocation used by the changed-projects logic to request NUL-separated output with `-z`, then parse the result by splitting on NUL bytes instead of lines. Remove the outer-quote stripping in the changed-file parsing near `get_changed_projects`, and preserve paths exactly as emitted, including quotes and backslashes.
🤖 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/workspace-projects-filter/src/filter/tests.rs`:
- Line 626: Add a dbg! call for error immediately before the
assert!(matches!(error, FilterError::FilterChanged { .. })) assertion in the
relevant test, following CODE_STYLE_GUIDE.md so the actual value is logged
before a potential assertion failure.
- Around line 408-631: Validate ProjectSelector::diff in the changed-projects
git invocation before spawning the process; reject any ref beginning with “-”
(or normalize it as an explicit revision) so values such as “--help” cannot be
interpreted as git options. Update the resulting error handling and tests,
including selection_fails_for_nonexistent_diff_branch, to cover leading-dash
refs.
In `@pacquet/crates/workspace-projects-filter/src/get_changed_projects.rs`:
- Around line 88-93: Validate the user-provided commit ref before constructing
the git command in the changed-project filtering logic. Reject any commit value
beginning with "-" and return an appropriate FilterError::FilterChanged; ensure
this validation occurs before Command::new("git") is invoked, while preserving
valid refs and existing error handling.
- Around line 148-155: Update find_repo_root to scan ancestors once and return
the nearest .git entry regardless of whether it is a file or directory; remove
the directory-first then file-second search so nested worktrees resolve to their
own repository root.
---
Nitpick comments:
In `@pacquet/crates/workspace-projects-filter/src/get_changed_projects.rs`:
- Around line 112-113: Update the git diff invocation used by the
changed-projects logic to request NUL-separated output with `-z`, then parse the
result by splitting on NUL bytes instead of lines. Remove the outer-quote
stripping in the changed-file parsing near `get_changed_projects`, and preserve
paths exactly as emitted, including quotes and backslashes.
🪄 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: 47594074-7167-44b8-b7dc-3da47fb52241
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (17)
.changeset/pacquet-changed-packages-filter.mdpacquet/crates/cli/src/cli_args/cli_command.rspacquet/crates/cli/src/cli_args/deploy.rspacquet/crates/cli/src/cli_args/dispatch.rspacquet/crates/cli/src/cli_args/recursive.rspacquet/crates/cli/tests/exec_recursive.rspacquet/crates/cli/tests/run_recursive.rspacquet/crates/config/src/env_overlay.rspacquet/crates/config/src/lib.rspacquet/crates/config/src/workspace_yaml.rspacquet/crates/package-manager/src/install_package_from_registry/tests.rspacquet/crates/workspace-projects-filter/Cargo.tomlpacquet/crates/workspace-projects-filter/src/filter.rspacquet/crates/workspace-projects-filter/src/filter/tests.rspacquet/crates/workspace-projects-filter/src/get_changed_projects.rspacquet/crates/workspace-projects-filter/src/lib.rspacquet/plans/TEST_PORTING.md
|
Code review by qodo was updated up to the latest commit a67082e |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12914 +/- ##
==========================================
+ Coverage 85.49% 85.51% +0.01%
==========================================
Files 468 469 +1
Lines 72828 72988 +160
==========================================
+ Hits 62266 62414 +148
- Misses 10562 10574 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Code review by qodo was updated up to the latest commit 473821e |
Port git-diff project selection from `@pnpm/workspace.projects-filter`
to pacquet, so a `--filter "...[origin/main]"` selector selects the
workspace projects whose files changed since the given git ref instead
of failing with `unsupported_diff_selector`. This unblocks the
`ci:test-branch` job, whose
`pn --filter=...[origin/main] -r list --depth=-1 --json` discovery step
fails on every PR with the pacquet-based `@pnpm/exe`.
The port mirrors upstream `getChangedProjects`:
- `git diff --name-only <since> -- <workspace_dir>` runs in the
selector's `{dir}` (else the workspace root); the repository root the
diff paths are relative to is the parent of the nearest `.git`
directory, falling back to the nearest `.git` file (worktrees).
- Each changed file maps to the nearest enclosing workspace project.
Files matching `changedFilesIgnorePattern` are ignored entirely;
projects whose changes all match `testPattern` are selected without
their dependents. Both pattern sets are matched with `wax`, the glob
crate pacquet already uses where upstream uses micromatch/fast-glob.
- A failing git diff surfaces git's stderr under pnpm's
`ERR_PNPM_FILTER_CHANGED` error code.
`FilterWorkspaceProjectsOptions` / `FilterProjectsOptions` gain
`workspace_dir`, `test_pattern`, and `changed_files_ignore_pattern`,
threaded from `Config` by the recursive commands and `deploy`. The
`testPattern` / `changedFilesIgnorePattern` settings are read from
`pnpm-workspace.yaml` and `PNPM_CONFIG_*` env vars, overridable by the
global `--test-pattern` / `--changed-files-ignore-pattern` flags, and
excluded from the global config.yaml — all matching the TypeScript CLI.
The three upstream diff-selector tests (basic selection incl. quoted
non-ASCII paths, git-worktree layout, nonexistent ref error) are ported
from their `known_failures` stubs into `filter::tests::changed_packages`,
and the recursive run/exec integration tests now assert the selector
scopes execution to the changed project. Verified against the
TypeScript CLI on this repository: both stacks select the identical
project set for `...[origin/main]`, with and without the two pattern
flags.
Co-Authored-By: Claude Fable 5 <[email protected]>
Port the rest of the upstream tests around the `[<since>]` selector: - `testPattern is respected by the test script` (`pnpm/test/monorepo/index.ts`) as a recursive-run integration test: `testPattern` read from `pnpm-workspace.yaml`, a `...[origin/main]` filter against a pushed origin ref, and dependents of a test-only-changed project staying unselected. - `changedFilesIgnorePattern is respected` (same file) as a list integration test: yaml-configured ignore patterns (including a brace alternation and `**/cache/**`), an uncommitted working-tree change, and the empty `--changed-files-ignore-pattern=` CLI override disabling the yaml patterns. - `respects testPattern` / `respects changedFilesIgnorePattern` (`config/reader/test/index.ts`) as workspace-yaml config tests, plus their exclusion from the global config.yaml. The upstream `.npmrc`-is-ignored case has no pacquet counterpart because pacquet reads no settings from `.npmrc`. Each new test was verified to fail with the yaml-to-config threading deliberately broken. The upstream parse-cli-args case for `--test-pattern` consuming exactly one value is enforced by clap's declared arity in pacquet, so it is not ported. Co-Authored-By: Claude Fable 5 <[email protected]>
Match execa's stripFinalNewline, which upstream's git stderr and stdout pass through: remove one trailing LF (plus a preceding CR), instead of trimming all trailing whitespace from the ERR_PNPM_FILTER_CHANGED message and the diff file list. Co-Authored-By: Claude Fable 5 <[email protected]>
…trees Address two review findings in the `[<since>]` changed-packages selector, in both stacks (the TypeScript CLI and pacquet) since both shared the same behavior: - Pass --end-of-options to `git diff --name-only` so an option-like `<since>` value cannot be parsed as a git option. Without it, `--filter "[--output=<path>]"` made git write its diff output to an arbitrary file and exit 0; now git rejects the value as a bad revision (ERR_PNPM_FILTER_CHANGED). - Resolve the repository root to the *nearest* `.git` entry, file or directory, instead of preferring a `.git` directory anywhere up the tree. A worktree checked out inside another repository's tree has a `.git` file while an ancestor has a `.git` directory; the old dir-first search anchored diff paths at the wrong root, so changed projects stopped matching. TypeScript switches `find.dir ?? find.file` to `find.up`; pacquet's find_repo_root does a single nearest-entry scan. Both fixes carry matching tests in both stacks, each verified to fail against the previous behavior. Also adds a `dbg!` before the non-assert_eq error assertion in the nonexistent-ref test, per the style guide. Co-Authored-By: Claude Fable 5 <[email protected]>
Changesets are not created for Rust-only changes. The remaining changeset covers the TypeScript-side fixes in `@pnpm/workspace.projects-filter` (--end-of-options hardening and nearest-.git repo-root resolution). Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 7b13c0c |
7b13c0c to
f4be7ef
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/cli/tests/exec_recursive.rs (1)
136-182: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated
gittest helper.The
gitclosure (lines 142–153) is duplicated verbatim inlist.rs(lines 131–139) andrun_recursive.rs(lines 655–666 and 1313–1324) — four copies total across three files. Consider extracting a sharedgit(cwd: &Path, args: &[&str])helper intopacquet-testing-utilsalongsideCommandTempCwd, so all CLI integration tests can reuse it.As per coding guidelines, missed reuse or duplication across the monorepo should be surfaced. Based on learnings, the
pacquet-testing-utilscrate already provides shared test infrastructure (CommandTempCwd), making it the natural home for this helper.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/tests/exec_recursive.rs` around lines 136 - 182, Extract the duplicated git command closure into a shared git(cwd: &Path, args: &[&str]) helper in the pacquet-testing-utils crate alongside CommandTempCwd, preserving its command execution and failure diagnostics. Update recursive_exec_diff_selector_selects_changed_projects and the corresponding helpers/usages in list.rs and run_recursive.rs to call the shared helper, removing all local duplicate closures.Sources: Path instructions, Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pnpm/crates/cli/tests/exec_recursive.rs`:
- Around line 136-182: Extract the duplicated git command closure into a shared
git(cwd: &Path, args: &[&str]) helper in the pacquet-testing-utils crate
alongside CommandTempCwd, preserving its command execution and failure
diagnostics. Update recursive_exec_diff_selector_selects_changed_projects and
the corresponding helpers/usages in list.rs and run_recursive.rs to call the
shared helper, removing all local duplicate closures.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 19253603-a3c0-4f87-bfa9-048919ac3360
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (8)
.changeset/changed-packages-filter-hardening.mdpnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/deploy.rspnpm/crates/cli/src/cli_args/dispatch.rspnpm/crates/cli/src/cli_args/recursive.rspnpm/crates/cli/tests/exec_recursive.rspnpm/crates/cli/tests/list.rspnpm/crates/cli/tests/run_recursive.rs
✅ Files skipped from review due to trivial changes (1)
- .changeset/changed-packages-filter-hardening.md
| test('select changed packages when operating under a git worktree nested inside the main repository', async () => { | ||
| if (isCI && isWindows()) { | ||
| return | ||
| } |
There was a problem hiding this comment.
1. Windows ci test early-return 📘 Rule violation ▣ Testability
The newly added Jest tests return early on CI Windows without an issue reference or explicit justification, effectively skipping coverage on that platform. This violates the requirement to avoid introducing skipped/ignored tests without tracked rationale.
Agent Prompt
## Issue description
New tests are conditionally skipped on CI Windows via `if (isCI && isWindows()) { return }` without a linked tracking issue or documented justification.
## Issue Context
The compliance rule requires that newly skipped/ignored tests include an explicit issue reference and rationale, or the tests should be made to pass on that platform.
## Fix Focus Areas
- pnpm11/workspace/projects-filter/test/index.ts[594-597]
- pnpm11/workspace/projects-filter/test/index.ts[658-661]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit f4be7ef |
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": 4.17897903716,
"stddev": 0.18883663556439295,
"median": 4.108338824860001,
"user": 3.9119701399999998,
"system": 3.6201947,
"min": 4.05126679336,
"max": 4.66860715236,
"times": [
4.13912264936,
4.07755500036,
4.05427137536,
4.07381677436,
4.66860715236,
4.28531250436,
4.06142442336,
4.16612236436,
4.21229133436,
4.05126679336
]
},
{
"command": "pacquet@main",
"mean": 4.04788309046,
"stddev": 0.20376662808730323,
"median": 3.97704666736,
"user": 3.82576744,
"system": 3.5573829000000003,
"min": 3.8341930893600003,
"max": 4.47051093536,
"times": [
4.47051093536,
4.17186565736,
3.97065676136,
3.84166162236,
4.13057470936,
3.98187988736,
3.86745973736,
4.23781505736,
3.97221344736,
3.8341930893600003
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1460213873600003,
"stddev": 0.12698769059040807,
"median": 2.10643901586,
"user": 2.7437204399999997,
"system": 3.1069432000000003,
"min": 2.02579538736,
"max": 2.37319719636,
"times": [
2.02579538736,
2.16768494336,
2.04706958336,
2.12076503536,
2.36325504036,
2.03591873036,
2.09211299636,
2.37319719636,
2.16352927936,
2.07088568136
]
},
{
"command": "pnpr@main",
"mean": 2.12600252706,
"stddev": 0.13624564257875404,
"median": 2.08165964986,
"user": 2.67743094,
"system": 3.0965730000000002,
"min": 1.96022895836,
"max": 2.40019142536,
"times": [
2.09418528736,
2.20277931236,
1.96022895836,
2.30255534436,
2.06375064536,
2.40019142536,
2.06913401236,
2.09560628236,
2.00401485936,
2.06757914336
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6763846275,
"stddev": 0.009695881540528592,
"median": 0.6751600179,
"user": 0.41758296,
"system": 1.3585777799999998,
"min": 0.6608334279,
"max": 0.6900456499000001,
"times": [
0.6900456499000001,
0.6811948019,
0.6726365679,
0.6724689429,
0.6608334279,
0.6848346999,
0.6695881009,
0.6776834679,
0.6883306799000001,
0.6662299359
]
},
{
"command": "pacquet@main",
"mean": 0.6605768663000001,
"stddev": 0.00914285420428677,
"median": 0.6565711209,
"user": 0.40519836,
"system": 1.3292317799999998,
"min": 0.6501346419,
"max": 0.6757728889000001,
"times": [
0.6694457079,
0.6570575739000001,
0.6560846679000001,
0.6532858359,
0.6539098639,
0.6501346419,
0.6757728889000001,
0.6610678209,
0.6737902599000001,
0.6552194019
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7376285817,
"stddev": 0.06851363848251114,
"median": 0.7160536004,
"user": 0.43055956,
"system": 1.3773391799999997,
"min": 0.6934795699,
"max": 0.9283748099000001,
"times": [
0.7098349859,
0.7458802339,
0.7073854569,
0.7160959209000001,
0.7161596189,
0.7326788849,
0.7103850559,
0.6934795699,
0.7160112799,
0.9283748099000001
]
},
{
"command": "pnpr@main",
"mean": 0.7327439673,
"stddev": 0.013301919175837998,
"median": 0.7346260979000001,
"user": 0.41300245999999996,
"system": 1.42283688,
"min": 0.7087120469,
"max": 0.7499768249000001,
"times": [
0.7248955699,
0.7465517929000001,
0.7416187899000001,
0.7087120469,
0.7433882589,
0.7324517669,
0.7231418319,
0.7368004289000001,
0.7199023619,
0.7499768249000001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.39672875308,
"stddev": 0.041539229738981505,
"median": 4.39527598348,
"user": 3.9353845599999993,
"system": 3.5200066,
"min": 4.34865101048,
"max": 4.46314605348,
"times": [
4.34906919448,
4.39353124748,
4.46314605348,
4.41565332848,
4.40547193848,
4.3662824994800005,
4.39702071948,
4.461932447480001,
4.36652909148,
4.34865101048
]
},
{
"command": "pacquet@main",
"mean": 4.32713274788,
"stddev": 0.02845407013933174,
"median": 4.31925369098,
"user": 3.8264943599999994,
"system": 3.4955399999999996,
"min": 4.29837698848,
"max": 4.40220397748,
"times": [
4.32272167948,
4.40220397748,
4.33947160548,
4.31626920048,
4.31397163048,
4.31176867548,
4.3195337594800005,
4.29837698848,
4.31897362248,
4.3280363394800005
]
},
{
"command": "pnpr@HEAD",
"mean": 2.29953341188,
"stddev": 0.15178932155521838,
"median": 2.3405453199800004,
"user": 2.5611581599999997,
"system": 3.0329577,
"min": 2.04652392448,
"max": 2.51719690448,
"times": [
2.3400748254800003,
2.04652392448,
2.36255983248,
2.21136898648,
2.1439140454800003,
2.51719690448,
2.34101581448,
2.4708448454800003,
2.3962452504800003,
2.16558968948
]
},
{
"command": "pnpr@main",
"mean": 2.23770367978,
"stddev": 0.10656161862771524,
"median": 2.23202003848,
"user": 2.49941336,
"system": 3.0072383999999994,
"min": 2.09368173648,
"max": 2.3632164284800004,
"times": [
2.33281539348,
2.35658165948,
2.09368173648,
2.2714823124800003,
2.3632164284800004,
2.14625890248,
2.14780365248,
2.3433177934800002,
2.19255776448,
2.12932115448
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.4214510137800003,
"stddev": 0.014596117327272676,
"median": 1.41786725028,
"user": 1.40448774,
"system": 1.7496947200000001,
"min": 1.40028705928,
"max": 1.4525340912800002,
"times": [
1.4319441482800002,
1.41646428828,
1.42539496928,
1.4189726482800002,
1.4072351952800002,
1.41676185228,
1.4525340912800002,
1.40028705928,
1.41469349928,
1.43022238628
]
},
{
"command": "pacquet@main",
"mean": 1.4158289661799999,
"stddev": 0.05926304805273192,
"median": 1.4019274032800002,
"user": 1.37192824,
"system": 1.7428566199999995,
"min": 1.3784998372800001,
"max": 1.58057503928,
"times": [
1.40211349028,
1.41607437628,
1.58057503928,
1.41104600028,
1.40174131628,
1.3784998372800001,
1.3999243572800002,
1.40408432128,
1.38268120928,
1.3815497142800002
]
},
{
"command": "pnpr@HEAD",
"mean": 0.69113171668,
"stddev": 0.05350359304902866,
"median": 0.6758226122800001,
"user": 0.36366203999999996,
"system": 1.30141822,
"min": 0.66397956628,
"max": 0.8424263322800001,
"times": [
0.68403718228,
0.67871207128,
0.68062320728,
0.6768175362800001,
0.66815096828,
0.8424263322800001,
0.66997654928,
0.6748276882800001,
0.66397956628,
0.67176606528
]
},
{
"command": "pnpr@main",
"mean": 0.71298844328,
"stddev": 0.07528335046490357,
"median": 0.6934628297800001,
"user": 0.3579157399999999,
"system": 1.31910652,
"min": 0.67617994628,
"max": 0.9253692382800001,
"times": [
0.67683168328,
0.69563883228,
0.6939688002800001,
0.67848116828,
0.69682369028,
0.6929568592800001,
0.67617994628,
0.68678288528,
0.9253692382800001,
0.70685132928
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.1348341276,
"stddev": 0.036591687395058844,
"median": 3.1265023405,
"user": 1.8723548200000004,
"system": 2.04632758,
"min": 3.101300715,
"max": 3.228463255,
"times": [
3.110981959,
3.113508394,
3.11970871,
3.149288592,
3.101300715,
3.1103388290000002,
3.133295971,
3.228463255,
3.144359977,
3.137094874
]
},
{
"command": "pacquet@main",
"mean": 3.1373835094000007,
"stddev": 0.03705731059946009,
"median": 3.146552151,
"user": 1.85845992,
"system": 2.0621433799999997,
"min": 3.074988383,
"max": 3.196553503,
"times": [
3.1504931160000003,
3.142611186,
3.152474381,
3.074988383,
3.101046654,
3.106207581,
3.1512516010000002,
3.196553503,
3.178925882,
3.119282807
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6890683537000001,
"stddev": 0.009213946688189964,
"median": 0.6907891700000001,
"user": 0.3725575199999999,
"system": 1.30263678,
"min": 0.6686400160000001,
"max": 0.6983760470000001,
"times": [
0.6983760470000001,
0.6686400160000001,
0.693590727,
0.684065797,
0.6879876130000001,
0.6945059950000001,
0.697285086,
0.684457913,
0.6975400190000001,
0.6842343240000001
]
},
{
"command": "pnpr@main",
"mean": 0.6774310696000001,
"stddev": 0.013634815111080154,
"median": 0.6741047205000001,
"user": 0.35523141999999996,
"system": 1.27891808,
"min": 0.6667327730000001,
"max": 0.714709608,
"times": [
0.6737493360000001,
0.6745258730000001,
0.6714140670000001,
0.6667327730000001,
0.6716313130000001,
0.6744601050000001,
0.6706689880000001,
0.714709608,
0.6749359290000001,
0.6814827040000001
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6412950265600001,
"stddev": 0.013679611066183268,
"median": 0.64257943436,
"user": 0.60832124,
"system": 0.15315339999999997,
"min": 0.6208866148600001,
"max": 0.66241463686,
"times": [
0.6511668928600001,
0.64097340386,
0.63281497086,
0.6334745968600001,
0.6208866148600001,
0.64817924786,
0.6441854648600001,
0.62317464286,
0.66241463686,
0.6556797938600001
]
},
{
"command": "pacquet@main",
"mean": 0.6463403197600001,
"stddev": 0.011485293825163825,
"median": 0.64553973186,
"user": 0.6116151399999998,
"system": 0.15491090000000002,
"min": 0.6309167188600001,
"max": 0.6719146638600001,
"times": [
0.65069563586,
0.6493007888600001,
0.6370194398600001,
0.6309167188600001,
0.63731687286,
0.64084854686,
0.64699993986,
0.6719146638600001,
0.6543110668600001,
0.6440795238600001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10787565030000001,
"stddev": 0.00039773726133456684,
"median": 0.10783611386,
"user": 0.028375759999999993,
"system": 0.018463399999999998,
"min": 0.10724572486,
"max": 0.10884308386,
"times": [
0.10761338886,
0.10818965986,
0.10852966886,
0.10724572486,
0.10772322286,
0.10783611386,
0.10780963386,
0.10756648186000001,
0.10756627186,
0.10735331586,
0.10858091986,
0.10797308886,
0.10805791486,
0.10813131086,
0.10769212286,
0.10776549786,
0.10787174386000001,
0.10786372986000001,
0.10729147086,
0.10884308386,
0.10750296886,
0.10820046086,
0.10796870586,
0.10760331986,
0.10811143586000001
]
},
{
"command": "pnpr@main",
"mean": 0.10808226746000002,
"stddev": 0.0008452411884849801,
"median": 0.10784919386,
"user": 0.026923239999999998,
"system": 0.02023772,
"min": 0.10708352486,
"max": 0.11102403986,
"times": [
0.10720485086,
0.10762743586,
0.10833593286,
0.10793779186,
0.10871066886,
0.10747249386,
0.10773408786000001,
0.10784919386,
0.10784467986,
0.10788387286000001,
0.10800164086,
0.10761088486,
0.10828709186,
0.10761396586000001,
0.11014930286,
0.11102403986,
0.10847452086,
0.10825894986000001,
0.10708352486,
0.10790404986,
0.10770133786,
0.10774293486,
0.10797270286,
0.10779694186,
0.10783378886
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.606931111260001,
"stddev": 0.17824769167790627,
"median": 6.54487449526,
"user": 3.8366802399999997,
"system": 3.7320283599999997,
"min": 6.39236242226,
"max": 6.8905749502599996,
"times": [
6.77266895226,
6.50874507826,
6.49346448826,
6.58465385026,
6.58100391226,
6.46055902326,
6.88262258526,
6.39236242226,
6.50265585026,
6.8905749502599996
]
},
{
"command": "pacquet@main",
"mean": 6.645925883560001,
"stddev": 0.12973783708473993,
"median": 6.614755821759999,
"user": 3.8108048400000003,
"system": 3.73750846,
"min": 6.4314925682599995,
"max": 6.91482651126,
"times": [
6.77726326926,
6.608158825259999,
6.60731228426,
6.62135281826,
6.4314925682599995,
6.70364465626,
6.592103607259999,
6.91482651126,
6.63517436426,
6.56792993126
]
},
{
"command": "pnpr@HEAD",
"mean": 5.098751204859999,
"stddev": 0.1550710111098305,
"median": 5.09536845226,
"user": 2.82800934,
"system": 3.3029152600000002,
"min": 4.92054080326,
"max": 5.37518788426,
"times": [
4.92054080326,
4.94451752026,
5.19105544126,
5.22723061526,
5.030510309259999,
5.37518788426,
4.94022247626,
4.9852904022599995,
5.21273000126,
5.16022659526
]
},
{
"command": "pnpr@main",
"mean": 4.936288956459999,
"stddev": 0.03351037601367265,
"median": 4.93439242926,
"user": 2.78179964,
"system": 3.28991156,
"min": 4.87248298826,
"max": 5.00020058226,
"times": [
4.93604011226,
4.93269022526,
4.95765336426,
4.87248298826,
4.9523900552599995,
4.91433385626,
5.00020058226,
4.93274474626,
4.95079813426,
4.91355550026
]
}
]
} |
|
| Branch | pr/12914 |
| 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,299.53 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 689.07 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 691.13 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 107.88 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,146.02 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 5,098.75 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 737.63 ms |
pnpm installs a workspace whose root has no package.json with no root importer and never creates one. pacquet's State::init scaffolded the init-template package.json there instead, which diverges on disk and, since the verify-deps-before-run gate started spawning an install ahead of every run (pnpm#12910), poisoned recursive runs: the scaffolded manifest carries npm's default failing test script, the root joined the workspace graph as a selectable project, and a root change (like pnpm-workspace.yaml) selected it — which is what broke run_recursive's test_pattern_from_workspace_yaml_is_respected_by_the_test_script on main after pnpm#12910 landed on top of pnpm#12914. Inside a workspace the stand-in root manifest now stays in memory only. Non-workspace installs keep scaffolding, and commands that save the manifest (add) still persist it through their explicit save. The remaining shape difference — pacquet still writes an empty root importer to pnpm-lock.yaml where pnpm writes none — is a separate, smaller parity gap. Co-Authored-By: Claude Fable 5 <[email protected]>
pnpm's option parser accepts --if-present before the script (`pnpm --workspace-concurrency=1 --no-sort --if-present .test`), but pacquet's clap surface only declared it on the run/stop/restart subcommands, so the top-level spelling failed to parse. This is the exact shape of the repo's own test-pkgs-branch script, which every pull-request TS CI job runs — together with the changed-packages filter selector (pnpm#12914), this unblocks the ci:test-branch job once a pnpm v12 alpha carrying both is released and the repo's packageManager is bumped. The flag is declared top-level like the other run-scoped options (--resume-from, --report-summary, --no-bail) but deliberately not clap-global: run/stop/restart declare their own --if-present, and a propagated global flag would collide with theirs. Validation rejects it for non-script commands the same way as the other run-scoped flags, plus restart, which also runs scripts. Co-Authored-By: Claude Fable 5 <[email protected]>
pnpm installs a workspace whose root has no package.json with no root importer and never creates one. pacquet's State::init scaffolded the init-template package.json there instead, which diverges on disk and, since the verify-deps-before-run gate started spawning an install ahead of every run (pnpm#12910), poisoned recursive runs: the scaffolded manifest carries npm's default failing test script, the root joined the workspace graph as a selectable project, and a root change (like pnpm-workspace.yaml) selected it — which is what broke run_recursive's test_pattern_from_workspace_yaml_is_respected_by_the_test_script on main after pnpm#12910 landed on top of pnpm#12914. Inside a workspace the stand-in root manifest now stays in memory only. Non-workspace installs keep scaffolding, and commands that save the manifest (add) still persist it through their explicit save. The remaining shape difference — pacquet still writes an empty root importer to pnpm-lock.yaml where pnpm writes none — is a separate, smaller parity gap. Co-Authored-By: Claude Fable 5 <[email protected]>
pnpm's option parser accepts --if-present before the script (`pnpm --workspace-concurrency=1 --no-sort --if-present .test`), but pacquet's clap surface only declared it on the run/stop/restart subcommands, so the top-level spelling failed to parse. This is the exact shape of the repo's own test-pkgs-branch script, which every pull-request TS CI job runs — together with the changed-packages filter selector (pnpm#12914), this unblocks the ci:test-branch job once a pnpm v12 alpha carrying both is released and the repo's packageManager is bumped. The flag is declared top-level like the other run-scoped options (--resume-from, --report-summary, --no-bail) but deliberately not clap-global: run/stop/restart declare their own --if-present, and a propagated global flag would collide with theirs. Validation rejects it for non-script commands the same way as the other run-scoped flags, plus restart, which also runs scripts. Co-Authored-By: Claude Fable 5 <[email protected]>
pnpm installs a workspace whose root has no package.json with no root importer and never creates one. pacquet's State::init scaffolded the init-template package.json there instead, which diverges on disk and, since the verify-deps-before-run gate started spawning an install ahead of every run (pnpm#12910), poisoned recursive runs: the scaffolded manifest carries npm's default failing test script, the root joined the workspace graph as a selectable project, and a root change (like pnpm-workspace.yaml) selected it — which is what broke run_recursive's test_pattern_from_workspace_yaml_is_respected_by_the_test_script on main after pnpm#12910 landed on top of pnpm#12914. Inside a workspace the stand-in root manifest now stays in memory only. Non-workspace installs keep scaffolding, and commands that save the manifest (add) still persist it through their explicit save. The remaining shape difference — pacquet still writes an empty root importer to pnpm-lock.yaml where pnpm writes none — is a separate, smaller parity gap. Co-Authored-By: Claude Fable 5 <[email protected]>
pnpm installs a workspace whose root has no package.json with no root importer and never creates one. pacquet's State::init scaffolded the init-template package.json there instead, which diverges on disk and, since the verify-deps-before-run gate started spawning an install ahead of every run (pnpm#12910), poisoned recursive runs: the scaffolded manifest carries npm's default failing test script, the root joined the workspace graph as a selectable project, and a root change (like pnpm-workspace.yaml) selected it — which is what broke run_recursive's test_pattern_from_workspace_yaml_is_respected_by_the_test_script on main after pnpm#12910 landed on top of pnpm#12914. Inside a workspace the stand-in root manifest now stays in memory only. Non-workspace installs keep scaffolding, and commands that save the manifest (add) still persist it through their explicit save. The remaining shape difference — pacquet still writes an empty root importer to pnpm-lock.yaml where pnpm writes none — is a separate, smaller parity gap. Co-Authored-By: Claude Fable 5 <[email protected]>
…o pnpr (#12922) Port `pnpm stage` (publish, list, view, approve, reject, download) to the Rust CLI, mirroring the TypeScript command's flags, error codes, endpoints, and output. `stage publish` reuses the publish pipeline (PublishArgs is split into a reusable PublishFlags, and the pipeline returns summaries instead of printing); approve/reject drive the shared OTP / web-auth flow; download summarizes the tarball with the same traversal protections as the TypeScript implementation. Also fixes the staged-publish route in pacquet-publish to POST -/stage/package/:pkg (libnpmpublish's stage route) instead of the regular packument PUT — previously unreachable because the CLI hardcoded stage: false. pnpr grows the server half: POST /-/stage/package/:pkg validates and authorizes like a direct publish and holds the document under a UUID; list/view/tarball inspect held records; approve replays the document through the regular validate/stage/commit flow; reject deletes it. Records persist under a reserved .staged/ namespace on the fs and S3 backends, with stage-id validation ahead of any path or object key. Shared plumbing: the capped response-body reader moves from the dist-tag command into pacquet-network, and pacquet-pack exports its en-locale path sort for the tarball summary. Also fixes a broken test on main (semantic conflict between #12910 and #12914): State::init no longer persists a scaffolded root package.json when a pnpm-workspace.yaml sits next to the missing manifest, so a verify-deps-before-run install can't turn the workspace root into a selectable project with the init template's failing test script.
pnpm's option parser accepts --if-present before the script (`pnpm --workspace-concurrency=1 --no-sort --if-present .test`), but pacquet's clap surface only declared it on the run/stop/restart subcommands, so the top-level spelling failed to parse. This is the exact shape of the repo's own test-pkgs-branch script, which every pull-request TS CI job runs — together with the changed-packages filter selector (pnpm#12914), this unblocks the ci:test-branch job once a pnpm v12 alpha carrying both is released and the repo's packageManager is bumped. The flag is declared top-level like the other run-scoped options (--resume-from, --report-summary, --no-bail) but deliberately not clap-global: run/stop/restart declare their own --if-present, and a propagated global flag would collide with theirs. Validation rejects it for non-script commands the same way as the other run-scoped flags, plus restart, which also runs scripts. Co-Authored-By: Claude Fable 5 <[email protected]>
…caffolding a root manifest (#12919) Accept --if-present ahead of the script name, the way pnpm's option parser does. The repo's own test-pkgs-branch script uses that spelling, so every PR TS CI job died at argument parsing under the pacquet-based pnpm v12. Declared top-level like the other run-scoped options but not clap-global (run/stop/restart declare their own --if-present), merged with the subcommand flags, validated like --resume-from/--no-bail. Rejected for exec like pnpm, where dispatch would drop it silently. Never scaffold a missing manifest inside a workspace. Gate State::init's no-scaffold path on workspace membership (config.workspace_dir) rather than a pnpm-workspace.yaml beside the missing manifest, so installs in workspace member directories can't scaffold a package.json either — pnpm never creates one anywhere in a workspace. Keep an empty object as the in-memory stand-in instead of the init template: pnpm's add at a rootless workspace root persists a manifest holding only the added dependencies, and the template's failing test script would otherwise ride along on any explicit save. Together with #12914 this unblocks the ci:test-branch job once a pnpm v12 alpha carrying both is released and packageManager is bumped.
Summary
Ports git-diff project selection (
getChangedProjects) from@pnpm/workspace.projects-filterto pacquet, so a--filter "...[<since>]"selector selects the workspace projects whose files changed since the given git ref instead of failing withpacquet_workspace_projects_filter::unsupported_diff_selector.This fixes the
ci:test-branchCI job, which currently fails on every PR because.github/scripts/run-ts-tests-chunk.mjsdiscovers affected packages withpn --filter=...[origin/main] -r list --depth=-1 --jsonand the pacquet-based@pnpm/exerejects the selector (example failure: https://github.com/pnpm/pnpm/actions/runs/29056291664/job/86252459055).What the port covers, mirroring the TypeScript implementation:
git diff --name-only <since> -- <workspace_dir>runs in the selector's{dir}part when present, else the workspace root; diff paths are resolved against the parent of the nearest.gitdirectory, falling back to the nearest.gitfile (git worktrees).changedFilesIgnorePatternare ignored; projects whose changes all matchtestPatternare selected without their dependents. Patterns are matched withwax, the glob crate pacquet already uses where upstream uses micromatch/fast-glob.ERR_PNPM_FILTER_CHANGEDerror code with the same message text.testPattern/changedFilesIgnorePatternsettings are read frompnpm-workspace.yamlandPNPM_CONFIG_*env vars, overridable by the new global--test-pattern/--changed-files-ignore-patternflags, and excluded from the globalconfig.yaml— matching the TypeScript config surface.The feature itself already exists in the TypeScript CLI; this PR closes the parity gap on the pacquet side. Review of the port surfaced two bugs present in both stacks, which are fixed here in both (per the repo's parity rule):
--filter "[--output=<path>]"madegit diffwrite its output to an arbitrary file and exit 0. Both stacks now pass--end-of-options, so git rejects option-like refs as bad revisions underERR_PNPM_FILTER_CHANGED..gitdirectory anywhere up the tree over the worktree's.gitfile, anchoring diff paths at the wrong root. Both stacks now use the nearest.gitentry of either kind (TypeScript:find.up).Verification against the failing job:
pn --filter=...[origin/main] -r list --depth=-1 --jsonnow succeeds at this repository's root (a git worktree, so the.git-file path is exercised).node .github/scripts/run-ts-tests-chunk.mjs --script ci:test-branch --chunk 1 --chunks 10 --dry-runwith the patched binary on PATH aspncompletes and selects test tasks from the changed packages (it previously exited 1 at the list step).pnpm11/pnpm/dist/pnpm.mjs) and the patched pacquet binary select the byte-identical project set for...[origin/main]on this repo — also when--test-patternor--changed-files-ignore-patternis added.workspace/projects-filterunit tests, from theirknown_failuresstubs intofilter::tests::changed_packages(basic selection including quoted non-ASCII paths, git-worktree layout, and the nonexistent-ref error);pnpm/test/monorepoe2e tests:testPattern is respected by the test script(dependents of a test-only-changed project stay unselected on a recursivetestrun) andchangedFilesIgnorePattern is respected(yaml-configured ignore patterns including brace alternation, plus the empty--changed-files-ignore-pattern=CLI override disabling them);config/readertests (respects testPattern/respects changedFilesIgnorePattern) as workspace-yaml config tests, plus their exclusion from the globalconfig.yaml. The upstream.npmrc-is-ignored case has no pacquet counterpart because pacquet reads no settings from.npmrc, and theparse-cli-argssingle-value--test-patterncase is enforced by clap's declared arity.Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-fable-5).
Summary by CodeRabbit
--test-patternand--changed-files-ignore-patternoptions for controlling project selection.