Skip to content

fix(pacquet): support pnpm repo CI scripts - #12842

Merged
zkochan merged 6 commits into
mainfrom
fix-pq12
Jul 7, 2026
Merged

zkochan merged 6 commits into
mainfrom
fix-pq12

Conversation

@zkochan

@zkochan zkochan commented Jul 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Pacquet now reads package.yaml as a project manifest in the shared workspace manifest reader. Script commands (run, top-level shorthand fallback, test, start, and stop) use that reader, so pnpm --dir=pnpm11/__fixtures__ prepareFixtures works when the target project only has package.yaml.

Workspace project discovery also matches package.yaml projects while preserving package.json precedence when both files exist.

Pacquet also parses recursive script options before a fallback script command, matching pnpm's CI shape for pn --no-sort --workspace-concurrency=1 -r --report-summary .test. --no-sort now preserves workspace order for recursive run and exec, lifecycle aliases that TypeScript pnpm treats like run scripts (test, start, and stop) accept the same recursive script flags, and unrelated commands still reject them. publish --report-summary is preserved when it is captured by the shared parser, so filtered publish jobs can write an empty summary instead of failing during argument validation.

Related to #12811.

Squash Commit Body

Pacquet's script dispatch still assumed a project manifest was always package.json. The pnpm/pnpm v12 CI update runs pnpm --dir=pnpm11/__fixtures__ prepareFixtures, and that fixture declares its scripts in package.yaml. The TypeScript CLI reads package.yaml through the project manifest reader, so pacquet fell through to exec and reported the command missing.

Add read-only package.yaml support to pacquet's shared project-manifest reader, teach workspace project discovery to match both package.json and package.yaml while keeping package.json precedence, and route script execution through that reader. This makes shorthand script fallback, run, test, start, and PNPM_PACKAGE_NAME stamping behave consistently for YAML manifests.

The next CI step also invokes the shorthand recursive script form as pn --no-sort --workspace-concurrency=1 -r --report-summary .test. Parse these recursive script options at the top level so fallback commands receive them, apply workspace-concurrency through the shared config, and implement --no-sort ordering for recursive run and exec by preserving workspace order. Validate the shared parser so unrelated commands still reject script-only flags, while test/start/stop accept the run-compatible recursive flags and publish keeps --report-summary for filtered publish summaries.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pacquet/ port, or the description notes what still needs porting. TypeScript pnpm already supports package.yaml project manifests and the recursive script option shape; this PR fills the pacquet gaps.
  • Added or updated tests.

Written by an agent (Codex, GPT-5).

Summary by CodeRabbit

  • New Features

    • Workspace commands now recognize both package.json and package.yaml.
    • Recursive run/exec now support --sort / --no-sort ordering controls.
    • Added --workspace-concurrency for supported recursive commands.
  • Bug Fixes

    • Improved manifest discovery and precedence when both manifest formats are present.
    • Script selection and fallback behavior now align with ordering when sorting is disabled.
    • Stricter validation for scoped recursive flags at command boundaries.
  • Chores

    • Removed install-time workspace concurrency support.

Copilot AI review requested due to automatic review settings July 7, 2026 14:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds package.yaml support to manifest reading and workspace discovery, threads recursive CLI options through dispatch and validation, and updates recursive run/exec flows to use shared manifest loading and honor sort control.

Changes

Manifest and recursive CLI updates

Layer / File(s) Summary
YAML manifest reading
pacquet/crates/workspace/src/project_manifest.rs, pacquet/crates/workspace/src/project_manifest/tests.rs, pacquet/crates/cli/tests/run.rs
Manifest reading now probes and parses both package.json and package.yaml, adding ReadFile/ParseYaml error variants and corresponding tests including a CLI integration test running a YAML-defined script.
Workspace project discovery
pacquet/crates/workspace/src/projects.rs, pacquet/crates/workspace/src/projects/tests.rs
Workspace pattern expansion covers both manifest basenames, deduplicates discovered projects by root directory, and tests verify YAML discovery and JSON-over-YAML precedence.
Recursive CLI option plumbing
pacquet/crates/cli/src/cli_args/dispatch.rs, pacquet/crates/cli/src/cli_args/dispatch_script.rs, pacquet/crates/cli/src/cli_args/exec.rs, pacquet/crates/cli/src/cli_args/pipelines.rs, pacquet/crates/cli/src/cli_args/install.rs, pacquet/crates/cli/src/cli_args/install/tests.rs, pacquet/crates/cli/src/cli_args/restart.rs, pacquet/crates/cli/src/cli_args/stop.rs, pacquet/crates/cli/src/cli_args/dispatch_query.rs
RunCtx gains recursive fields populated from CLI args, recursive option copying is centralized for run/exec dispatch, exec.rs reads package names via the shared manifest helper, install workspace-concurrency wiring is removed, and lifecycle/query paths now set or merge recursive sort/report settings.
Recursive run and exec behavior
pacquet/crates/cli/src/cli_args/run.rs, pacquet/crates/cli/src/cli_args/run/recursive.rs, pacquet/crates/cli/src/cli_args/exec/recursive.rs, pacquet/crates/cli/src/lib.rs, pacquet/crates/cli/tests/run_recursive.rs
Recursive execution chunking now branches on the sort flag, manifest reads switch to the shared workspace helper, fallback and lifecycle script runners set sort: true, and main validates command-scoped globals before dispatch.
Global recursive flag validation
pacquet/crates/cli/src/cli_args/cli_command.rs, pacquet/crates/cli/src/lib.rs, pacquet/crates/cli/src/cli_args/tests.rs
New CliArgs fields (sort, no_sort, workspace_concurrency, resume_from, report_summary, no_bail) are validated against supported subcommands, main invokes this validation before dispatch, and tests cover accepted and rejected flag placements.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • pnpm/pnpm#11938: Directly refactors the same pacquet run/exec CLI recursive flag wiring and manifest-reading logic.
  • pnpm/pnpm#12093: Modifies the recursive pacquet run CLI plumbing for --resume-from/--report-summary options mirrored in this PR.
  • pnpm/pnpm#12688: Updates recursive execution chunk ordering using the same filtered/transitive-aware sorter logic touched here.

Suggested labels: product: pacquet

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-pq12

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

fix(pacquet): add package.yaml support to manifest reader and script dispatch

🐞 Bug fix ✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds read-only package.yaml parsing (via serde_saphyr) to the shared pacquet_workspace
 project-manifest reader, with package.json taking precedence when both files exist.
• Routes run, test, start, top-level shorthand fallback, and PNPM_PACKAGE_NAME stamping
 through the updated reader so all script commands work for YAML-only projects.
• Updates workspace project discovery (find_workspace_projects) to glob for both package.json
 and package.yaml, deduplicate by directory, and skip missing literal paths gracefully.
• Adds new error variants (ReadFile, ParseYaml) and updates error messages to mention both
 manifest formats.
• Adds integration and unit tests covering YAML manifest reading, JSON-over-YAML precedence,
 workspace glob expansion, and the --dir + package.yaml scenario that triggered the fix.
Diagram

graph TD
    CLI["CLI dispatch"] --> DS["dispatch_script.rs\ntest / start"]
    CLI --> RUN["run.rs\nrun / fallback"]
    CLI --> EXEC["exec.rs\nPNPM_PACKAGE_NAME"]
    DS --> RPM["read_project_manifest_only"]
    RUN --> RPM
    EXEC --> SRPM["safe_read_project_manifest_only"]
    RPM --> REPM["read_exact_project_manifest"]
    SRPM --> REPM
    REPM --> JSON[("package.json")]
    REPM --> YAML[("package.yaml")]
    PROJ["projects.rs\nworkspace discovery"] --> REPM
    PROJ --> JSON
    PROJ --> YAML

    subgraph Legend
        direction LR
        _mod["Module / Function"] ~~~ _file[("Manifest file")]
    end
Loading
High-Level Assessment

The PR's approach is optimal: centralising YAML parsing in the existing read_exact_project_manifest / try_read_project_manifest layer means every consumer (run, test, start, exec, workspace discovery) gets the fix for free without duplicating parser logic. Using serde_saphyr (already a transitive dependency via pnpm's ecosystem) avoids adding a new dependency. The package.json-first probe order correctly mirrors pnpm's own precedence. No meaningful alternative approach was identified.

Files changed (8) +246 / -87

Enhancement (2) +104 / -67
project_manifest.rsAdd package.yaml parsing to the shared project-manifest reader +49/-26

Add package.yaml parsing to the shared project-manifest reader

• Introduces 'read_package_yaml' using 'serde_saphyr' and wires it into 'read_exact_project_manifest'. Updates 'try_read_project_manifest' to probe 'package.json' then 'package.yaml' in order, so JSON always wins. Adds 'ReadFile' and 'ParseYaml' error variants and updates 'ReadProjectManifestOnlyError' to wrap the richer 'ReadProjectManifestError'.

pacquet/crates/workspace/src/project_manifest.rs

projects.rsExpand workspace project discovery to match package.yaml alongside package.json +55/-41

Expand workspace project discovery to match package.yaml alongside package.json

• Replaces 'normalize_pattern' (single basename) with 'normalize_manifest_patterns' (returns one glob per supported basename). Adds 'is_literal_pattern' to skip non-existent literal paths without erroring. Introduces 'seen_roots' deduplication so a directory with both manifest files is only included once (JSON wins due to sort order). Adds 'PROJECT_MANIFEST_BASENAMES' constant and handles the new 'ReadFile' ENOENT case in the mid-walk swallow.

pacquet/crates/workspace/src/projects.rs

Bug fix (3) +16 / -18
dispatch_script.rsRoute test and start commands through the shared manifest reader +5/-4

Route test and start commands through the shared manifest reader

• Replaces direct 'PackageManifest::from_path(ctx.manifest_path)' calls in 'test' and 'start' with 'read_project_manifest_only(ctx.dir)', enabling both commands to find scripts in 'package.yaml'.

pacquet/crates/cli/src/cli_args/dispatch_script.rs

run.rsRoute run command through the shared manifest reader +8/-6

Route run command through the shared manifest reader

• Replaces 'PackageManifest::from_path(dir.join("package.json"))' with 'read_project_manifest_only(dir)' in both the list-scripts and execute-script paths. Updates the 'RunError::Manifest' variant to hold 'ReadProjectManifestOnlyError' and adjusts the 'NoImporterManifestFound' match arm accordingly.

pacquet/crates/cli/src/cli_args/run.rs

exec.rsUse shared manifest reader for PNPM_PACKAGE_NAME stamping in exec +3/-8

Use shared manifest reader for PNPM_PACKAGE_NAME stamping in exec

• Replaces 'PackageManifest::from_path(dir.join("package.json"))' in 'read_package_name' with 'safe_read_project_manifest_only(dir)', so 'PNPM_PACKAGE_NAME' is also populated when the project uses 'package.yaml'.

pacquet/crates/cli/src/cli_args/exec.rs

Tests (3) +126 / -2
run.rsAdd integration test for top-level fallback with a package.yaml project +28/-0

Add integration test for top-level fallback with a package.yaml project

• Adds 'top_level_fallback_runs_package_yaml_script_with_dir', which creates a fixture directory containing only 'package.yaml', invokes pacquet with '--dir', and asserts the script runs successfully.

pacquet/crates/cli/tests/run.rs

tests.rsAdd unit tests for package.yaml reading and JSON-over-YAML precedence +34/-2

Add unit tests for package.yaml reading and JSON-over-YAML precedence

• Adds 'try_read_returns_yaml_manifest_when_json_is_missing', 'try_read_prefers_json_over_yaml', and 'read_exact_accepts_package_yaml'. Updates 'read_exact_rejects_other_basenames' to use 'package.json5' now that 'package.yaml' is a valid basename.

pacquet/crates/workspace/src/project_manifest/tests.rs

tests.rsAdd workspace discovery tests for package.yaml projects and precedence +64/-0

Add workspace discovery tests for package.yaml projects and precedence

• Adds 'make_yaml_project' helper and four new tests: glob expansion to YAML projects, direct literal patterns not requiring all manifest formats, JSON-wins-over-YAML precedence in workspace discovery, and a deduplication check.

pacquet/crates/workspace/src/projects/tests.rs

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 51 rules

Grey Divider


Action required

1. Start fallback ignores --dir ✓ Resolved 🐞 Bug ☼ Reliability ⭐ New
Description
dispatch_script::start now uses RunArgs’ start fallback logic, which checks for server.js
under the process current working directory (init_cwd), not the target project directory. As a
result, pacquet --dir <project> start can fail with “Missing script start or file server.js” even
when <project>/server.js exists.
Code

pacquet/crates/cli/src/cli_args/dispatch_script.rs[R92-94]

pub(super) fn start<'a>(ctx: &RunCtx<'a>) -> miette::Result<CommandFuture<'a>> {
-    let manifest = PackageManifest::from_path(ctx.manifest_path.to_path_buf())
-        .wrap_err("getting the package.json in current directory")?;
-    let command = manifest.script("start", true)?.unwrap_or("node server.js");
-    execute_shell(command).wrap_err(format!(r#"executing command: "{command}""#))?;
-    Ok(Box::pin(std::future::ready(Ok(()))))
+    run(ctx, run_args_for_script("start"))
}
Evidence
The changed start dispatch now routes into RunArgs, which sets init_cwd from the process CWD.
The start fallback check explicitly uses ctx.init_cwd/server.js, so when --dir points
elsewhere, the existence check can be evaluated against the wrong directory.

pacquet/crates/cli/src/cli_args/dispatch_script.rs[92-94]
pacquet/crates/cli/src/cli_args/run.rs[166-174]
pacquet/crates/cli/src/cli_args/run.rs[234-258]

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

### Issue description
The `start` alias now goes through `RunArgs`, and the `start` fallback (`node server.js`) is guarded by a file-existence check against `init_cwd` (process CWD). When `--dir` targets a different project directory, this check can reject valid projects.

### Issue Context
`RunArgs::run_inner` sets `init_cwd` from `env::current_dir()`, while `--dir` affects the `dir` argument passed into `RunArgs::run(...)`. `resolve_main_script` then checks `ctx.init_cwd/server.js` instead of the directory scripts run from (`ctx.dir`).

### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/dispatch_script.rs[92-94]
- pacquet/crates/cli/src/cli_args/run.rs[166-174]
- pacquet/crates/cli/src/cli_args/run.rs[234-258]

### Suggested fix
In `resolve_main_script`, change the `server.js` existence check to use the script execution directory (`ctx.dir.join("server.js")`) rather than `ctx.init_cwd`. Keep `init_cwd` for its intended semantics (INIT_CWD-like behavior), but don’t use it to validate presence of `server.js` for `start` fallback.

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


2. Test errors when missing ✓ Resolved 🐞 Bug ≡ Correctness ⭐ New
Description
dispatch_script::test now dispatches via RunArgs with if_present=false, so pacquet test
errors when scripts.test is undefined. This contradicts the documented CliCommand::Test contract
(“if one was provided”) and is a user-visible behavior regression for projects without a test
script.
Code

pacquet/crates/cli/src/cli_args/dispatch_script.rs[R113-122]

+fn run_args_for_script(command: &str) -> RunArgs {
+    RunArgs {
+        command: Some(command.to_string()),
+        args: Vec::new(),
+        if_present: false,
+        resume_from: None,
+        report_summary: false,
+        no_bail: false,
+        sort: true,
+    }
Evidence
The new dispatch routes test through run_args_for_script("test"), which hard-codes `if_present:
false. The underlying RunArgs implementation errors on missing scripts unless if_present` is
set, while the CLI command is documented as conditional (“if one was provided”).

pacquet/crates/cli/src/cli_args/dispatch_script.rs[29-31]
pacquet/crates/cli/src/cli_args/dispatch_script.rs[113-122]
pacquet/crates/cli/src/cli_args/run.rs[115-151]
pacquet/crates/cli/src/cli_args/cli_command.rs[270-271]

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

### Issue description
`pacquet test` now errors when `scripts.test` is missing because the new shared helper builds `RunArgs` with `if_present: false`.

### Issue Context
The CLI enum documents `Test` as “Runs a package's \"test\" script, if one was provided.” The old implementation was effectively a no-op when the script was absent; the new runner path treats missing scripts as an error unless `if_present` is enabled.

### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/dispatch_script.rs[29-31]
- pacquet/crates/cli/src/cli_args/dispatch_script.rs[113-123]
- pacquet/crates/cli/src/cli_args/cli_command.rs[270-271]
- pacquet/crates/cli/src/cli_args/run.rs[115-151]

### Suggested fix
Special-case the `test` alias to set `if_present = true` before calling `run(ctx, args)` (or make `run_args_for_script("test")` produce `if_present: true`). This restores the documented behavior without affecting `run`/`exec` subcommands.

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


3. --resume-from is globally accepted ✓ Resolved 📘 Rule violation ≡ Correctness
Description
--resume-from and --report-summary are declared as global CLI flags, so they can be passed to
unrelated subcommands (e.g., install) and will parse successfully even though pnpm defines them
only for run/exec flows. This introduces pnpm-incompatible user-visible behavior by accepting
flags in contexts pnpm would not.
Code

pacquet/crates/cli/src/cli_args/cli_command.rs[R143-149]

+    /// Recursive only: resume execution from the given package.
+    #[clap(long = "resume-from", global = true)]
+    pub resume_from: Option<String>,
+
+    /// Recursive only: write a `pnpm-exec-summary.json` execution report.
+    #[clap(long = "report-summary", global = true)]
+    pub report_summary: bool,
Evidence
Pacquet declares --resume-from and --report-summary as global = true, which means clap will
accept them regardless of subcommand. Pnpm’s own help/options show these flags belong to run and
exec, while recursive-global options (like --sort) are documented separately; therefore making
resume-from/report-summary global across pacquet diverges from pnpm behavior.

Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pacquet/crates/cli/src/cli_args/cli_command.rs[131-153]
pacquet/crates/cli/src/cli_args/tests.rs[75-102]
pnpm11/exec/commands/src/run.ts[98-113]
pnpm11/exec/commands/src/exec.ts[41-54]
pnpm11/pnpm/src/cmd/recursive.ts[83-114]

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

## Issue description
`--resume-from` and `--report-summary` are currently top-level `global` clap flags, which makes pacquet accept them for any subcommand. In pnpm, these flags are `run`/`exec`-specific (not general recursive options), so accepting them for other commands is pnpm-incompatible.

## Issue Context
The new flags were added to support recursive `run`/`exec` and top-level fallback parsing, but the current clap shape makes them valid everywhere.

## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/cli_command.rs[143-149]
- pacquet/crates/cli/src/cli_args/dispatch.rs[32-35]
- pacquet/crates/cli/src/cli_args/dispatch.rs[235-238]

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



Remediation recommended

4. clap::Error::exit() bypasses miette 📘 Rule violation ◔ Observability
Description
The new script-scoped global flag validation returns a clap::Error and is surfaced via
err.exit(), printing directly instead of routing through miette/pacquet-diagnostics. This adds
a new user-facing error path that violates the requirement for centralized miette-based diagnostics
rendering.
Code

pacquet/crates/cli/src/lib.rs[R61-63]

+    if let Err(err) = args.validate_command_scoped_global_options() {
+        err.exit();
+    }
Evidence
PR Compliance ID 713453 requires user-facing CLI errors to be routed through miette via
pacquet-diagnostics. The new validation is invoked in main() and failures call err.exit(), and
the validator constructs a clap::Error (ErrorKind::UnknownArgument) instead of a diagnostic
type.

Rule 713453: Route user-facing errors through miette via pacquet-diagnostics
pacquet/crates/cli/src/lib.rs[61-63]
pacquet/crates/cli/src/cli_args/cli_command.rs[156-193]

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

## Issue description
`validate_command_scoped_global_options()` produces a `clap::Error` that is emitted via `err.exit()`, which bypasses the repo’s required `miette`/`pacquet-diagnostics` user-facing error path.

## Issue Context
This PR introduced new validation for script-scoped global flags (`--resume-from`, `--report-summary`, `--no-bail`). Those validation failures are now a new class of user-facing errors and should be rendered consistently via the diagnostics stack.

## Fix Focus Areas
- pacquet/crates/cli/src/lib.rs[61-63]
- pacquet/crates/cli/src/cli_args/cli_command.rs[156-193]

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


5. Resume-from docs wrong 🐞 Bug ≡ Correctness
Description
With --no-sort, recursive run/exec builds chunks in workspace/insertion order
(graph.keys()), so --resume-from skips based on workspace order rather than the documented
topological order. This makes --resume-from inconsistent/misleading when combined with --no-sort
and can resume from an unexpected point.
Code

pacquet/crates/cli/src/cli_args/run/recursive.rs[R98-107]

+    let mut chunks = if args.sort {
+        sort_filtered_projects(
+            graph,
+            selection.full_graph(),
+            selection.prod_all.as_ref(),
+            &selection.prod_only_selected,
+        )
+    } else {
+        graph.keys().cloned().map(|root| vec![root]).collect()
+    };
Evidence
--no-sort switches chunk construction to workspace/insertion order via graph.keys(), and
get_resumed_package_chunks trims based on chunk position; meanwhile resume_from is still
documented as topological-only, which becomes false under --no-sort.

pacquet/crates/cli/src/cli_args/run/recursive.rs[98-110]
pacquet/crates/cli/src/cli_args/exec/recursive.rs[82-94]
pacquet/crates/cli/src/cli_args/recursive.rs[153-173]
pacquet/crates/cli/src/cli_args/run.rs[34-55]
pacquet/crates/cli/src/cli_args/exec.rs[35-52]

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

### Issue description
`--no-sort` changes the execution ordering of recursive runs to workspace/insertion order, but the `--resume-from` help text and comments still describe skipping packages in *topological* order. Because `get_resumed_package_chunks()` trims based on the already-constructed `chunks` list, the meaning of “earlier” changes under `--no-sort`.

### Issue Context
- In recursive `run`/`exec`, when `args.sort` is false, chunks are built from `graph.keys()` (workspace/insertion order) and then `--resume-from` is applied by dropping earlier chunks.
- The CLI docs for `resume_from` still say “skipping every earlier project in the topological order”, which is no longer true under `--no-sort`.

### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/run.rs[34-55]
- pacquet/crates/cli/src/cli_args/exec.rs[35-52]
- pacquet/crates/cli/src/cli_args/run/recursive.rs[98-110]
- pacquet/crates/cli/src/cli_args/exec/recursive.rs[82-94]

### Suggested fix direction
- Update the `resume_from` doc/help text to describe the actual behavior, e.g. “skipping every earlier project in the current execution order (topological unless `--no-sort`)”.
- Optionally add/adjust a test that asserts `--resume-from` semantics under `--no-sort` (workspace order), so future refactors don’t regress the intended behavior.

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


6. Unbounded YAML manifest read 🐞 Bug ⛨ Security
Description
read_package_yaml reads package.yaml fully into memory and parses it in one shot, with no
explicit file-size guard, so a repository-controlled manifest can cause excessive memory/CPU
consumption during manifest reads. This adds a new resource-exhaustion vector in commands that now
accept package.yaml as the project manifest.
Code

pacquet/crates/workspace/src/project_manifest.rs[R111-120]

+fn read_package_yaml(path: &Path) -> Result<PackageManifest, ReadProjectManifestError> {
+    let text = fs::read_to_string(path).map_err(|source| ReadProjectManifestError::ReadFile {
+        path: path.to_path_buf(),
+        source,
+    })?;
+    let value = serde_saphyr::from_str(&text).map_err(|source| {
+        ReadProjectManifestError::ParseYaml { path: path.to_path_buf(), source: Box::new(source) }
+    })?;
+    Ok(PackageManifest::from_value(path.to_path_buf(), value))
+}
Evidence
The new YAML manifest reader explicitly reads the full file into memory and parses it; this is now
part of the project-manifest reading surface used by CLI and workspace discovery.

pacquet/crates/workspace/src/project_manifest.rs[111-120]
pacquet/crates/workspace/src/project_manifest.rs[60-83]

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

## Issue description
The new `package.yaml` reader (`read_package_yaml`) reads the entire file into a `String` and parses it without any explicit maximum size check. Since manifests are repository-controlled inputs, this can be used to force high resource usage (memory/CPU) when pacquet reads project manifests.

## Issue Context
This PR introduces `package.yaml` support and routes more code paths through the shared manifest reader. Even if YAML parsing is already used elsewhere (e.g. lockfile/workspace config), adding a new manifest type increases the set of files that can trigger worst-case parsing and large allocations.

## Fix Focus Areas
- pacquet/crates/workspace/src/project_manifest.rs[111-120]

### Suggested approach
- Before `read_to_string`, check `fs::metadata(path)?.len()` and reject files above a conservative limit for manifests (pick a threshold appropriate for package manifests).
- Ensure the error is surfaced as a dedicated diagnostic variant (could reuse `ReadFile` or add a `TooLarge { path, bytes, max }`).
- (Optional) Consider parsing only the needed subset (e.g. `name`, `version`, `scripts`, dependency maps) into a struct instead of fully materializing an arbitrary `serde_json::Value`, if you want a stronger resource bound.

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


View more (1)
7. Duplicate glob walks 🐞 Bug ➹ Performance
Description
find_workspace_projects_no_check now expands each include pattern into two separate manifest globs
(package.json and package.yaml) and performs a full Glob::walk for each, doubling filesystem
traversal work for broad patterns like **. This runs on workspace install and recursive command
paths, so large workspaces can see materially slower discovery.
Code

pacquet/crates/workspace/src/projects.rs[R154-178]

+        for normalized in normalize_manifest_patterns(pattern) {
+            if is_literal_pattern(&normalized) && !workspace_root.join(&normalized).is_file() {
+                continue;
+            }
+            let glob =
+                Glob::new(&normalized).map_err(|err| FindWorkspaceProjectsError::InvalidGlob {
+                    pattern: pattern.to_string(),
+                    message: err.to_string(),
+                })?;
+
+            let walk = glob.walk(workspace_root).not(ignore_template.clone()).map_err(|err| {
+                FindWorkspaceProjectsError::InvalidGlob {
+                    pattern: pattern.to_string(),
+                    message: err.to_string(),
+                }
            })?;

-        let walk = glob.walk(workspace_root).not(ignore_template.clone()).map_err(|err| {
-            FindWorkspaceProjectsError::InvalidGlob {
-                pattern: pattern.to_string(),
-                message: err.to_string(),
+            for entry in walk {
+                let entry = entry.map_err(|err| FindWorkspaceProjectsError::Walk {
+                    root: workspace_root.to_path_buf(),
+                    source: std::io::Error::other(err.to_string()),
+                })?;
+                manifest_paths.insert(entry.path().to_path_buf());
            }
-        })?;
-
-        for entry in walk {
-            let entry = entry.map_err(|err| FindWorkspaceProjectsError::Walk {
-                root: workspace_root.to_path_buf(),
-                source: std::io::Error::other(err.to_string()),
-            })?;
-            manifest_paths.insert(entry.path().to_path_buf());
        }
Evidence
The new code walks once per expanded manifest basename (two per user pattern), and workspace
discovery is called from install and recursive flows.

pacquet/crates/workspace/src/projects.rs[152-179]
pacquet/crates/package-manager/src/install.rs[2120-2130]
pacquet/crates/cli/src/cli_args/recursive.rs[203-223]

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

## Issue description
Workspace project discovery currently performs two separate glob walks per include pattern (one for `package.json`, one for `package.yaml`). For broad patterns like `**`, this can double directory traversal overhead on hot paths (workspace install / recursive commands).

## Issue Context
The implementation expands patterns via `normalize_manifest_patterns()` into two patterns and then runs `Glob::walk(...)` inside that loop. This is functionally correct but likely wasteful.

## Fix Focus Areas
- pacquet/crates/workspace/src/projects.rs[152-179]

### Suggested approach
- For non-literal patterns (contain glob metacharacters), replace the two-pattern expansion with a *single* wax pattern using brace expansion, e.g.:
 - `"{trimmed}/{package.json,package.yaml}"` (or `"{trimmed}/{{package.json,package.yaml}}"` depending on wax’s brace syntax).
 - This keeps behavior but reduces to one walk per user pattern.
- Keep the existing literal fast-path behavior (or improve it): for literal directory patterns like `packages/alpha`, directly check for `packages/alpha/package.json` and `packages/alpha/package.yaml` and insert whichever exists, without walking.
- Apply the same “single-pattern” approach to negation patterns if possible, to avoid doubling ignore glob complexity as well.

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


Grey Divider

Previous review results

Review updated until commit 1cad2bd

Results up to commit 2089d9e


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


Remediation recommended
1. Unbounded YAML manifest read 🐞 Bug ⛨ Security
Description
read_package_yaml reads package.yaml fully into memory and parses it in one shot, with no
explicit file-size guard, so a repository-controlled manifest can cause excessive memory/CPU
consumption during manifest reads. This adds a new resource-exhaustion vector in commands that now
accept package.yaml as the project manifest.
Code

pacquet/crates/workspace/src/project_manifest.rs[R111-120]

+fn read_package_yaml(path: &Path) -> Result<PackageManifest, ReadProjectManifestError> {
+    let text = fs::read_to_string(path).map_err(|source| ReadProjectManifestError::ReadFile {
+        path: path.to_path_buf(),
+        source,
+    })?;
+    let value = serde_saphyr::from_str(&text).map_err(|source| {
+        ReadProjectManifestError::ParseYaml { path: path.to_path_buf(), source: Box::new(source) }
+    })?;
+    Ok(PackageManifest::from_value(path.to_path_buf(), value))
+}
Evidence
The new YAML manifest reader explicitly reads the full file into memory and parses it; this is now
part of the project-manifest reading surface used by CLI and workspace discovery.

pacquet/crates/workspace/src/project_manifest.rs[111-120]
pacquet/crates/workspace/src/project_manifest.rs[60-83]

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

## Issue description
The new `package.yaml` reader (`read_package_yaml`) reads the entire file into a `String` and parses it without any explicit maximum size check. Since manifests are repository-controlled inputs, this can be used to force high resource usage (memory/CPU) when pacquet reads project manifests.

## Issue Context
This PR introduces `package.yaml` support and routes more code paths through the shared manifest reader. Even if YAML parsing is already used elsewhere (e.g. lockfile/workspace config), adding a new manifest type increases the set of files that can trigger worst-case parsing and large allocations.

## Fix Focus Areas
- pacquet/crates/workspace/src/project_manifest.rs[111-120]

### Suggested approach
- Before `read_to_string`, check `fs::metadata(path)?.len()` and reject files above a conservative limit for manifests (pick a threshold appropriate for package manifests).
- Ensure the error is surfaced as a dedicated diagnostic variant (could reuse `ReadFile` or add a `TooLarge { path, bytes, max }`).
- (Optional) Consider parsing only the needed subset (e.g. `name`, `version`, `scripts`, dependency maps) into a struct instead of fully materializing an arbitrary `serde_json::Value`, if you want a stronger resource bound.

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


2. Duplicate glob walks 🐞 Bug ➹ Performance
Description
find_workspace_projects_no_check now expands each include pattern into two separate manifest globs
(package.json and package.yaml) and performs a full Glob::walk for each, doubling filesystem
traversal work for broad patterns like **. This runs on workspace install and recursive command
paths, so large workspaces can see materially slower discovery.
Code

pacquet/crates/workspace/src/projects.rs[R154-178]

+        for normalized in normalize_manifest_patterns(pattern) {
+            if is_literal_pattern(&normalized) && !workspace_root.join(&normalized).is_file() {
+                continue;
+            }
+            let glob =
+                Glob::new(&normalized).map_err(|err| FindWorkspaceProjectsError::InvalidGlob {
+                    pattern: pattern.to_string(),
+                    message: err.to_string(),
+                })?;
+
+            let walk = glob.walk(workspace_root).not(ignore_template.clone()).map_err(|err| {
+                FindWorkspaceProjectsError::InvalidGlob {
+                    pattern: pattern.to_string(),
+                    message: err.to_string(),
+                }
            })?;

-        let walk = glob.walk(workspace_root).not(ignore_template.clone()).map_err(|err| {
-            FindWorkspaceProjectsError::InvalidGlob {
-                pattern: pattern.to_string(),
-                message: err.to_string(),
+            for entry in walk {
+                let entry = entry.map_err(|err| FindWorkspaceProjectsError::Walk {
+                    root: workspace_root.to_path_buf(),
+                    source: std::io::Error::other(err.to_string()),
+                })?;
+                manifest_paths.insert(entry.path().to_path_buf());
            }
-        })?;
-
-        for entry in walk {
-            let entry = entry.map_err(|err| FindWorkspaceProjectsError::Walk {
-                root: workspace_root.to_path_buf(),
-                source: std::io::Error::other(err.to_string()),
-            })?;
-            manifest_paths.insert(entry.path().to_path_buf());
        }
Evidence
The new code walks once per expanded manifest basename (two per user pattern), and workspace
discovery is called from install and recursive flows.

pacquet/crates/workspace/src/projects.rs[152-179]
pacquet/crates/package-manager/src/install.rs[2120-2130]
pacquet/crates/cli/src/cli_args/recursive.rs[203-223]

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

## Issue description
Workspace project discovery currently performs two separate glob walks per include pattern (one for `package.json`, one for `package.yaml`). For broad patterns like `**`, this can double directory traversal overhead on hot paths (workspace install / recursive commands).

## Issue Context
The implementation expands patterns via `normalize_manifest_patterns()` into two patterns and then runs `Glob::walk(...)` inside that loop. This is functionally correct but likely wasteful.

## Fix Focus Areas
- pacquet/crates/workspace/src/projects.rs[152-179]

### Suggested approach
- For non-literal patterns (contain glob metacharacters), replace the two-pattern expansion with a *single* wax pattern using brace expansion, e.g.:
 - `"{trimmed}/{package.json,package.yaml}"` (or `"{trimmed}/{{package.json,package.yaml}}"` depending on wax’s brace syntax).
 - This keeps behavior but reduces to one walk per user pattern.
- Keep the existing literal fast-path behavior (or improve it): for literal directory patterns like `packages/alpha`, directly check for `packages/alpha/package.json` and `packages/alpha/package.yaml` and insert whichever exists, without walking.
- Apply the same “single-pattern” approach to negation patterns if possible, to avoid doubling ignore glob complexity as well.

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


Results up to commit 49ec162


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


Action required
1. --resume-from is globally accepted ✓ Resolved 📘 Rule violation ≡ Correctness
Description
--resume-from and --report-summary are declared as global CLI flags, so they can be passed to
unrelated subcommands (e.g., install) and will parse successfully even though pnpm defines them
only for run/exec flows. This introduces pnpm-incompatible user-visible behavior by accepting
flags in contexts pnpm would not.
Code

pacquet/crates/cli/src/cli_args/cli_command.rs[R143-149]

+    /// Recursive only: resume execution from the given package.
+    #[clap(long = "resume-from", global = true)]
+    pub resume_from: Option<String>,
+
+    /// Recursive only: write a `pnpm-exec-summary.json` execution report.
+    #[clap(long = "report-summary", global = true)]
+    pub report_summary: bool,
Evidence
Pacquet declares --resume-from and --report-summary as global = true, which means clap will
accept them regardless of subcommand. Pnpm’s own help/options show these flags belong to run and
exec, while recursive-global options (like --sort) are documented separately; therefore making
resume-from/report-summary global across pacquet diverges from pnpm behavior.

Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pacquet/crates/cli/src/cli_args/cli_command.rs[131-153]
pacquet/crates/cli/src/cli_args/tests.rs[75-102]
pnpm11/exec/commands/src/run.ts[98-113]
pnpm11/exec/commands/src/exec.ts[41-54]
pnpm11/pnpm/src/cmd/recursive.ts[83-114]

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

## Issue description
`--resume-from` and `--report-summary` are currently top-level `global` clap flags, which makes pacquet accept them for any subcommand. In pnpm, these flags are `run`/`exec`-specific (not general recursive options), so accepting them for other commands is pnpm-incompatible.

## Issue Context
The new flags were added to support recursive `run`/`exec` and top-level fallback parsing, but the current clap shape makes them valid everywhere.

## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/cli_command.rs[143-149]
- pacquet/crates/cli/src/cli_args/dispatch.rs[32-35]
- pacquet/crates/cli/src/cli_args/dispatch.rs[235-238]

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



Remediation recommended
2. Resume-from docs wrong 🐞 Bug ≡ Correctness
Description
With --no-sort, recursive run/exec builds chunks in workspace/insertion order
(graph.keys()), so --resume-from skips based on workspace order rather than the documented
topological order. This makes --resume-from inconsistent/misleading when combined with --no-sort
and can resume from an unexpected point.
Code

pacquet/crates/cli/src/cli_args/run/recursive.rs[R98-107]

+    let mut chunks = if args.sort {
+        sort_filtered_projects(
+            graph,
+            selection.full_graph(),
+            selection.prod_all.as_ref(),
+            &selection.prod_only_selected,
+        )
+    } else {
+        graph.keys().cloned().map(|root| vec![root]).collect()
+    };
Evidence
--no-sort switches chunk construction to workspace/insertion order via graph.keys(), and
get_resumed_package_chunks trims based on chunk position; meanwhile resume_from is still
documented as topological-only, which becomes false under --no-sort.

pacquet/crates/cli/src/cli_args/run/recursive.rs[98-110]
pacquet/crates/cli/src/cli_args/exec/recursive.rs[82-94]
pacquet/crates/cli/src/cli_args/recursive.rs[153-173]
pacquet/crates/cli/src/cli_args/run.rs[34-55]
pacquet/crates/cli/src/cli_args/exec.rs[35-52]

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

### Issue description
`--no-sort` changes the execution ordering of recursive runs to workspace/insertion order, but the `--resume-from` help text and comments still describe skipping packages in *topological* order. Because `get_resumed_package_chunks()` trims based on the already-constructed `chunks` list, the meaning of “earlier” changes under `--no-sort`.

### Issue Context
- In recursive `run`/`exec`, when `args.sort` is false, chunks are built from `graph.keys()` (workspace/insertion order) and then `--resume-from` is applied by dropping earlier chunks.
- The CLI docs for `resume_from` still say “skipping every earlier project in the topological order”, which is no longer true under `--no-sort`.

### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/run.rs[34-55]
- pacquet/crates/cli/src/cli_args/exec.rs[35-52]
- pacquet/crates/cli/src/cli_args/run/recursive.rs[98-110]
- pacquet/crates/cli/src/cli_args/exec/recursive.rs[82-94]

### Suggested fix direction
- Update the `resume_from` doc/help text to describe the actual behavior, e.g. “skipping every earlier project in the current execution order (topological unless `--no-sort`)”.
- Optionally add/adjust a test that asserts `--resume-from` semantics under `--no-sort` (workspace order), so future refactors don’t regress the intended behavior.

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


Results up to commit ec1710f


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


Remediation recommended
1. clap::Error::exit() bypasses miette 📘 Rule violation ◔ Observability
Description
The new script-scoped global flag validation returns a clap::Error and is surfaced via
err.exit(), printing directly instead of routing through miette/pacquet-diagnostics. This adds
a new user-facing error path that violates the requirement for centralized miette-based diagnostics
rendering.
Code

pacquet/crates/cli/src/lib.rs[R61-63]

+    if let Err(err) = args.validate_command_scoped_global_options() {
+        err.exit();
+    }
Evidence
PR Compliance ID 713453 requires user-facing CLI errors to be routed through miette via
pacquet-diagnostics. The new validation is invoked in main() and failures call err.exit(), and
the validator constructs a clap::Error (ErrorKind::UnknownArgument) instead of a diagnostic
type.

Rule 713453: Route user-facing errors through miette via pacquet-diagnostics
pacquet/crates/cli/src/lib.rs[61-63]
pacquet/crates/cli/src/cli_args/cli_command.rs[156-193]

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

## Issue description
`validate_command_scoped_global_options()` produces a `clap::Error` that is emitted via `err.exit()`, which bypasses the repo’s required `miette`/`pacquet-diagnostics` user-facing error path.

## Issue Context
This PR introduced new validation for script-scoped global flags (`--resume-from`, `--report-summary`, `--no-bail`). Those validation failures are now a new class of user-facing errors and should be rendered consistently via the diagnostics stack.

## Fix Focus Areas
- pacquet/crates/cli/src/lib.rs[61-63]
- pacquet/crates/cli/src/cli_args/cli_command.rs[156-193]

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


Qodo Logo

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      4.4±0.28ms   976.8 KB/sec    1.03      4.6±0.38ms   949.6 KB/sec

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
pacquet/crates/workspace/src/projects.rs (2)

188-228: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Manifest-format precedence relies on incidental lexicographic sort, not an explicit invariant.

package.json winning over package.yaml for the same directory (as asserted by package_json_wins_when_both_manifest_files_exist) currently works only because sort_by is stable and BTreeSet<PathBuf> happens to order "package.json" before "package.yaml" alphabetically ('j' < 'y'). The sort key itself (Line 190-194) only compares dir_left/dir_right, so the precedence for same-directory manifests is an accidental byproduct of string ordering rather than a codified rule tied to PROJECT_MANIFEST_BASENAMES's declared order.

This is fragile: any future manifest basename that doesn't happen to sort after "package.json" (e.g. something starting with a-i) would silently invert precedence without any test catching it until runtime.

Consider making the tie-break explicit, e.g.:

♻️ Suggested explicit precedence tie-break
     let mut sorted: Vec<PathBuf> = manifest_paths.into_iter().collect();
     sorted.sort_by(|left, right| {
         let dir_left = left.parent().unwrap_or_else(|| Path::new(""));
         let dir_right = right.parent().unwrap_or_else(|| Path::new(""));
-        dir_left.cmp(dir_right)
+        dir_left.cmp(dir_right).then_with(|| {
+            let rank = |p: &Path| {
+                let name = p.file_name().and_then(|n| n.to_str()).unwrap_or("");
+                PROJECT_MANIFEST_BASENAMES.iter().position(|b| *b == name).unwrap_or(usize::MAX)
+            };
+            rank(left).cmp(&rank(right))
+        })
     });

This makes package.json-over-package.yaml precedence a documented, testable contract driven by PROJECT_MANIFEST_BASENAMES's order rather than a side effect of PathBuf's Ord impl.

As per pacquet's coding conventions, "Keep comments focused on non-obvious contracts/invariants ... prefer renaming/extraction over commentary" (CODE_STYLE_GUIDE.md) — this invariant is currently neither documented nor enforced explicitly.

🤖 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/src/projects.rs` around lines 188 - 228, The
manifest selection in the project discovery logic relies on incidental path
ordering instead of an explicit precedence rule. Update the sorting/selection in
the workspace project scan so same-directory manifests are ordered by the
declared manifest basename priority from PROJECT_MANIFEST_BASENAMES, with
package.json consistently winning over package.yaml, rather than depending on
PathBuf lexicographic behavior. Keep the existing deduping in the projects
collection, but make the tie-break explicit in the manifest_paths sorting and
any helper used by read_exact_project_manifest / FindWorkspaceProjectsError
handling.

Source: Path instructions


152-179: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Doubles glob-walk I/O per include pattern.

Each user-supplied include pattern now runs a full separate glob.walk(workspace_root) for package.json and again for package.yaml, effectively doubling directory-tree traversal cost for workspace project discovery. For large monorepos this is extra work on what is effectively a startup hot path.

Consider combining both basenames into a single glob using brace alternation (e.g. {trimmed}/{package.json,package.yaml}, since wax already treats {/} as glob metacharacters per is_literal_pattern) so each pattern only needs one walk. Note this would require adjusting the literal-pattern fast-path (Line 155) since a brace-alternation glob is no longer "literal" — you'd need to check both file paths individually for that case instead.

As per path instructions, "Keep performance in mind for filesystem-probing changes (avoid extra work on hot paths)" (REVIEW_GUIDE.md).

🤖 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/src/projects.rs` around lines 152 - 179, The
workspace discovery loop in find_workspace_projects is doing a separate
glob.walk(workspace_root) for each include pattern variant, which doubles
filesystem traversal for package.json and package.yaml. Refactor the pattern
handling so both manifest basenames are matched in a single glob (using brace
alternation or equivalent) and keep only one walk per user-supplied pattern.
Update the is_literal_pattern fast-path to handle the combined glob case by
checking both candidate manifest paths individually before skipping. Keep the
existing error mapping and manifest_paths insertion behavior unchanged.

Source: Path instructions

pacquet/crates/workspace/src/project_manifest.rs (1)

49-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Basename list duplicated across the crate — drift risk.

The ["package.json", "package.yaml"] list here is duplicated as PROJECT_MANIFEST_BASENAMES in pacquet/crates/workspace/src/projects.rs (Line 238). If a third manifest format is ever added, it's easy to update one list and forget the other, silently breaking discovery/dispatch parity between try_read_project_manifest and workspace project enumeration.

Consider hoisting a single pub(crate) const PROJECT_MANIFEST_BASENAMES: &[&str] (e.g. in this file) and reusing it from projects.rs.

🤖 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/src/project_manifest.rs` around lines 49 - 72, The
manifest basename list is duplicated between try_read_project_manifest and
workspace project enumeration, so update the code to use one shared source of
truth instead of hardcoding ["package.json", "package.yaml"] in multiple places.
Hoist a pub(crate) constant like PROJECT_MANIFEST_BASENAMES in
project_manifest.rs, then have try_read_project_manifest and the project
scanning logic in projects.rs reference that constant so any future manifest
format change stays in sync.
🤖 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 `@pacquet/crates/workspace/src/project_manifest.rs`:
- Around line 49-72: The manifest basename list is duplicated between
try_read_project_manifest and workspace project enumeration, so update the code
to use one shared source of truth instead of hardcoding ["package.json",
"package.yaml"] in multiple places. Hoist a pub(crate) constant like
PROJECT_MANIFEST_BASENAMES in project_manifest.rs, then have
try_read_project_manifest and the project scanning logic in projects.rs
reference that constant so any future manifest format change stays in sync.

In `@pacquet/crates/workspace/src/projects.rs`:
- Around line 188-228: The manifest selection in the project discovery logic
relies on incidental path ordering instead of an explicit precedence rule.
Update the sorting/selection in the workspace project scan so same-directory
manifests are ordered by the declared manifest basename priority from
PROJECT_MANIFEST_BASENAMES, with package.json consistently winning over
package.yaml, rather than depending on PathBuf lexicographic behavior. Keep the
existing deduping in the projects collection, but make the tie-break explicit in
the manifest_paths sorting and any helper used by read_exact_project_manifest /
FindWorkspaceProjectsError handling.
- Around line 152-179: The workspace discovery loop in find_workspace_projects
is doing a separate glob.walk(workspace_root) for each include pattern variant,
which doubles filesystem traversal for package.json and package.yaml. Refactor
the pattern handling so both manifest basenames are matched in a single glob
(using brace alternation or equivalent) and keep only one walk per user-supplied
pattern. Update the is_literal_pattern fast-path to handle the combined glob
case by checking both candidate manifest paths individually before skipping.
Keep the existing error mapping and manifest_paths insertion behavior unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f3013cec-f133-4fe2-8319-a69ef8aee97a

📥 Commits

Reviewing files that changed from the base of the PR and between b789d81 and 2089d9e.

📒 Files selected for processing (8)
  • pacquet/crates/cli/src/cli_args/dispatch_script.rs
  • pacquet/crates/cli/src/cli_args/exec.rs
  • pacquet/crates/cli/src/cli_args/run.rs
  • pacquet/crates/cli/tests/run.rs
  • pacquet/crates/workspace/src/project_manifest.rs
  • pacquet/crates/workspace/src/project_manifest/tests.rs
  • pacquet/crates/workspace/src/projects.rs
  • pacquet/crates/workspace/src/projects/tests.rs

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 0f2ef1d

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fail fast on invalid YAML

Add validation to reject YAML manifests that are not valid JSON objects.

pacquet/crates/workspace/src/project_manifest.rs [111-120]

 fn read_package_yaml(path: &Path) -> Result<PackageManifest, ReadProjectManifestError> {
     let text = fs::read_to_string(path).map_err(|source| ReadProjectManifestError::ReadFile {
         path: path.to_path_buf(),
         source,
     })?;
-    let value = serde_saphyr::from_str(&text).map_err(|source| {
+    let value: serde_json::Value = serde_saphyr::from_str(&text).map_err(|source| {
         ReadProjectManifestError::ParseYaml { path: path.to_path_buf(), source: Box::new(source) }
     })?;
+    if !value.is_object() {
+        return Err(ReadProjectManifestError::ParseYaml {
+            path: path.to_path_buf(),
+            source: Box::new(serde_saphyr::Error::custom("package.yaml must be a mapping/object")),
+        });
+    }
     Ok(PackageManifest::from_value(path.to_path_buf(), value))
 }
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: Adding an explicit error for non-object YAML values prevents silent fallback behavior and improves debugging, aligning with PackageManifest::from_value's expectations.

Low
  • More

Previous suggestions

Suggestions
CategorySuggestion                                                                                                                                    Impact
Security
Limit YAML manifest parse size

Add a 1MB file size limit check before parsing package.yaml to mitigate
potential memory or CPU DoS attacks.

pacquet/crates/workspace/src/project_manifest.rs [111-120]

 fn read_package_yaml(path: &Path) -> Result<PackageManifest, ReadProjectManifestError> {
+    const MAX_MANIFEST_BYTES: u64 = 1 * 1024 * 1024;
+
+    let meta = fs::metadata(path).map_err(|source| ReadProjectManifestError::ReadFile {
+        path: path.to_path_buf(),
+        source,
+    })?;
+    if meta.len() > MAX_MANIFEST_BYTES {
+        return Err(ReadProjectManifestError::ParseYaml {
+            path: path.to_path_buf(),
+            source: Box::new(serde_saphyr::Error::custom(format!(
+                "manifest exceeds {MAX_MANIFEST_BYTES} bytes"
+            ))),
+        });
+    }
+
     let text = fs::read_to_string(path).map_err(|source| ReadProjectManifestError::ReadFile {
         path: path.to_path_buf(),
         source,
     })?;
-    let value = serde_saphyr::from_str(&text).map_err(|source| {
-        ReadProjectManifestError::ParseYaml { path: path.to_path_buf(), source: Box::new(source) }
+    let value = serde_saphyr::from_str(&text).map_err(|source| ReadProjectManifestError::ParseYaml {
+        path: path.to_path_buf(),
+        source: Box::new(source),
     })?;
     Ok(PackageManifest::from_value(path.to_path_buf(), value))
 }
Suggestion importance[1-10]: 3

__

Why: While limiting the file size adds defensive hardening against malicious repositories, it introduces an inconsistent restriction since no such limit exists for package.json parsing in the broader codebase, and the threat model typically assumes trusted local workspace files.

Low

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 7, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2089d9e

@codecov-commenter

codecov-commenter commented Jul 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.79545% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.83%. Comparing base (de1371d) to head (1cad2bd).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pacquet/crates/workspace/src/projects.rs 65.95% 16 Missing ⚠️
pacquet/crates/workspace/src/project_manifest.rs 73.68% 5 Missing ⚠️
pacquet/crates/cli/src/cli_args/dispatch.rs 84.61% 2 Missing ⚠️
pacquet/crates/cli/src/cli_args/exec/recursive.rs 85.71% 1 Missing ⚠️
pacquet/crates/cli/src/lib.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12842      +/-   ##
==========================================
+ Coverage   85.80%   85.83%   +0.03%     
==========================================
  Files         448      448              
  Lines       69402    69558     +156     
==========================================
+ Hits        59552    59708     +156     
  Misses       9850     9850              

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

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

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 0f2ef1dd412d

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.252 ± 0.179 4.069 4.581 1.96 ± 0.13
pacquet@main 4.148 ± 0.096 4.040 4.301 1.91 ± 0.11
pnpr@HEAD 2.191 ± 0.139 1.991 2.371 1.01 ± 0.08
pnpr@main 2.174 ± 0.113 2.054 2.345 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.2515360514,
      "stddev": 0.1786515745488082,
      "median": 4.1623380147999995,
      "user": 3.9543601599999993,
      "system": 3.5888201599999996,
      "min": 4.0685445067999995,
      "max": 4.5810889567999995,
      "times": [
        4.5810889567999995,
        4.4257046868,
        4.1628905138,
        4.4892882628,
        4.1124427238,
        4.1345255407999995,
        4.0685445067999995,
        4.1607507448,
        4.1617855158,
        4.2183390618
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.148353102700001,
      "stddev": 0.09601389129684276,
      "median": 4.1368538183,
      "user": 3.91993776,
      "system": 3.54930716,
      "min": 4.0399657328,
      "max": 4.3012845618,
      "times": [
        4.2535353038,
        4.3012845618,
        4.1226995588,
        4.0399657328,
        4.0471896998,
        4.0820683928,
        4.1931842468,
        4.0476627257999995,
        4.2449327268,
        4.151008077799999
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.1912338625000003,
      "stddev": 0.1393684487175056,
      "median": 2.1783313593000004,
      "user": 2.6977536599999996,
      "system": 3.08141936,
      "min": 1.9905536477999999,
      "max": 2.3707178058,
      "times": [
        1.9905536477999999,
        2.3232242548,
        2.0715093448,
        2.1439872498000003,
        2.1274002308,
        2.0312766278,
        2.3694800138,
        2.3707178058,
        2.2126754688,
        2.2715139808
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.1743578568,
      "stddev": 0.11251774718626001,
      "median": 2.1337666748000004,
      "user": 2.6878424599999997,
      "system": 3.02886716,
      "min": 2.0540624648000003,
      "max": 2.3452500838000003,
      "times": [
        2.1134530758000003,
        2.0704554208,
        2.1243362838,
        2.0540624648000003,
        2.0666359678000004,
        2.2942479668,
        2.3452500838000003,
        2.1431970658000004,
        2.1969573018,
        2.3349829368000004
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 657.0 ± 8.4 641.3 671.7 1.00
pacquet@main 676.9 ± 30.3 639.5 738.3 1.03 ± 0.05
pnpr@HEAD 758.9 ± 113.6 707.5 1080.7 1.16 ± 0.17
pnpr@main 766.1 ± 72.1 711.5 959.1 1.17 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6569783462400001,
      "stddev": 0.008443813567052115,
      "median": 0.65636040264,
      "user": 0.38890562,
      "system": 1.3522325999999998,
      "min": 0.64126006564,
      "max": 0.67167830764,
      "times": [
        0.65466100364,
        0.67167830764,
        0.65601785864,
        0.65388240464,
        0.65670294664,
        0.66110826264,
        0.66405731364,
        0.66188360064,
        0.64126006564,
        0.64853169864
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.67687547714,
      "stddev": 0.03028777599973449,
      "median": 0.67369282764,
      "user": 0.38697992000000003,
      "system": 1.3517705999999998,
      "min": 0.63950268964,
      "max": 0.73829833964,
      "times": [
        0.65547413464,
        0.64816630664,
        0.68395900764,
        0.63950268964,
        0.71159693964,
        0.67726021064,
        0.65703717564,
        0.73829833964,
        0.6873345226400001,
        0.67012544464
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.7589205214400001,
      "stddev": 0.11358827268773368,
      "median": 0.72551446164,
      "user": 0.41926191999999995,
      "system": 1.3870215,
      "min": 0.70749900264,
      "max": 1.0807345856400001,
      "times": [
        0.73405244564,
        0.72205214864,
        0.7092765036400001,
        0.71180884564,
        0.70749900264,
        0.73595071164,
        0.72459484164,
        0.72643408164,
        0.73680204764,
        1.0807345856400001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.76611917224,
      "stddev": 0.07208537534814752,
      "median": 0.74208604814,
      "user": 0.42873372,
      "system": 1.4101803,
      "min": 0.71147252864,
      "max": 0.95908083464,
      "times": [
        0.72865315364,
        0.75414127064,
        0.77672723264,
        0.79170579064,
        0.73495715364,
        0.72028166164,
        0.74359331164,
        0.95908083464,
        0.71147252864,
        0.74057878464
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.361 ± 0.030 4.316 4.395 2.03 ± 0.10
pacquet@main 4.388 ± 0.064 4.255 4.460 2.04 ± 0.10
pnpr@HEAD 2.149 ± 0.103 2.053 2.380 1.00
pnpr@main 2.176 ± 0.138 2.040 2.460 1.01 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.36062641054,
      "stddev": 0.029547893906004246,
      "median": 4.3668851248400005,
      "user": 3.8260220600000006,
      "system": 3.4748171400000003,
      "min": 4.31570284734,
      "max": 4.39523939334,
      "times": [
        4.31570284734,
        4.31934924634,
        4.3914514683400006,
        4.34604425934,
        4.3795857083400005,
        4.33914470834,
        4.38597622434,
        4.39523939334,
        4.3776789893400005,
        4.35609126034
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.38808502054,
      "stddev": 0.0635167635126956,
      "median": 4.39259119184,
      "user": 3.8879980599999997,
      "system": 3.46806564,
      "min": 4.25519098834,
      "max": 4.46049619234,
      "times": [
        4.35064662134,
        4.25519098834,
        4.32877556434,
        4.38815676734,
        4.3970256163400006,
        4.38172187134,
        4.46049619234,
        4.423532589340001,
        4.45015775534,
        4.4451462393400005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.14858165554,
      "stddev": 0.1031391718472752,
      "median": 2.1103784183400003,
      "user": 2.52504756,
      "system": 2.9657509400000004,
      "min": 2.0527256633400004,
      "max": 2.3797698623400003,
      "times": [
        2.3797698623400003,
        2.22794582534,
        2.20950304634,
        2.0867170343400003,
        2.07136895134,
        2.06237423534,
        2.0527256633400004,
        2.18078612434,
        2.0805860103400002,
        2.1340398023400002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.1755977974400005,
      "stddev": 0.13751341488802019,
      "median": 2.13404139834,
      "user": 2.52765086,
      "system": 2.94216774,
      "min": 2.03988131434,
      "max": 2.45980893734,
      "times": [
        2.09039866834,
        2.09826956634,
        2.45980893734,
        2.1396199043400004,
        2.03988131434,
        2.1489856133400003,
        2.3934831573400004,
        2.10000665134,
        2.12846289234,
        2.15706126934
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.426 ± 0.046 1.396 1.554 2.06 ± 0.10
pacquet@main 1.458 ± 0.065 1.414 1.639 2.11 ± 0.12
pnpr@HEAD 0.693 ± 0.027 0.669 0.756 1.00
pnpr@main 0.717 ± 0.064 0.680 0.898 1.04 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.4264860960999999,
      "stddev": 0.04556734837476126,
      "median": 1.4132115345,
      "user": 1.39274464,
      "system": 1.7192585999999999,
      "min": 1.396156631,
      "max": 1.5535311059999999,
      "times": [
        1.429057636,
        1.396156631,
        1.415378777,
        1.40914955,
        1.417471789,
        1.4110442920000001,
        1.5535311059999999,
        1.409421233,
        1.402999348,
        1.420650599
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.4583357709,
      "stddev": 0.06498743699125681,
      "median": 1.4422796945,
      "user": 1.39795404,
      "system": 1.7622276,
      "min": 1.4144859539999999,
      "max": 1.639290512,
      "times": [
        1.423462159,
        1.447105067,
        1.639290512,
        1.428422282,
        1.434864884,
        1.437454322,
        1.4144859539999999,
        1.4502964409999999,
        1.451123618,
        1.45685247
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.692585837,
      "stddev": 0.026702919780642247,
      "median": 0.6840781765,
      "user": 0.35648124,
      "system": 1.3220002,
      "min": 0.669168968,
      "max": 0.755759383,
      "times": [
        0.7190507770000001,
        0.684632078,
        0.6767295560000001,
        0.669168968,
        0.6710961670000001,
        0.755759383,
        0.691040603,
        0.675948226,
        0.698908337,
        0.683524275
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.7171637110000002,
      "stddev": 0.06447515240087863,
      "median": 0.6999282015,
      "user": 0.36629533999999997,
      "system": 1.3302215999999996,
      "min": 0.679535546,
      "max": 0.898308638,
      "times": [
        0.695319479,
        0.707457733,
        0.712499187,
        0.6953929360000001,
        0.679535546,
        0.702054309,
        0.700943406,
        0.898308638,
        0.698912997,
        0.681212879
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.129 ± 0.056 3.052 3.262 4.62 ± 0.22
pacquet@main 3.098 ± 0.028 3.055 3.150 4.58 ± 0.20
pnpr@HEAD 0.678 ± 0.011 0.659 0.698 1.00 ± 0.05
pnpr@main 0.677 ± 0.029 0.660 0.759 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.12941413486,
      "stddev": 0.055894254961717384,
      "median": 3.11575405556,
      "user": 1.8472150199999997,
      "system": 2.0115265399999998,
      "min": 3.05197273406,
      "max": 3.26209013906,
      "times": [
        3.15010250906,
        3.1547249760600002,
        3.14409637306,
        3.11188740406,
        3.09207557706,
        3.11898651606,
        3.09568352506,
        3.26209013906,
        3.11252159506,
        3.05197273406
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.0980936829599997,
      "stddev": 0.027872962665241464,
      "median": 3.09323251656,
      "user": 1.8295474200000001,
      "system": 1.99837554,
      "min": 3.0552275300600003,
      "max": 3.15032522906,
      "times": [
        3.09227391806,
        3.0552275300600003,
        3.09276809806,
        3.06645925306,
        3.10794851506,
        3.09290150106,
        3.15032522906,
        3.09356353206,
        3.13297013506,
        3.09649911806
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.67833608046,
      "stddev": 0.01090290014803154,
      "median": 0.67920258506,
      "user": 0.34485802,
      "system": 1.3065845399999998,
      "min": 0.65913398306,
      "max": 0.69832943006,
      "times": [
        0.68285011106,
        0.68755037106,
        0.67911761606,
        0.69832943006,
        0.67928755406,
        0.68075102206,
        0.66597834006,
        0.65913398306,
        0.67802340706,
        0.67233897006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6768418173599999,
      "stddev": 0.029425340622255176,
      "median": 0.66699241206,
      "user": 0.35024321999999997,
      "system": 1.29692094,
      "min": 0.65998377706,
      "max": 0.75889801406,
      "times": [
        0.67204628506,
        0.66241733206,
        0.66781915406,
        0.67834709206,
        0.66616567006,
        0.67528577606,
        0.75889801406,
        0.65998377706,
        0.66398809206,
        0.66346698106
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 666.1 ± 6.1 651.8 675.0 6.17 ± 0.06
pacquet@main 669.0 ± 8.2 656.0 681.3 6.20 ± 0.08
pnpr@HEAD 108.1 ± 1.0 106.4 111.7 1.00 ± 0.01
pnpr@main 107.9 ± 0.5 107.0 109.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6661095080399999,
      "stddev": 0.0061221062910061476,
      "median": 0.6668753403400001,
      "user": 0.6325304,
      "system": 0.153965,
      "min": 0.65181926734,
      "max": 0.67502290334,
      "times": [
        0.66698040434,
        0.66777678034,
        0.66621006034,
        0.67116238534,
        0.66677027634,
        0.66290302534,
        0.66885532334,
        0.65181926734,
        0.66359465434,
        0.67502290334
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.66895160354,
      "stddev": 0.008233631294613285,
      "median": 0.67044503784,
      "user": 0.6325826,
      "system": 0.15716739999999998,
      "min": 0.65596986834,
      "max": 0.68130056934,
      "times": [
        0.67078581334,
        0.67010426234,
        0.65674497434,
        0.66501541434,
        0.65596986834,
        0.66600443834,
        0.67796558034,
        0.68130056934,
        0.67251935534,
        0.67310575934
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10805222434000002,
      "stddev": 0.0009755430541288474,
      "median": 0.10796489834,
      "user": 0.027842838461538462,
      "system": 0.019451115384615383,
      "min": 0.10637298034,
      "max": 0.11173324834000001,
      "times": [
        0.10637298034,
        0.10765642334,
        0.11173324834000001,
        0.10945076934,
        0.10797284334000001,
        0.10742222634000001,
        0.10749304834000001,
        0.10852916634000001,
        0.10828196034000001,
        0.10799752234000001,
        0.10770643634,
        0.10743030134,
        0.10795299634000001,
        0.10872803034,
        0.10724557034000001,
        0.10795695334000001,
        0.10817166334,
        0.10811074034000001,
        0.10817200434,
        0.10726502434,
        0.10700277434000001,
        0.10882609034,
        0.10817608534,
        0.10788005034,
        0.10825885734,
        0.10756406634
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10793444586000003,
      "stddev": 0.0004993677618097993,
      "median": 0.10784424334,
      "user": 0.028712819999999993,
      "system": 0.01872306,
      "min": 0.10701145734,
      "max": 0.10905916834000001,
      "times": [
        0.10905916834000001,
        0.10701145734,
        0.10823655334,
        0.10803254234000001,
        0.10763396034,
        0.10834636834000001,
        0.10789623834,
        0.10716238134,
        0.10833188134,
        0.10868078234,
        0.10741497934000001,
        0.10784424334,
        0.10773048034,
        0.10763678534000001,
        0.10753532634,
        0.10904050234000001,
        0.10795613034000001,
        0.10769720734,
        0.10774851334,
        0.10767055734,
        0.10836471134,
        0.10774385434,
        0.10785494834,
        0.10791842934000001,
        0.10781314434
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 6.990 ± 0.234 6.752 7.494 1.39 ± 0.05
pacquet@main 6.972 ± 0.176 6.787 7.397 1.38 ± 0.05
pnpr@HEAD 5.041 ± 0.107 4.931 5.219 1.00
pnpr@main 5.060 ± 0.111 4.862 5.252 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 6.990317135740002,
      "stddev": 0.23382595057200595,
      "median": 6.93910876474,
      "user": 4.0979000999999995,
      "system": 3.8273091999999993,
      "min": 6.75174214774,
      "max": 7.49418516274,
      "times": [
        6.87402993674,
        7.09606376274,
        7.49418516274,
        6.99231068374,
        7.23066668674,
        6.75222377974,
        6.81490406574,
        6.88590684574,
        7.01113828574,
        6.75174214774
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 6.972131405240001,
      "stddev": 0.17629497828682295,
      "median": 6.97004559024,
      "user": 4.0947588,
      "system": 3.8545339999999997,
      "min": 6.78663771374,
      "max": 7.39658175574,
      "times": [
        6.99919578774,
        7.39658175574,
        6.84531112874,
        6.94935123674,
        6.78663771374,
        6.79178151274,
        7.05407382474,
        6.89233492274,
        7.01530622574,
        6.99073994374
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 5.04149538144,
      "stddev": 0.10720305185519284,
      "median": 4.9855636282399995,
      "user": 2.8169528,
      "system": 3.2742652,
      "min": 4.93108502674,
      "max": 5.21882543374,
      "times": [
        5.07435050974,
        5.14162896774,
        5.21882543374,
        5.19181987774,
        5.00666694574,
        4.96386087874,
        4.96446031074,
        4.96121254274,
        4.96104332074,
        4.93108502674
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 5.060361786540001,
      "stddev": 0.11128430057453742,
      "median": 5.05193569574,
      "user": 2.8021585,
      "system": 3.3020289,
      "min": 4.86185937474,
      "max": 5.25197597874,
      "times": [
        4.86185937474,
        5.01238356174,
        5.15397056974,
        5.15674957874,
        5.06508975974,
        4.96329543474,
        5.00051914374,
        5.03878163174,
        5.25197597874,
        5.09899283174
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12842
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
4,360.63 ms
(+3.18%)Baseline: 4,226.41 ms
5,071.69 ms
(85.98%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,129.41 ms
(+3.80%)Baseline: 3,014.96 ms
3,617.96 ms
(86.50%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,426.49 ms
(+6.76%)Baseline: 1,336.10 ms
1,603.32 ms
(88.97%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
666.11 ms
(+5.12%)Baseline: 633.64 ms
760.37 ms
(87.60%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
4,251.54 ms
(+6.86%)Baseline: 3,978.68 ms
4,774.41 ms
(89.05%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
6,990.32 ms
(+2.53%)Baseline: 6,817.85 ms
8,181.42 ms
(85.44%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
656.98 ms
(+3.98%)Baseline: 631.84 ms
758.21 ms
(86.65%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12842
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,148.58 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
678.34 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
692.59 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
108.05 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,191.23 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
5,041.50 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
758.92 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan zkochan changed the title fix(pacquet): read scripts from package.yaml fix(pacquet): support pnpm repo CI scripts Jul 7, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 49ec162

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Security
Limit YAML manifest parse size

Add a 1MB file size limit check before parsing package.yaml to mitigate
potential memory or CPU DoS attacks.

pacquet/crates/workspace/src/project_manifest.rs [111-120]

 fn read_package_yaml(path: &Path) -> Result<PackageManifest, ReadProjectManifestError> {
+    const MAX_MANIFEST_BYTES: u64 = 1 * 1024 * 1024;
+
+    let meta = fs::metadata(path).map_err(|source| ReadProjectManifestError::ReadFile {
+        path: path.to_path_buf(),
+        source,
+    })?;
+    if meta.len() > MAX_MANIFEST_BYTES {
+        return Err(ReadProjectManifestError::ParseYaml {
+            path: path.to_path_buf(),
+            source: Box::new(serde_saphyr::Error::custom(format!(
+                "manifest exceeds {MAX_MANIFEST_BYTES} bytes"
+            ))),
+        });
+    }
+
     let text = fs::read_to_string(path).map_err(|source| ReadProjectManifestError::ReadFile {
         path: path.to_path_buf(),
         source,
     })?;
-    let value = serde_saphyr::from_str(&text).map_err(|source| {
-        ReadProjectManifestError::ParseYaml { path: path.to_path_buf(), source: Box::new(source) }
+    let value = serde_saphyr::from_str(&text).map_err(|source| ReadProjectManifestError::ParseYaml {
+        path: path.to_path_buf(),
+        source: Box::new(source),
     })?;
     Ok(PackageManifest::from_value(path.to_path_buf(), value))
 }
  • Apply / Chat
Suggestion importance[1-10]: 3

__

Why: While limiting the file size adds defensive hardening against malicious repositories, it introduces an inconsistent restriction since no such limit exists for package.json parsing in the broader codebase, and the threat model typically assumes trusted local workspace files.

Low
  • More

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
pacquet/crates/cli/src/cli_args/exec/recursive.rs (1)

82-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Sort/no-sort chunking is duplicated with run/recursive.rs.

The if args.sort { sort_filtered_projects(...) } else { graph.keys()... } block here is byte-for-byte identical to the one in run/recursive.rs (lines 98-107). Since sort_filtered_projects already lives in the shared pacquet/crates/cli/src/cli_args/recursive.rs module, consider moving this branch there too (e.g. fn chunk_projects(graph, full_graph, prod_all, prod_only_selected, sort: bool) -> Vec<Vec<PathBuf>>) so both recursive runners call one shared function instead of keeping two copies in sync.

♻️ Suggested shared helper (in recursive.rs)
+pub fn chunk_filtered_projects<Pkg>(
+    selected: &ProjectGraph<Pkg>,
+    all: &ProjectGraph<Pkg>,
+    prod_all: Option<&ProjectGraph<Pkg>>,
+    prod_only_selected: &HashSet<PathBuf>,
+    sort: bool,
+) -> Vec<Vec<PathBuf>> {
+    if sort {
+        sort_filtered_projects(selected, all, prod_all, prod_only_selected)
+    } else {
+        selected.keys().cloned().map(|root| vec![root]).collect()
+    }
+}
🤖 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/cli/src/cli_args/exec/recursive.rs` around lines 82 - 91, The
chunk-building logic in recursive execution is duplicated between recursive.rs
and run/recursive.rs, so move the sort/no-sort branch into the shared recursive
helper module and have both callers use it. Add a shared function such as
chunk_projects that takes graph, full_graph, prod_all, prod_only_selected, and
sort, and returns the Vec<Vec<PathBuf>> currently built in the local block.
Update the recursive runner in recursive.rs to call that helper instead of
inlining the if args.sort { sort_filtered_projects(...) } else { graph.keys()...
} branch, keeping sort_filtered_projects as the shared implementation detail.

Source: Path instructions

pacquet/crates/cli/src/cli_args/dispatch_script.rs (1)

83-97: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate option-copying logic between the two helpers.

with_recursive_run_options and with_recursive_exec_options copy the exact same four fields (resume_from, report_summary, no_bail, sort) from ctx, differing only in the arg type. Consider a small generic helper/trait to avoid the two functions drifting out of sync when a fifth recursive option is added later.

♻️ Suggested consolidation
-fn with_recursive_run_options(ctx: &RunCtx<'_>, mut args: RunArgs) -> RunArgs {
-    args.resume_from = ctx.recursive_resume_from.map(str::to_string);
-    args.report_summary = ctx.recursive_report_summary;
-    args.no_bail = ctx.recursive_no_bail;
-    args.sort = ctx.recursive_sort;
-    args
-}
-
-fn with_recursive_exec_options(ctx: &RunCtx<'_>, mut args: ExecArgs) -> ExecArgs {
-    args.resume_from = ctx.recursive_resume_from.map(str::to_string);
-    args.report_summary = ctx.recursive_report_summary;
-    args.no_bail = ctx.recursive_no_bail;
-    args.sort = ctx.recursive_sort;
-    args
-}
+trait RecursiveOptions {
+    fn set_recursive_options(&mut self, ctx: &RunCtx<'_>);
+}
+
+impl RecursiveOptions for RunArgs {
+    fn set_recursive_options(&mut self, ctx: &RunCtx<'_>) {
+        self.resume_from = ctx.recursive_resume_from.map(str::to_string);
+        self.report_summary = ctx.recursive_report_summary;
+        self.no_bail = ctx.recursive_no_bail;
+        self.sort = ctx.recursive_sort;
+    }
+}
+
+impl RecursiveOptions for ExecArgs {
+    fn set_recursive_options(&mut self, ctx: &RunCtx<'_>) {
+        self.resume_from = ctx.recursive_resume_from.map(str::to_string);
+        self.report_summary = ctx.recursive_report_summary;
+        self.no_bail = ctx.recursive_no_bail;
+        self.sort = ctx.recursive_sort;
+    }
+}
🤖 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/cli/src/cli_args/dispatch_script.rs` around lines 83 - 97, The
two helpers with_recursive_run_options and with_recursive_exec_options contain
duplicated recursive option-copying logic for the same ctx fields, so
consolidate the shared assignments into a small generic helper or trait-based
function and have both helpers delegate to it. Keep the existing behavior for
resume_from, report_summary, no_bail, and sort, but centralize the copying so
future recursive options are added in one place and the RunArgs/ExecArgs
wrappers stay in sync.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pacquet/crates/cli/src/cli_args/dispatch_script.rs`:
- Around line 83-97: The two helpers with_recursive_run_options and
with_recursive_exec_options contain duplicated recursive option-copying logic
for the same ctx fields, so consolidate the shared assignments into a small
generic helper or trait-based function and have both helpers delegate to it.
Keep the existing behavior for resume_from, report_summary, no_bail, and sort,
but centralize the copying so future recursive options are added in one place
and the RunArgs/ExecArgs wrappers stay in sync.

In `@pacquet/crates/cli/src/cli_args/exec/recursive.rs`:
- Around line 82-91: The chunk-building logic in recursive execution is
duplicated between recursive.rs and run/recursive.rs, so move the sort/no-sort
branch into the shared recursive helper module and have both callers use it. Add
a shared function such as chunk_projects that takes graph, full_graph, prod_all,
prod_only_selected, and sort, and returns the Vec<Vec<PathBuf>> currently built
in the local block. Update the recursive runner in recursive.rs to call that
helper instead of inlining the if args.sort { sort_filtered_projects(...) } else
{ graph.keys()... } branch, keeping sort_filtered_projects as the shared
implementation detail.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 372a4808-c979-43e7-b8ad-6dcc24f3886d

📥 Commits

Reviewing files that changed from the base of the PR and between 2089d9e and 49ec162.

📒 Files selected for processing (14)
  • pacquet/crates/cli/src/cli_args/cli_command.rs
  • pacquet/crates/cli/src/cli_args/dispatch.rs
  • pacquet/crates/cli/src/cli_args/dispatch_script.rs
  • pacquet/crates/cli/src/cli_args/exec.rs
  • pacquet/crates/cli/src/cli_args/exec/recursive.rs
  • pacquet/crates/cli/src/cli_args/install.rs
  • pacquet/crates/cli/src/cli_args/install/tests.rs
  • pacquet/crates/cli/src/cli_args/pipelines.rs
  • pacquet/crates/cli/src/cli_args/restart.rs
  • pacquet/crates/cli/src/cli_args/run.rs
  • pacquet/crates/cli/src/cli_args/run/recursive.rs
  • pacquet/crates/cli/src/cli_args/stop.rs
  • pacquet/crates/cli/src/cli_args/tests.rs
  • pacquet/crates/cli/tests/run_recursive.rs
💤 Files with no reviewable changes (3)
  • pacquet/crates/cli/src/cli_args/install/tests.rs
  • pacquet/crates/cli/src/cli_args/pipelines.rs
  • pacquet/crates/cli/src/cli_args/install.rs
✅ Files skipped from review due to trivial changes (1)
  • pacquet/crates/cli/src/cli_args/tests.rs

Copilot AI review requested due to automatic review settings July 7, 2026 16:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 0f2ef1d

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/cli/src/cli_args/cli_command.rs`:
- Around line 184-193: Update validate_script_scoped_global_option in CliCommand
so it treats Test, Start, Stop(_), and Restart(_) the same as Run, Exec, and
External when allowing script-scoped global options. Also extend
script_scoped_global_flags_parse_before_script_commands to include those command
variants, so flags like --resume-from, --report-summary, and --no-bail are
accepted for these valid script commands.
🪄 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: b7fc6f8b-309c-4553-958e-0b6ef3cae90c

📥 Commits

Reviewing files that changed from the base of the PR and between 0f2ef1d and ec1710f.

📒 Files selected for processing (3)
  • pacquet/crates/cli/src/cli_args/cli_command.rs
  • pacquet/crates/cli/src/cli_args/tests.rs
  • pacquet/crates/cli/src/lib.rs

Copilot AI review requested due to automatic review settings July 7, 2026 18:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 4b7db34

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 1cad2bd

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

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

@zkochan
zkochan merged commit 6fbbebf into main Jul 7, 2026
34 checks passed
@zkochan
zkochan deleted the fix-pq12 branch July 7, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants