Skip to content

fix(release): keep the pack-app config inside the packed project - #12801

Merged
zkochan merged 1 commit into
mainfrom
fix/pack-app-exe-config
Jul 4, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix/pack-app-exe-config

Conversation

@zkochan

@zkochan zkochan commented Jul 4, 2026 •

Copy link
Copy Markdown
Member

Summary

The 11.10.0 Release job failed at the "Publish @pnpm/exe" step with ERR_PNPM_PACK_APP_ENTRY_OUTSIDE_PROJECT. The pack-app hardening introduced in #12669 rejects entry and output-dir paths that escape the project directory, and our own @pnpm/exe build config used exactly that shape: entry: "../../pnpm.cjs" and outputDir: ".." relative to pnpm11/pnpm/artifacts/exe. This path is only exercised by the Release workflow, which is why CI didn't catch it before the release ran.

Fix: keep the guard strict and restructure the config so nothing escapes the project.

  • Move the pnpm.app block to pnpm11/pnpm/package.json with entry: "pnpm.cjs" and outputDir: "artifacts" (the app being packed is pnpm, so the config now lives on the package that owns the entry).
  • Run pack-app from the pnpm package root in build-artifacts.ts (cwd: pnpmRootDir instead of exeDir).

Output paths are unchanged: binaries still land in pnpm11/pnpm/artifacts/<target>/pnpm, so the copy/publish steps downstream are unaffected. The pnpm field is stripped from package.json on publish, so nothing new ships in the published pnpm package, and the config reader already whitelists pnpm.app as an actively-read key (no unknown-field warning on install).

Verified by running node dist/pnpm.mjs pack-app --runtime [email protected] --target darwin-arm64 from pnpm11/pnpm — the invocation shape build-artifacts.ts now produces. Both guards pass and the SEA binary is built at the same output path as before.

Loosening the guard to a workspace-root anchor was considered and rejected: it would re-allow embedding files from outside the packed project (e.g. a workspace-root .npmrc) into a distributable binary, and would require mirroring the behavior change in pacquet's pack-app port.

Squash Commit Body

The Release job for 11.10.0 failed at the Publish @pnpm/exe step with
ERR_PNPM_PACK_APP_ENTRY_OUTSIDE_PROJECT: the pack-app hardening from
pnpm/pnpm#12669 rejects entry/output paths that escape the project
directory, and the @pnpm/exe build config used exactly that shape
(entry "../../pnpm.cjs", outputDir ".." relative to
pnpm11/pnpm/artifacts/exe).

Move the pnpm.app config to pnpm11/pnpm/package.json (entry "pnpm.cjs",
outputDir "artifacts") and run pack-app from the pnpm package root in
build-artifacts.ts. Output paths are unchanged
(pnpm11/pnpm/artifacts/<target>/pnpm), and the guard stays strict
instead of being loosened to a workspace-root anchor, which would
re-allow embedding files from outside the packed project.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pacquet/ port, or the description notes what still needs porting.
    (No pacquet change needed: the pack-app guard itself is untouched; this
    only moves pnpm11 release configuration.)
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. (No changeset: the pnpm field is stripped on publish and
    scripts/ is not in @pnpm/exe's files list, so published package
    contents are unchanged.)
  • Added or updated tests. (No new tests: release-workflow-only
    configuration; verified by running pack-app end-to-end locally.)
  • Updated the documentation if needed. (Not needed.)

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

Summary by CodeRabbit

  • Bug Fixes
    • Improved the packaged CLI build process so generated artifacts are created from the correct project location.
    • Updated the supported build targets for the distributed app, helping ensure broader platform coverage.
    • Clarified build notes around target selection and platform exclusions.

The Release job for 11.10.0 failed at the Publish `@pnpm/exe` step with
ERR_PNPM_PACK_APP_ENTRY_OUTSIDE_PROJECT: the pack-app hardening from
#12669 rejects entry/output paths that escape the project
directory, and the `@pnpm/exe` build config used exactly that shape
(entry "../../pnpm.cjs", outputDir ".." relative to
pnpm11/pnpm/artifacts/exe).

Move the pnpm.app config to pnpm11/pnpm/package.json (entry "pnpm.cjs",
outputDir "artifacts") and run pack-app from the pnpm package root in
build-artifacts.ts. Output paths are unchanged
(pnpm11/pnpm/artifacts/<target>/pnpm), and the guard stays strict
instead of being loosened to a workspace-root anchor, which would
re-allow embedding files from outside the packed project.
Copilot AI review requested due to automatic review settings July 4, 2026 19:34

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 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6eff7062-60d1-4acb-b316-fd8553605f1a

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd1e4f and cf5d5f2.

📒 Files selected for processing (3)
  • pnpm11/pnpm/artifacts/exe/package.json
  • pnpm11/pnpm/artifacts/exe/scripts/build-artifacts.ts
  • pnpm11/pnpm/package.json
💤 Files with no reviewable changes (1)
  • pnpm11/pnpm/artifacts/exe/package.json

📝 Walkthrough

Walkthrough

The pnpm.app bundling configuration (entry, outputDir, outputName, targets) is moved from artifacts/exe/package.json to the root package.json. The build-artifacts.ts script's execa.sync call now runs with cwd set to pnpmRootDir instead of exeDir, and related comments are updated.

Changes

pnpm.app Configuration Relocation

Layer / File(s) Summary
Move pnpm.app config to root package.json
pnpm11/pnpm/package.json, pnpm11/pnpm/artifacts/exe/package.json
Removes pnpm.app block from the exe artifact package.json and adds an equivalent block with entry, outputDir, outputName, and target matrix (including musl variants) to the root package.json.
Update build script working directory
pnpm11/pnpm/artifacts/exe/scripts/build-artifacts.ts
Changes execa.sync cwd from exeDir to pnpmRootDir for running the built pnpm.mjs with pack-app arguments, and updates comments describing CLI --target flag behavior and darwin-x64 exclusion.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • pnpm/pnpm#11455: Both PRs modify the exe artifact's pnpm.app target configuration and the build-artifacts.ts flow.
  • pnpm/pnpm#12540: Both PRs touch pnpm11/pnpm/package.json at the same configuration location.
  • pnpm/pnpm#12669: Related to pack-app implementation that reads pnpm.app defaults, aligning with the config relocation and cwd change in this PR.

Suggested labels: product: pnpm@11

Suggested reviewers: qodo-free-for-open-source-projects

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pack-app-exe-config

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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

Copy link
Copy Markdown

PR Summary by Qodo

Fix release pack-app config to stay within pnpm project

🐞 Bug fix ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Fix release pack-app config so entry/output paths never escape the pnpm project.
• Move pnpm.app defaults from @pnpm/exe to pnpm/package.json.
• Run pack-app from the pnpm root; output binaries remain under artifacts//pnpm.
Diagram

graph TD
  A["build-artifacts.ts"] --> B["pnpm CLI: pack-app"] --> C[("artifacts/")] --> D["@pnpm/exe publish"]
  B --> E["pnpm/package.json: pnpm.app"]

  subgraph Legend
    direction LR
    _file["Script/File"] ~~~ _cfg["Config"] ~~~ _dir[("Directory")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Loosen pack-app path guard to workspace-root anchor
  • ➕ Would avoid needing to move configuration between workspace packages
  • ➕ Potentially fewer release-specific build adjustments
  • ➖ Re-allows packaging inputs from outside the packed project (security/hardening regression)
  • ➖ Would require aligning behavior across implementations/ports (e.g., pacquet)
2. Keep config in @pnpm/exe but copy entry into that project
  • ➕ Config remains co-located with the @pnpm/exe release artifact
  • ➕ Avoids changing pnpm/package.json
  • ➖ Adds extra build-time copying/sync logic and risk of drift
  • ➖ Still obscures the fact that the packed app entry is owned by the pnpm package
3. Pass pack-app defaults via CLI flags instead of package.json
  • ➕ Makes build inputs explicit in the build script
  • ➕ Avoids adding pnpm.app metadata to pnpm/package.json
  • ➖ Harder to keep defaults consistent across tooling that expects config-driven behavior
  • ➖ More verbose and easier to accidentally diverge from release expectations

Recommendation: Keep the strict guard and move the config to the package that owns the entrypoint (pnpm/package.json), then run pack-app from that package root. This preserves the hardening intent, removes path-escape violations, and keeps output locations stable for downstream publish steps.

Files changed (3) +19 / -19

Bug fix (1) +3 / -3
build-artifacts.tsRun pack-app from pnpm package root (cwd) +3/-3

Run pack-app from pnpm package root (cwd)

• Updates build-artifacts to execute the pack-app command with cwd set to the pnpm package root. This matches the new location of pnpm.app defaults and ensures entry/outputDir remain within the packed project.

pnpm11/pnpm/artifacts/exe/scripts/build-artifacts.ts

Other (2) +16 / -16
package.jsonRemove pnpm.app pack-app config from @pnpm/exe package.json +0/-16

Remove pnpm.app pack-app config from @pnpm/exe package.json

• Deletes the pnpm.app configuration block that referenced entry/output paths outside the exe project. This avoids triggering pack-app’s path-escape hardening when building @pnpm/exe as part of the release workflow.

pnpm11/pnpm/artifacts/exe/package.json

package.jsonAdd pnpm.app pack-app defaults to pnpm package.json +16/-0

Add pnpm.app pack-app defaults to pnpm package.json

• Introduces a pnpm.app configuration block defining the SEA entrypoint (pnpm.cjs), output directory (artifacts), output name, and target matrix. This keeps pack-app configuration inside the project being packed while preserving existing output paths.

pnpm11/pnpm/package.json

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

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Auto-approved notes - no code review findings
- 'auto_approve_for_no_suggestions' flag enabled

Previous review results

Review updated until commit cf5d5f2

Results up to commit cf5d5f2


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review
Auto-approved notes - no code review findings
- 'auto_approve_for_no_suggestions' flag enabled

Qodo Logo

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

Copy link
Copy Markdown

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

@zkochan
zkochan merged commit 276d634 into main Jul 4, 2026
25 of 27 checks passed
@zkochan
zkochan deleted the fix/pack-app-exe-config branch July 4, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review reviewed: qodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants