Skip to content

fix(release): verify internal package payloads before publish - #13185

Merged
zkochan merged 4 commits into
pnpm:mainfrom
xianjianlf2:fix/package-files-13164
Jul 23, 2026
Merged

zkochan merged 4 commits into
pnpm:mainfrom
xianjianlf2:fix/package-files-13164

Conversation

@xianjianlf2

@xianjianlf2 xianjianlf2 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a release payload verifier (.github/scripts/verify-packed-package-payload.mjs) that checks packed packages contain the manifest-declared files (files, main, module, types, exports, browser, bin, and publishConfig.executableFiles)
  • run it in the release job before the first publish step: one pn compile-only, then four concurrent pnpm pack --dry-run --json chunks over all publishable workspace projects, then a single verifier pass over the reported file lists — no tarballs are written or read, and the file lists come from the exact packing code the publish steps use
  • give @pnpm/modules-mounter.daemon the lib/index.js entry point its manifest declares — the verifier caught that the file never existed, in the published tarballs as well (its exports is stamped by the meta-updater convention, but the package had no src/index.ts)

Related to pnpm/pnpm#13164 (root cause fixed in pnpm/pnpm#13231). Fixes pnpm/pnpm#13179.

Verification

Run locally against the pinned pacquet (12.0.0-alpha.18, which still carries the packing bug):

  • without the release workflow's shadow root .npmignore: the verifier fails on the first lib package with the exact incident signature (all of lib/ missing except the force-included main) — proving it would have blocked the broken releases
  • with the shadow .npmignore in place (as in the release job): Verified payloads of 193 packages
  • single-tarball debug mode fails against the actually-published broken @pnpm/[email protected] tarball, listing the missing lib/ files
  • timing: the four parallel dry-run pack chunks took 15–37s locally; plus one pn compile-only (mostly warm after the build-artifacts step)

Squash Commit Body

Pack every publishable workspace package in dry-run mode before the
first immutable npm publish and verify each reported file list against
the manifest-declared payload (files, main, module, types, exports,
browser, bin, publishConfig.executableFiles). A packing regression like
the one that shipped nearly-empty lib tarballs for five releases
(pnpm/pnpm#13164) now fails the release job before anything publishes.

The verification is one pn compile-only (pack does not run
prepublishOnly), four concurrent `pnpm pack --dry-run --json` chunks
(recursive pack packs one project at a time and, unlike recursive
publish, does not skip private packages — so publishable projects are
selected by explicit name filters), and a single node pass over the
reported file lists. No tarballs are written or read.

Also give @pnpm/modules-mounter.daemon the lib/index.js entry point its
manifest declares; the verifier caught that it never existed.

Fixes pnpm/pnpm#13179

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting. (Release-workflow-only change; no CLI behavior involved.)
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. (For the @pnpm/modules-mounter.daemon entry-point fix; the workflow/script changes touch no published package.)
  • Added or updated tests. (The verifier is exercised against the real broken npm tarball and the full workspace; see Verification.)

@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a CLI that verifies declared package payload files against npm pack results, integrates it into the release workflow, and records a patch release for @pnpm/modules-mounter.daemon.

Changes

Packed payload verification

Layer / File(s) Summary
Expected payload discovery
.github/scripts/verify-packed-package-payload.mjs
Derives literal payload paths from package metadata, export targets, executable declarations, and files exclusions while enforcing path safety and rejecting symlinks.
Tarball payload comparison
.github/scripts/verify-packed-package-payload.mjs
Supports workspace and single-package verification, reads tarball listings, compares expected paths, and aggregates missing-payload errors.
Release workflow integration
.github/workflows/release.yml
Compiles artifacts, runs chunked pn pack --dry-run --json operations for internal projects, and validates payloads before publishing.

Package release metadata

Layer / File(s) Summary
Daemon package patch release
.changeset/daemon-missing-entry-point.md
Adds a patch Changesets record documenting the daemon package entry-point payload correction.

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

Assessment against linked issues

Objective Addressed Explanation
Ensure declared type files are included in published packages [#13164] ❓ The verifier checks declared types/typings paths during release, but no package-specific payload or release artifact is changed here.
Ensure files required by @pnpm/lockfile.fs exports are included [#13179] ❓ The workflow adds validation, but this diff does not directly modify @pnpm/lockfile.fs packaging or add its missing files.

Out-of-scope changes

Code Change Explanation
Add daemon package patch release metadata (.changeset/daemon-missing-entry-point.md:1-5) This concerns @pnpm/modules-mounter.daemon, which is unrelated to the linked @pnpm/hooks.pnpmfile and @pnpm/lockfile.fs objectives.

Suggested labels: product: pnpm@11

Suggested reviewers: zkochan

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

🔧 Checkov (3.3.8)
.github/workflows/release.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

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

@xianjianlf2
xianjianlf2 marked this pull request as ready for review July 21, 2026 07:37
@xianjianlf2
xianjianlf2 requested a review from zkochan as a code owner July 21, 2026 07:37
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Release: verify packed workspace tarballs match package.json payload

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

Grey Divider

AI Description

• Add a verifier to ensure packed tarballs contain all manifest-declared payload files.
• Run verification for all publishable workspace packages before immutable npm publish.
• Add patch changesets to republish two packages with missing TypeScript artifacts.
Diagram

graph TD
A[".github/workflows/release.yml"] --> B["Pack each workspace pkg"] --> C[(".tgz tarball")] --> D["verify-packed-package-payload.mjs"] --> E["package.json payload list"]
D --> F["Workspace source files"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use npm-packlist (or pnpm equivalent) to compute expected files
  • ➕ Matches npm's publish inclusion semantics more closely (including ignore rules)
  • ➕ Reduces custom glob/exports traversal logic to maintain
  • ➖ Adds a dependency and versioning risk in release tooling
  • ➖ Still requires tarball inspection to validate actual packed contents
2. Verify tarball filename list only (no content hashing)
  • ➕ Faster and simpler; avoids reading and hashing payload bytes
  • ➕ Less sensitive to line-ending/transpilation differences if those are acceptable
  • ➖ Would not catch cases where the file exists but content is incorrect/stale
  • ➖ Less confidence for immutable publishes
3. Use `pnpm pack --json` output and validate via `--projects/--pack-json` mode only
  • ➕ Avoids per-package shell loops and tarball discovery in the workflow
  • ➕ More structured data flow; easier to extend to parallelization
  • ➖ Requires reliable --json support and stable schema across pnpm versions
  • ➖ Still needs per-tarball extraction to validate content

Recommendation: Keep the PR’s approach (pack + verify before publish) because it directly prevents repeating the reported failure mode and validates both presence and correctness via hashing. If portability becomes an issue, consider switching tar extraction to a Node tar library or basing expected-file computation on npm-packlist to align with publish semantics.

Files changed (3) +238 / -0

Other (3) +238 / -0
verify-packed-payloads.mdPatch changesets to republish two packages with complete TS artifacts +6/-0

Patch changesets to republish two packages with complete TS artifacts

• Adds patch changesets for @pnpm/hooks.pnpmfile and @pnpm/lockfile.fs to trigger republishing after missing TypeScript outputs were published.

.changeset/verify-packed-payloads.md

verify-packed-package-payload.mjsNew tarball payload verifier for manifest-declared files +204/-0

New tarball payload verifier for manifest-declared files

• Introduces a Node-based verifier that derives a set of expected payload files from package.json (files/main/module/types/typings/exports/browser/bin/executableFiles). It extracts corresponding entries from the packed tarball and compares SHA-256 hashes to ensure the published payload matches workspace sources. Supports per-package mode and multi-project mode via projects.json + pack.json.

.github/scripts/verify-packed-package-payload.mjs

release.ymlRun payload verification for each workspace package before publish +28/-0

Run payload verification for each workspace package before publish

• Adds a release workflow step that enumerates non-private workspace packages, runs their prepublish hooks, packs them to a temp directory, and validates each tarball using the new verifier script. This runs before the publish steps to catch incomplete tarballs prior to immutable npm publication.

.github/workflows/release.yml

@greptile-apps

greptile-apps Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

This looks safe to merge after the existing review feedback is resolved.

  • The dry-run verifier checks packed file membership without comparing postpack source hashes.
  • The new daemon entry point matches the package build and export configuration.
  • No additional blocking issue qualifies for this follow-up review.

Reviews (4): Last reviewed commit: "fix(release): verify payloads via one pa..." | Re-trigger Greptile

Comment thread .github/workflows/release.yml Resolved
@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Remediation recommended

1. Zero chunk size failure 🐞 Bug ☼ Reliability ⭐ New
Description
In the release workflow, if no publishable projects are selected, chunk_size becomes 0 and seq
is invoked with a 0 increment, causing the job to fail before the verifier can emit its intended
error.
This makes the release pipeline brittle in edge cases (e.g., if filters exclude everything or `pn
list` yields no publishable projects).
Code

.github/workflows/release.yml[R425-429]

+          chunk_size=$(( (${#filters[@]} + 3) / 4 ))
+          pack_pids=()
+          verify_args=(--projects "$verify_dir/projects.json")
+          for start in $(seq 0 "$chunk_size" $(( ${#filters[@]} - 1 ))); do
+            pn pack --dry-run --json "${filters[@]:start:chunk_size}" > "$verify_dir/pack-$start.json" &
Relevance

⭐⭐⭐ High

Workflow robustness fix for empty selections aligns with prior accepted guards preventing failures
on empty shards/edge cases.

PR-#12612
PR-#12654
PR-#13064

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow builds filters=() from the projects.json list; if it stays empty, the arithmetic
expansion produces chunk_size=0 and the seq loop uses it as the increment, which seq rejects.

.github/workflows/release.yml[412-431]

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 workflow computes `chunk_size` from the number of `filters`, but when that array is empty the computed step becomes 0 and `seq` fails (invalid increment). This prevents the verifier from running and yields a confusing failure.

### Issue Context
The filters array is built from `pn list --json` output, and its length is not validated before chunking/parallelizing packs.

### Fix Focus Areas
- .github/workflows/release.yml[412-430]

### Suggested fix
- Add an explicit check after building `filters`:
 - if `${#filters[@]} -eq 0`, print a clear error and exit 1 (or skip the step).
- Additionally (or alternatively), clamp `chunk_size` to at least 1 before using it in `seq`.

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


2. Extra tarball files unvalidated 🐞 Bug ⛨ Security
Description
verifyPackedPackage() only verifies that each expected file exists and matches source, but never
enumerates the tarball contents, so a tarball can pass verification while still containing
additional unvalidated files. This can allow accidental publication of unintended artifacts
(including potentially sensitive files that npm packing rules did include) while the workflow
reports the package as “Verified”.
Code

.github/scripts/verify-packed-package-payload.mjs[R40-72]

+function verifyPackedPackage (packageDir, tarball) {
+  const packageRoot = resolve(packageDir)
+  const manifestPath = resolve(packageRoot, 'package.json')
+  const manifest = readJson(manifestPath)
+  const expectedFiles = collectExpectedFiles(packageRoot, manifest)
+  if (expectedFiles.size === 0) {
+    console.log(`No literal package payload files declared by ${manifest.name ?? packageDir}`)
+    return
+  }
+  if (!existsSync(tarball)) {
+    throw new Error(`Missing tarball ${tarball}`)
+  }
+
+  for (const file of [...expectedFiles].sort()) {
+    const source = resolvePayloadPath(packageRoot, file)
+    const stat = lstatSync(source, { throwIfNoEntry: false })
+    if (stat?.isSymbolicLink()) {
+      throw new Error(`Payload file cannot be a symlink: ${source}`)
+    }
+    if (!stat?.isFile()) {
+      throw new Error(`Missing payload file ${source}`)
+    }
+
+    const packed = extractTarEntry(tarball, `package/${file}`)
+    const sourceHash = sha256(readFileSync(source))
+    const packedHash = sha256(packed)
+    if (sourceHash !== packedHash) {
+      throw new Error(`Packed payload differs from source for ${manifest.name ?? packageDir}: ${file}`)
+    }
+  }
+
+  console.log(`Verified ${expectedFiles.size} payload files for ${manifest.name ?? packageDir}`)
+}
Evidence
The verifier’s main loop extracts and hashes only the entries in expectedFiles and then prints
success; there is no step that lists all tar entries and checks for unexpected files. The expected
set itself is constructed from manifest-declared fields, so anything else included in the tarball is
currently outside verification coverage.

.github/scripts/verify-packed-package-payload.mjs[40-72]
.github/scripts/verify-packed-package-payload.mjs[74-117]

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 verifier currently validates only a **subset property** (“all expected files are present and match”), but it does not validate an **exclusion property** (“no unexpected files are present”). As a result, release CI can report success even if the tarball contains additional unintended files.

### Issue Context
- The verifier builds an `expectedFiles` set from `package.json` declarations and then loops only over those entries.
- No `tar -t`/listing step exists to detect extra `package/...` entries.
- For a practical implementation, you’ll likely need an allowlist for common npm-included files (README/LICENSE/etc.) or a non-failing warning mode, to avoid false positives.

### Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[40-149]

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


3. In-memory payload hashing ✓ Resolved 🐞 Bug ➹ Performance
Description
verifyPackedPackage() buffers the full source file and the full extracted tar entry in memory before
hashing, which can spike memory usage and slow the release verification step on large artifacts.
This is avoidable by streaming both the source file and tar stdout into the hash instead of
materializing full Buffers.
Code

.github/scripts/verify-packed-package-payload.mjs[R63-66]

+    const packed = extractTarEntry(tarball, `package/${file}`)
+    const sourceHash = sha256(readFileSync(source))
+    const packedHash = sha256(packed)
+    if (sourceHash !== packedHash) {
Evidence
The verifier hashes by reading entire source files into a Buffer and by returning the full extracted
tar entry as result.stdout (a Buffer), so per-file verification requires holding both contents in
memory at once.

.github/scripts/verify-packed-package-payload.mjs[53-69]
.github/scripts/verify-packed-package-payload.mjs[134-149]

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 verifier currently does `sha256(readFileSync(source))` and hashes `result.stdout` from `tar`, meaning both sides are fully buffered for each verified file. This increases memory pressure and can slow/flake the release workflow when a package declares large payload files.

### Issue Context
This runs in the release workflow and is intended to harden publication; it should be robust even when payload files are large.

### Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[63-69]
- .github/scripts/verify-packed-package-payload.mjs[134-149]

### Suggested fix
- Replace `readFileSync` hashing with a streaming hash (e.g. `createReadStream(source)` piped into `createHash('sha256')`).
- Replace `spawnSync('tar', ...)` extraction+buffering with `spawn('tar', ...)` and stream `stdout` into a hash (no need to materialize `packed` as a Buffer).
- Compare the resulting digests (or compare hashes incrementally if you prefer).

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


View more (10)
4. Manifest files type assumption 🐞 Bug ☼ Reliability
Description
collectExpectedFiles() calls .filter() on manifest.files without verifying it is an array, so
a malformed package.json (e.g. files: {}) will throw a TypeError and fail the release
verification step. Similar shape assumptions exist for other list-like fields (e.g.
publishConfig.executableFiles), risking incorrect iteration or crashes.
Code

.github/scripts/verify-packed-package-payload.mjs[R74-78]

+function collectExpectedFiles (packageDir, manifest) {
+  const files = new Set()
+  const excluded = (manifest.files ?? [])
+    .filter((file) => typeof file === 'string' && file.startsWith('!'))
+    .map((file) => globMatcher(file.slice(1)))
Evidence
The verifier uses array methods/iteration on manifest.files and other list-like manifest fields
without validating types, which can throw at runtime for non-array values and fail the release gate.

.github/scripts/verify-packed-package-payload.mjs[74-78]
.github/scripts/verify-packed-package-payload.mjs[105-107]
.github/scripts/verify-packed-package-payload.mjs[114-116]

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

## Issue description
`collectExpectedFiles()` assumes `manifest.files` is an array and uses array methods on it. If any workspace package has a malformed `package.json` shape (object/number/etc.), the verifier throws and blocks the release workflow.

## Issue Context
This script is invoked from `.github/workflows/release.yml` before publishing, so an avoidable TypeError here becomes a release-blocking failure.

## Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[74-78]
- .github/scripts/verify-packed-package-payload.mjs[105-107]
- .github/scripts/verify-packed-package-payload.mjs[114-116]

## Suggested fix
- Normalize manifest fields before use:
 - `const manifestFiles = Array.isArray(manifest.files) ? manifest.files : []`
 - `const executableFiles = Array.isArray(manifest.publishConfig?.executableFiles) ? manifest.publishConfig.executableFiles : []`
- When iterating, only accept string entries (ignore others) to avoid accidental character-wise iteration on strings and to keep behavior predictable.

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


5. files globs skipped 🐞 Bug ≡ Correctness
Description
collectExpectedFiles() ignores any positive manifest.files entry containing glob metacharacters,
and verifyPackedPackage() returns early when the expected set is empty. Packages that rely on
glob-only files declarations can therefore skip payload verification entirely.
Code

.github/scripts/verify-packed-package-payload.mjs[R105-107]

+  for (const file of manifest.files ?? []) {
+    if (typeof file === 'string' && !file.startsWith('!') && !/[?*[]/.test(file)) add(file)
+  }
Evidence
The code explicitly filters out any files entry containing ?, *, or [ and separately skips
verification when no expected files were collected, creating a false-negative path for glob-only
manifests.

.github/scripts/verify-packed-package-payload.mjs[105-107]
.github/scripts/verify-packed-package-payload.mjs[45-48]

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 verifier currently only adds *literal* entries from `manifest.files` and skips any include entry containing glob metacharacters. If a package’s payload is primarily described by glob patterns, `expectedFiles` may be empty and verification is skipped.

## Issue Context
- Positive `manifest.files` entries are filtered by `!/[?*[]/.test(file)`.
- When `expectedFiles.size === 0`, the verifier logs and returns without checking the tarball.

## Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[45-48]
- .github/scripts/verify-packed-package-payload.mjs[105-107]

## Suggested fix
Implement handling for positive glob patterns in `manifest.files` so they contribute expected payload files. Options:
- Expand glob includes by walking the package directory and matching paths against the glob (reusing `globToRegExp()`), while still applying the existing `excluded` matchers.
- Or, generate the expected packed file list using the repo’s existing packlist implementation (`@pnpm/fs.packlist`) to match actual publish semantics, then intersect with the tarball contents.
In either case, avoid the early-return skip when `manifest.files` contains non-literal include patterns.

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


6. Executable mode not checked 🐞 Bug ≡ Correctness
Description
The verifier treats bin/publishConfig.executableFiles like normal payload files and only
verifies content hashes, so a tarball can pass verification even if those entrypoints are not
executable (+x) after packing. This can ship broken CLIs despite the verifier claiming to validate
executable files.
Code

.github/scripts/verify-packed-package-payload.mjs[R53-69]

+  for (const file of [...expectedFiles].sort()) {
+    const source = resolvePayloadPath(packageRoot, file)
+    const stat = lstatSync(source, { throwIfNoEntry: false })
+    if (stat?.isSymbolicLink()) {
+      throw new Error(`Payload file cannot be a symlink: ${source}`)
+    }
+    if (!stat?.isFile()) {
+      throw new Error(`Missing payload file ${source}`)
+    }
+
+    const packed = extractTarEntry(tarball, `package/${file}`)
+    const sourceHash = sha256(readFileSync(source))
+    const packedHash = sha256(packed)
+    if (sourceHash !== packedHash) {
+      throw new Error(`Packed payload differs from source for ${manifest.name ?? packageDir}: ${file}`)
+    }
+  }
Evidence
bin and publishConfig.executableFiles are included in the expected payload list, but the
verification loop only compares content hashes and never inspects mode/permissions for either the
source file or the tar entry.

.github/scripts/verify-packed-package-payload.mjs[53-69]
.github/scripts/verify-packed-package-payload.mjs[114-116]

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 verifier validates file presence and content equality, but it does not validate the executable bit for files declared as executables (`bin` and `publishConfig.executableFiles`). This allows a packed tarball to have the right bytes but wrong mode, breaking CLI entrypoints.

## Issue Context
- `collectExpectedFiles()` includes `manifest.bin` and `manifest.publishConfig.executableFiles` in the expected payload set.
- `verifyPackedPackage()` only checks `isFile()` and compares SHA-256 of file contents.

## Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[53-69]
- .github/scripts/verify-packed-package-payload.mjs[114-116]

## Suggested fix
- Track which expected files came from `bin` / `publishConfig.executableFiles` (e.g., store in a separate `Set`).
- For those files, additionally verify executability:
 - Source-side: require `stat.mode & 0o111` (or `fs.constants.X_OK` on POSIX).
 - Packed-side: inspect tar entry metadata (mode bits) for `package/<file>` (e.g., via `tar -tvf` parsing or a small tar-header reader) and assert at least one execute bit is set.
- Fail with a clear error message that points to the non-executable path.

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


7. Publish hooks duplicated ✓ Resolved 🐞 Bug ➹ Performance
Description
The release workflow runs prepublishOnly/prepublish during the verification pack step, but `pnpm
publish` already runs those same lifecycle hooks before packing/publishing. This doubles build work
for every published workspace package and can also double-apply any side effects embedded in those
scripts.
Code

.github/workflows/release.yml[R390-395]

+            (
+              cd "$package"
+              pn run --if-present prepublishOnly
+              pn run --if-present prepublish
+              pn pack --pack-destination "$package_tarballs"
+            )
Evidence
The workflow explicitly runs prepublishOnly/prepublish before packing. Separately, pnpm’s
publish implementation runs the same scripts before calling pack, so the verification step
duplicates those lifecycle hooks.

.github/workflows/release.yml[374-400]
pnpm11/releasing/commands/src/publish/publish.ts[261-289]

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

## Issue description
Release workflow runs `prepublishOnly` and `prepublish` for each package during payload verification, but `pnpm publish` already runs the same publish lifecycle hooks before packing. This duplicates work across the whole workspace release set.

## Issue Context
- Workflow verification loop currently runs:
 - `pn run --if-present prepublishOnly`
 - `pn run --if-present prepublish`
 - `pn pack ...`
- pnpm’s publish implementation already executes `prepublishOnly`/`prepublish` (when scripts aren’t ignored) before packing.

## Fix Focus Areas
- .github/workflows/release.yml[374-400]
- pnpm11/releasing/commands/src/publish/publish.ts[261-299]

## Suggested fix directions
Choose one:
1) **Reuse verification tarballs for publishing**: after packing+verifying, publish the produced `.tgz` (publish supports publishing from a tarball path) so hooks aren’t re-run during the later publish step.
2) **Move verification to publish’s pack output**: run a `publish --dry-run`/pack-based flow that produces the exact tarball publish would use, then verify that tarball, then perform the real publish without re-running the build.
3) If you intentionally want verification to run hooks, **publish with `--ignore-scripts`** in the later publish step to prevent the second invocation (only if you’re certain publish/postpublish hooks aren’t needed for these packages).

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


8. Payload verification duplicated workflow-wide 📘 Rule violation ⚙ Maintainability
Description
The release workflow now has multiple independent implementations of “verify packed payload files,”
which increases maintenance burden and risks semantic drift across release jobs. This violates the
reuse/avoid-duplication requirement for non-trivial logic.
Code

.github/workflows/release.yml[R374-400]

+      - name: Verify internal workspace package payloads
+        run: |
+          set -euo pipefail
+          release_tarballs=$(mktemp -d)
+          pn list --filter=!pnpm --filter=!@pnpm/exe --depth=-1 --json > "$release_tarballs/projects.json"
+          node -e '
+            const fs = require("node:fs")
+            const projects = JSON.parse(fs.readFileSync(process.argv[1], "utf8"))
+            for (const project of projects) {
+              if (!project.private && project.name && project.version && project.path) {
+                console.log(project.path)
+              }
+            }
+          ' "$release_tarballs/projects.json" | while IFS= read -r package; do
+            package_tarballs="$release_tarballs/${package//\//_}"
+            mkdir "$package_tarballs"
+            (
+              cd "$package"
+              pn run --if-present prepublishOnly
+              pn run --if-present prepublish
+              pn pack --pack-destination "$package_tarballs"
+            )
+
+            tarball=$(find "$package_tarballs" -type f -name '*.tgz' -print -quit)
+            test -n "$tarball"
+            node .github/scripts/verify-packed-package-payload.mjs --package-dir "$package" --tarball "$tarball"
+          done
Evidence
PR Compliance ID 2 requires avoiding new duplicated logic and refactoring common behavior into
shared utilities when similar logic already exists. The new “Verify internal workspace package
payloads” step introduces another packed-payload verification path while the workflow already embeds
similar tarball payload verification logic in other jobs.

CLAUDE.md: Do not introduce duplication; reuse existing repo utilities and prefer well-maintained libraries
.github/workflows/release.yml[374-400]
.github/workflows/release.yml[212-266]
.github/workflows/release.yml[717-770]

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 workflow contains multiple copies of similar packed-tarball payload verification logic (inline `node -e` + `tar` checks in other jobs, and a new dedicated verifier script used in the new step). This duplication increases drift risk and ongoing maintenance cost.

## Issue Context
This PR introduces `.github/scripts/verify-packed-package-payload.mjs` and uses it for internal workspace packages, but other release jobs still carry their own inline verification implementations.

## Fix Focus Areas
- .github/workflows/release.yml[212-266]
- .github/workflows/release.yml[374-400]
- .github/workflows/release.yml[717-770]
- .github/workflows/release.yml[1114-1167]
- .github/scripts/verify-packed-package-payload.mjs[1-109]

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


9. Workspace packing serialized per-package ✓ Resolved 📘 Rule violation ➹ Performance
Description
The release workflow packs and verifies workspace packages using a serialized shell while loop
that repeatedly invokes pn pack and the verifier per package, adding avoidable wall-clock time and
process-startup overhead. This violates the guidance to avoid unnecessary serialization and misses
pnpm/verifier support for batching and concurrency that would noticeably reduce release CI duration
as the workspace grows.
Code

.github/workflows/release.yml[R374-400]

+      - name: Verify internal workspace package payloads
+        run: |
+          set -euo pipefail
+          release_tarballs=$(mktemp -d)
+          pn list --filter=!pnpm --filter=!@pnpm/exe --depth=-1 --json > "$release_tarballs/projects.json"
+          node -e '
+            const fs = require("node:fs")
+            const projects = JSON.parse(fs.readFileSync(process.argv[1], "utf8"))
+            for (const project of projects) {
+              if (!project.private && project.name && project.version && project.path) {
+                console.log(project.path)
+              }
+            }
+          ' "$release_tarballs/projects.json" | while IFS= read -r package; do
+            package_tarballs="$release_tarballs/${package//\//_}"
+            mkdir "$package_tarballs"
+            (
+              cd "$package"
+              pn run --if-present prepublishOnly
+              pn run --if-present prepublish
+              pn pack --pack-destination "$package_tarballs"
+            )
+
+            tarball=$(find "$package_tarballs" -type f -name '*.tgz' -print -quit)
+            test -n "$tarball"
+            node .github/scripts/verify-packed-package-payload.mjs --package-dir "$package" --tarball "$tarball"
+          done
Evidence
PR Compliance ID 9 calls for avoiding unnecessary serialization by batching or parallelizing
independent work where feasible, yet the workflow’s new step iterates through packages one-by-one
and runs pn pack plus verification sequentially in a while loop. The evidence also notes that
pnpm’s pack supports a recursive/concurrent implementation (e.g., pnpm pack -r with internal
concurrency limiting) and that the verifier script already includes a multi-project/batched mode
(--projects/--pack-json/--tarball-dir) intended to consume pnpm pack --json output,
demonstrating that the current per-package loop is not required and can be replaced with a batched
approach.

CLAUDE.md: Async and loops: prefer async fs and async/await; parallelize independent work; hoist invariants out of loops
.github/workflows/release.yml[374-400]
.github/scripts/verify-packed-package-payload.mjs[17-38]
pnpm11/releasing/commands/src/publish/pack.ts[160-209]

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 release workflow currently packs and verifies each workspace package sequentially via a shell `while` loop, repeatedly starting `pn pack` and the verifier for every package. This unnecessary serialization increases wall-clock time and bypasses pnpm’s recursive/concurrency behavior and the verifier’s existing batched verification mode.

## Issue Context
- PR Compliance ID 9 requires avoiding unnecessary serialization and batching/parallelizing independent work where appropriate.
- The workflow uses the verifier’s per-package mode (`--package-dir/--tarball`) inside a loop, even though the verifier supports batched operation via `--projects/--pack-json/--tarball-dir`.
- `pnpm pack` supports `--recursive` and has an internal concurrency limiter (e.g., via `pLimit(getWorkspaceConcurrency(...))`), which the current per-package shell loop prevents from being effective.
- The verifier’s multi-project mode is designed to consume `pnpm pack --json` output (a `pack.json`), enabling a single verification run over all packed artifacts.

## Fix Focus Areas
- .github/workflows/release.yml[374-400]
- .github/scripts/verify-packed-package-payload.mjs[17-38]
- pnpm11/releasing/commands/src/publish/pack.ts[160-209]

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


10. Tar spawn errors hidden ✓ Resolved 🐞 Bug ☼ Reliability
Description
extractTarEntry() ignores spawnSync’s result.error and assumes result.stderr is usable, so failures
to spawn tar can be reported as a generic “Missing packed entry …” without the real cause. The
fixed 64MiB maxBuffer also hard-fails verification for any single packed entry larger than that
limit.
Code

.github/scripts/verify-packed-package-payload.mjs[R125-133]

+function extractTarEntry (tarball, entry) {
+  const result = spawnSync('tar', ['-xOf', tarball, entry], {
+    encoding: 'buffer',
+    maxBuffer: 1024 * 1024 * 64,
+  })
+  if (result.status !== 0) {
+    throw new Error(`Missing packed entry ${entry} in ${tarball}\n${result.stderr.toString()}`)
+  }
+  return result.stdout
Evidence
extractTarEntry() only checks result.status !== 0 and then formats stderr; it neither checks
result.error nor provides a distinct error path for spawn failures, and it hard-caps stdout
buffering at 64MiB.

.github/scripts/verify-packed-package-payload.mjs[125-133]

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

### Issue description
`extractTarEntry()` throws a “missing entry” error for any non-zero/null status but does not surface `result.error` (spawn failure) and sets a fixed 64MiB maxBuffer, making the release gate brittle and diagnostics misleading.

### Issue Context
This script is used as a release workflow gate; when it fails, maintainers need actionable diagnostics.

### Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[125-133]

### Implementation notes
- If `result.error` is set, throw an error that includes `result.error.message` and relevant context (tarball path, entry).
- Safely stringify stderr: `const stderr = (result.stderr ?? Buffer.from('')).toString()`.
- Reconsider maxBuffer: either raise it based on expected artifact sizes, or switch to a streaming approach (avoid buffering full stdout).

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


11. Custom packlist/glob reimplementation 📘 Rule violation ⚙ Maintainability
Description
The verifier reimplements package payload discovery (including glob-like exclusions and exports/bin
scanning) instead of reusing existing packlist/pack logic already present in the repo. This
increases maintenance burden and risks semantic drift from the actual packaging behavior used by
pnpm pack/publish.
Code

.github/scripts/verify-packed-package-payload.mjs[R70-159]

+function collectExpectedFiles (packageDir, manifest) {
+  const files = new Set()
+  const excluded = (manifest.files ?? [])
+    .filter((file) => typeof file === 'string' && file.startsWith('!'))
+    .map((file) => globMatcher(file.slice(1)))
+
+  const add = (file) => {
+    if (typeof file !== 'string' || file.length === 0) return
+    if (!file.startsWith('./') && file.startsWith('.')) return
+    const relative = normalizeRelative(file)
+    if (!relative || isExcluded(relative, excluded)) return
+
+    const source = join(packageDir, relative)
+    const stat = statSync(source, { throwIfNoEntry: false })
+    if (stat?.isFile()) {
+      files.add(relative)
+      return
+    }
+    if (!stat?.isDirectory()) {
+      throw new Error(`Missing payload file ${source}`)
+    }
+    for (const entry of readdirSync(source, { withFileTypes: true })) {
+      add(join(relative, entry.name))
+    }
+  }
+
+  for (const file of manifest.files ?? []) {
+    if (typeof file === 'string' && !file.startsWith('!') && !/[?*[]/.test(file)) add(file)
+  }
+  add(manifest.main)
+  add(manifest.module)
+  add(manifest.types)
+  add(manifest.typings)
+  addExportTargets(manifest.exports, add)
+  addExportTargets(manifest.browser, add)
+  for (const file of Object.values(typeof manifest.bin === 'string' ? { default: manifest.bin } : manifest.bin ?? {})) add(file)
+  for (const file of manifest.publishConfig?.executableFiles ?? []) add(file)
+
+  return files
+}
+
+function addExportTargets (value, add) {
+  if (typeof value === 'string') {
+    if (value.startsWith('./')) add(value)
+    return
+  }
+  if (Array.isArray(value)) {
+    for (const item of value) addExportTargets(item, add)
+    return
+  }
+  if (value && typeof value === 'object') {
+    for (const item of Object.values(value)) addExportTargets(item, add)
+  }
+}
+
+function extractTarEntry (tarball, entry) {
+  const result = spawnSync('tar', ['-xOf', tarball, entry], {
+    encoding: 'buffer',
+    maxBuffer: 1024 * 1024 * 64,
+  })
+  if (result.status !== 0) {
+    throw new Error(`Missing packed entry ${entry} in ${tarball}\n${result.stderr.toString()}`)
+  }
+  return result.stdout
+}
+
+function globMatcher (pattern) {
+  const normalized = normalizeRelative(pattern)
+  const regexp = globToRegExp(normalized)
+  const basenameRegexp = normalized.includes('/') ? null : globToRegExp(normalized)
+  return (file) => regexp.test(file) || (basenameRegexp?.test(basename(file)) ?? false)
+}
+
+function isExcluded (file, excluded) {
+  return excluded.some((matcher) => matcher(file))
+}
+
+function globToRegExp (pattern) {
+  return new RegExp(
+    '^' +
+    pattern
+      .replace(/[.+^{}()|[\]\\]/g, '\\$&')
+      .replace(/\*\*\//g, '\x00')
+      .replace(/\*\*/g, '\x01')
+      .replace(/\*/g, '[^/]*')
+      .replace(/\x00/g, '(?:.*/)?')
+      .replace(/\x01/g, '.*') +
+    '$'
+  )
+}
Evidence
PR Compliance ID 4 requires reusing or extracting shared utilities instead of introducing parallel
implementations. The new script adds its own collectExpectedFiles() and custom glob-to-regexp
matching, while the repo already contains a shared packlist() utility and the publish pack
command that uses it to determine tarball contents.

CLAUDE.md: Avoid Duplicated Functionality by Reusing or Extracting Shared Utilities
.github/scripts/verify-packed-package-payload.mjs[70-159]
pnpm11/fs/packlist/src/index.ts[23-45]
pnpm11/releasing/commands/src/publish/pack.ts[293-297]

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 verifier duplicates packlist/payload-selection logic (manifest `files`, exports/bin targets, and glob-style exclusions) instead of reusing established repo utilities.

## Issue Context
The repo already has `@pnpm/fs.packlist` (wrapping `npm-packlist`) and the release/publish pack implementation that derives the packed file list; duplicating this logic in a standalone script risks divergence.

## Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[70-159]
- pnpm11/fs/packlist/src/index.ts[23-45]
- pnpm11/releasing/commands/src/publish/pack.ts[293-297]

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


12. Verifier path root escape ✓ Resolved 🐞 Bug ⛨ Security
Description
collectExpectedFiles() builds paths with join(packageDir, normalizeRelative(file)) without rejecting
'..' segments and uses statSync/readFileSync (follows symlinks), so a crafted workspace manifest can
make the release verifier read/hash files outside the package root or recurse into symlinked
directories. This is a release-pipeline hardening gap that can turn a manifest/path into unintended
file access and potential DoS during the release job.
Code

.github/scripts/verify-packed-package-payload.mjs[R70-94]

+function collectExpectedFiles (packageDir, manifest) {
+  const files = new Set()
+  const excluded = (manifest.files ?? [])
+    .filter((file) => typeof file === 'string' && file.startsWith('!'))
+    .map((file) => globMatcher(file.slice(1)))
+
+  const add = (file) => {
+    if (typeof file !== 'string' || file.length === 0) return
+    if (!file.startsWith('./') && file.startsWith('.')) return
+    const relative = normalizeRelative(file)
+    if (!relative || isExcluded(relative, excluded)) return
+
+    const source = join(packageDir, relative)
+    const stat = statSync(source, { throwIfNoEntry: false })
+    if (stat?.isFile()) {
+      files.add(relative)
+      return
+    }
+    if (!stat?.isDirectory()) {
+      throw new Error(`Missing payload file ${source}`)
+    }
+    for (const entry of readdirSync(source, { withFileTypes: true })) {
+      add(join(relative, entry.name))
+    }
+  }
Evidence
normalizeRelative() only strips a leading './' and does not remove or reject '..' components; the
resulting string is joined onto packageDir and then stat/readFileSync are applied (which follow
symlinks), so traversal outside the package root is possible. Repo guidance explicitly calls out
manifests/paths as attacker-controlled and warns about traversal/symlink issues.

.github/scripts/verify-packed-package-payload.mjs[76-93]
.github/scripts/verify-packed-package-payload.mjs[161-163]
REVIEW_GUIDE.md[30-56]

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 verifier accepts manifest-declared file paths that can escape `packageDir` via `..` segments (and can traverse symlinks because it uses `statSync`), allowing unintended file reads during release verification.

### Issue Context
This script is executed in the release workflow. Even though the workspace is usually trusted, the repo’s security guidance treats manifests/paths as attacker-controlled, and the verifier should be fail-safe and root-contained.

### Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[70-94]
- .github/scripts/verify-packed-package-payload.mjs[161-163]

### Implementation notes
- Normalize and validate each candidate path **as POSIX** (package.json uses `/`):
 - reject absolute paths
 - reject any normalized path that starts with `..` or contains `../`
 - consider rejecting any path segment equal to `..`
- Enforce root containment with `const abs = resolve(packageDir, relative)` and `if (!abs.startsWith(packageDir + sep)) throw ...`.
- Decide symlink policy explicitly:
 - safest: use `lstatSync` and reject symlinks (both file and directory symlinks)
 - or: `realpathSync` containment check to ensure targets stay under `packageDir`.

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


13. Sync I/O in verifier loop ✓ Resolved 📘 Rule violation ➹ Performance
Description
The release payload verifier performs blocking filesystem operations and repeatedly runs tar
synchronously inside a per-file loop, which serializes work and scales poorly as the number of files
and workspace packages grows. This can significantly slow release CI and violates the repo’s
async/performance conventions around avoiding blocking I/O and unnecessary serialization.
Code

.github/scripts/verify-packed-package-payload.mjs[R52-64]

+  for (const file of [...expectedFiles].sort()) {
+    const source = join(packageDir, file)
+    const stat = statSync(source, { throwIfNoEntry: false })
+    if (!stat?.isFile()) {
+      throw new Error(`Missing payload file ${source}`)
+    }
+
+    const packed = extractTarEntry(tarball, `package/${file}`)
+    const sourceHash = sha256(readFileSync(source))
+    const packedHash = sha256(packed)
+    if (sourceHash !== packedHash) {
+      throw new Error(`Packed payload differs from source for ${manifest.name ?? packageDir}: ${file}`)
+    }
Evidence
PR Compliance ID 14 requires preferring async fs/async execution and avoiding unnecessary
serialization, yet the verifier uses statSync/readFileSync and calls extractTarEntry() inside
a loop over expectedFiles; extractTarEntry() uses spawnSync('tar', ...), so each expected file
triggers a fully blocking subprocess and archive read. Because the release workflow invokes this
verification for every non-private workspace package (with many package globs), the per-file
synchronous tar -xOf calls multiply across packages, amplifying total subprocess startups and tar
reads and increasing overall release workflow time.

CLAUDE.md: Async Conventions: Prefer async fs, async/await, Parallelize Independent Work, and Hoist Invariants Out of Loops
.github/scripts/verify-packed-package-payload.mjs[52-64]
.github/scripts/verify-packed-package-payload.mjs[125-133]
.github/workflows/release.yml[374-400]
.github/scripts/verify-packed-package-payload.mjs[52-65]
.github/scripts/verify-packed-package-payload.mjs[125-134]
pnpm-workspace.yaml[1-55]

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 packed-package payload verifier currently uses blocking filesystem APIs (`statSync`/`readFileSync`) and spawns `tar` synchronously (`spawnSync`) once per expected file, which serializes work and scales poorly when the release workflow runs the verifier across many workspace packages.

## Issue Context
This verifier runs during publishing in `.github/workflows/release.yml`, so inefficiencies directly increase release duration and can affect CI reliability. The workflow loops over all non-private workspace projects and invokes the verifier per package; combined with a per-file loop that calls `extractTarEntry()` (which shells out to `tar -xOf` synchronously), the total number of subprocesses and archive reads grows quickly with the number of packages and expected files.

Implementation direction options (pick one or combine):
- Run a single tar listing (`tar -tf`) once per tarball to validate presence, then extract/hashes in fewer calls (or a single call) rather than per file.
- Extract the tarball once to a temp directory (bounded and cleaned up) and hash files directly from disk to avoid repeated process startup and large stdout buffering.
- Use a Node tar reader library to stream entries and compute hashes in-process, avoiding repeated external `tar` invocations.

## Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[40-68]
- .github/scripts/verify-packed-package-payload.mjs[52-66]
- .github/scripts/verify-packed-package-payload.mjs[125-134]
- .github/workflows/release.yml[374-400]

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



Informational

14. Missing CLI values unchecked 🐞 Bug ☼ Reliability ⭐ New
Description
parseArgs() consumes option values via rawArgs[++i] without checking that a value exists, so
malformed invocations (e.g. trailing --pack-json) can later fail with unrelated fs/JSON errors
instead of a targeted usage message.
This affects --projects, --pack-json, --package-dir, and --tarball.
Code

.github/scripts/verify-packed-package-payload.mjs[228]

+      args.packJsons.push(rawArgs[++i])
Relevance

⭐⭐⭐ High

Small, deterministic CLI hardening; repo generally accepts improving argument parsing/validation to
avoid confusing failures.

PR-#11781
PR-#12162
PR-#11489

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
parseArgs() pushes the next argv token for --pack-json (and similarly for other flags) without
validating it exists; usage() only handles unknown args or mode mismatch, not missing values.

.github/scripts/verify-packed-package-payload.mjs[221-237]
.github/scripts/verify-packed-package-payload.mjs[240-245]

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 verifier’s CLI parsing increments the argv index to grab the next token as a flag value, but does not validate that the next token exists (or that it isn’t another flag). This can produce confusing downstream failures.

### Issue Context
This script is used in the release workflow and also supports a standalone mode; better diagnostics reduce time-to-debug when arguments are wired incorrectly.

### Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[221-237]
- .github/scripts/verify-packed-package-payload.mjs[240-245]

### Suggested fix
- Introduce a helper like `consumeValue(flagName)` that:
 - checks `i + 1 < rawArgs.length`
 - checks the next token does not start with `--`
 - otherwise calls `usage('missing value for ' + flagName)`
- Use it for all value-taking flags (`--projects`, `--pack-json`, `--package-dir`, `--tarball`).

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


15. pnpm missing in changeset 📘 Rule violation § Compliance ⭐ New
Description
The new changeset file does not include a pnpm entry in its front-matter package list. This
violates the requirement to explicitly declare the pnpm package and bump type in each changeset.
Code

.changeset/daemon-missing-entry-point.md[R1-3]

+---
+"@pnpm/modules-mounter.daemon": patch
+---
Relevance

⭐ Low

Multiple PRs rejected adding mandatory pnpm entry in changeset front-matter; team doesn’t enforce
this rule.

PR-#12991
PR-#13117
PR-#13225

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires changesets to include an explicit pnpm entry with a valid bump
type. The added changeset front-matter only lists @pnpm/modules-mounter.daemon and omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/daemon-missing-entry-point.md[1-3]

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 changeset front-matter is missing the required `pnpm` entry with a valid bump type (`patch`/`minor`/`major`).

## Issue Context
Compliance requires each changeset to explicitly include `pnpm` and a correct bump type.

## Fix Focus Areas
- .changeset/daemon-missing-entry-point.md[1-3]

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


16. Projects JSON shape unchecked 🐞 Bug ☼ Reliability
Description
verifyPackedProjects() assumes projects.json is iterable and that pack.json entries are non-null
objects with name/version/filename, so malformed or unexpected shapes can throw TypeErrors and
produce unclear failures. This makes --projects mode brittle and harder to debug if the producer
format changes.
Code

.github/scripts/verify-packed-package-payload.mjs[R17-36]

+function verifyPackedProjects ({ projects, packJson, tarballDir }) {
+  if (!packJson) usage('missing --pack-json')
+  if (!tarballDir) usage('missing --tarball-dir')
+
+  const projectById = new Map()
+  for (const project of readJson(projects)) {
+    if (!project.name || !project.version || !project.path) continue
+    projectById.set(`${project.name}@${project.version}`, project.path)
+  }
+
+  const packedPackages = normalizeArray(readJson(packJson))
+  for (const packedPackage of packedPackages) {
+    const projectDir = projectById.get(`${packedPackage.name}@${packedPackage.version}`)
+    if (!projectDir) {
+      throw new Error(`Cannot find workspace project for packed package ${packedPackage.name}@${packedPackage.version}`)
+    }
+    const tarball = isAbsolute(packedPackage.filename)
+      ? packedPackage.filename
+      : resolve(tarballDir, packedPackage.filename)
+    verifyPackedPackage(projectDir, tarball)
Evidence
The code iterates over readJson(projects) directly and wraps any non-array pack.json into an
array (including null), then dereferences fields like packedPackage.name/filename without type
checks, which can raise runtime TypeErrors.

.github/scripts/verify-packed-package-payload.mjs[17-37]
.github/scripts/verify-packed-package-payload.mjs[202-208]

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

### Issue description
`--projects` mode currently trusts the parsed JSON shapes; if `projects.json` is not an array or if `pack.json` contains null/invalid entries, the verifier will throw generic JS errors (e.g. non-iterable / cannot read property), which is brittle for CI usage.

### Issue Context
Even if today’s release workflow uses `--package-dir/--tarball`, the script advertises `--projects` mode and the PR description mentions it. Adding lightweight validation improves long-term robustness and error messages.

### Fix Focus Areas
- .github/scripts/verify-packed-package-payload.mjs[17-37]
- .github/scripts/verify-packed-package-payload.mjs[202-208]

### Suggested fix
- After `readJson(projects)`, assert `Array.isArray(projectsJson)`; otherwise throw an explicit error.
- After `normalizeArray(readJson(packJson))`, filter/validate entries: ensure each is an object and has string `name`, `version`, `filename`; otherwise throw a clear error pointing at the bad entry.
- Consider validating that `packedPackage.filename` is a string before calling `isAbsolute()`/`resolve()`.

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


View more (2)
17. Ambiguous tarball selection ✓ Resolved 🐞 Bug ≡ Correctness
Description
The release workflow chooses the tarball to verify using find ... -print -quit, which is ambiguous
if multiple .tgz files end up in the destination directory. In that case the verifier may validate
the wrong archive (false confidence or spurious failure).
Code

.github/workflows/release.yml[R397-399]

+            tarball=$(find "$package_tarballs" -type f -name '*.tgz' -print -quit)
+            test -n "$tarball"
+            node .github/scripts/verify-packed-package-payload.mjs --package-dir "$package" --tarball "$tarball"
Evidence
The workflow uses find ... -quit (first match) to choose a tarball. The repo’s pack command
supports --json output that includes the produced tarball filename, which can be used to avoid
ambiguity.

.github/workflows/release.yml[397-399]
pnpm11/releasing/commands/src/publish/pack.ts[153-158]

[Comment truncated to fit github's 65,536-char limit.]

@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: 3

🤖 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 @.github/scripts/verify-packed-package-payload.mjs:
- Around line 147-159: Update globToRegExp so its regex-escaping character class
also escapes literal `$`, and translate glob `?` into a pattern matching exactly
one non-slash character. Apply the wildcard conversion alongside the existing
`*` handling so patterns such as `foo?.js` cannot match a missing character.
- Around line 130-132: Update the error handling around the spawnSync result in
the packed-entry verification flow so missing stderr does not cause a secondary
TypeError. Safely read result.stderr only when present, while preserving the
existing “Missing packed entry” context and exposing the original spawn failure
details when available.
- Around line 76-80: Update the add function’s file-filtering logic to
explicitly ignore package.json before it is normalized or added to
expectedFiles, while preserving existing exclusions and validation for all other
files.
🪄 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: 9fa37371-20ee-490c-92be-7e53602a62a0

📥 Commits

Reviewing files that changed from the base of the PR and between 5e6dd35 and 072dd82.

📒 Files selected for processing (3)
  • .changeset/verify-packed-payloads.md
  • .github/scripts/verify-packed-package-payload.mjs
  • .github/workflows/release.yml

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 072dd82

@xianjianlf2
xianjianlf2 force-pushed the fix/package-files-13164 branch from 072dd82 to 273f078 Compare July 21, 2026 10:22
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Updated this PR to address the actionable verifier feedback:

  • ignore package.json before adding expected payload files, including normalized variants
  • make glob exclusion handling escape literal $ and treat ? as exactly one non-slash character
  • make tar extraction errors robust when stderr is absent and surface spawnSync failures distinctly
  • reject absolute or .. payload paths and enforce package-root containment before reading source files
  • use lstatSync and reject symlink payloads so the release gate does not follow paths outside the package tree

Local verification:

  • node --check .github/scripts/verify-packed-package-payload.mjs
  • temporary tarball fixture covering package.json ignore, ? exclusion, and payload hash verification
  • negative fixture confirming ../secret.js is rejected as escaping the package directory
  • git diff --check

I attempted to also run pnpm pack against pnpm11/hooks/pnpmfile and pnpm11/lockfile/fs, but this local corepack cache has an incomplete [email protected] install: the cached pnpm is only a placeholder and @pnpm/exe.darwin-arm64 is missing, so the pack command cannot start locally.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 21, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 273f078

1 similar comment
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 273f078

@xianjianlf2
xianjianlf2 force-pushed the fix/package-files-13164 branch from 273f078 to 30f7c37 Compare July 22, 2026 03:25
@xianjianlf2

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main and pushed the updated commit (30f7c37). The previous Audit dependencies failure is stale after the rebase; local high-threshold audit now exits successfully with only the existing ignored moderate advisory.

Local checks:

  • node --check .github/scripts/verify-packed-package-payload.mjs
  • git diff --check
  • PATH=/Users/even/.nvm/versions/node/v24.18.0/bin:$PATH COREPACK_ENABLE_PROJECT_SPEC=0 node /Users/even/.cache/node/corepack/v1/pnpm/11.13.0/bin/pnpm.cjs audit --audit-level high
  • smoke-tested .github/scripts/verify-packed-package-payload.mjs against a temporary tarball with a package/index.js payload entry: Verified 1 payload files for payload-smoke

Note: pushes use HUSKY=0 locally because this checkout's Corepack shim for [email protected] points at a missing cached bin/pnpm.mjs; validation used a working pnpm entrypoint.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 30f7c37

1 similar comment
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 30f7c37

simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Jul 23, 2026
The Pack step re-serialized the manifest itself — JSON.parse, drop
devDependencies/scripts, `JSON.stringify(rest, null, 2)` — which hardcoded
two-space indent and would silently reformat any manifest that used something
else. Reading and writing through @pnpm/workspace.project-manifest-reader
reproduces the file's own formatting instead, and it is the same reader
`pnpm pack` reads with.

strippedManifest now takes and returns the parsed manifest rather than JSON
text; the manifest type is derived from the reader's exported
WriteProjectManifest rather than imported from @pnpm/types, so the strip's one
obligation — that pnpm's writer still accepts the result — is stated in the
type, and no second exact pin is needed. Parsing and formatting concerns move
to the reader, so their unit tests go with them; a non-mutation test replaces
them, since the caller now holds the manifest object across the pack.

check-published-diff deliberately keeps `npm pkg delete`. Two package managers
reaching the same packed bytes from congruent commands is a stronger check
than either alone, and that check is where the disagreement would surface.

Pinned to 1100.0.15, not the 1100.0.19 tip: pnpm's release workflow stopped
verifying packed payloads, and 1100.0.16 onward ship only lib/index.js — no
readFile.js, no .d.ts — so they fail at import. Same regression as
pnpm/pnpm#13164 and #13179, fix open at pnpm/pnpm#13185. Exact-pinned like the
other two pnpm SDK entries, and for the same reason.

Verified: packing lit-ui-router before and after produces byte-identical
tarballs (every packed file, including package.json at
sha256 0ae76468...), so no release is owed; check:published-diff returns the
same verdicts as before (3 packages, no ship-affecting drift, 3 ship-inert),
which is the npm-vs-pnpm differential agreeing; the working tree is restored
after pack; check:pack, release tests, typecheck, lint and format all green.
simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Jul 23, 2026
The Pack step re-serialized the manifest itself — JSON.parse, drop
devDependencies/scripts, `JSON.stringify(rest, null, 2)` — which hardcoded
two-space indent and would silently reformat any manifest that used something
else. Reading and writing through @pnpm/workspace.project-manifest-reader
reproduces the file's own formatting instead, and it is the same reader
`pnpm pack` reads with.

strippedManifest now takes and returns the parsed manifest rather than JSON
text. Parsing and formatting concerns move to the reader, so their unit tests
go with them; a non-mutation test replaces them, since the caller now holds
the manifest object across the pack.

check-published-diff reuses that same strip instead of shelling out to
`npm pkg delete`. Its job is to answer "would a publish ship different bytes",
which is only sound if the local side is packed from byte-identical input —
sharing the strip guarantees that, where a second implementation could only
agree with it until one of them changed. That removes the last `npm pkg`
caller; STRIPPED_MANIFEST_FIELDS stays as the packed-manifest gate's statement
of intent, and its test now pins both ends so the two can't drift silently.

Pinned to 1100.0.15, not the 1100.0.19 tip: pnpm's release workflow stopped
verifying packed payloads, and 1100.0.16 onward ship only lib/index.js — no
readFile.js, no .d.ts — so they fail at import. Same regression as
pnpm/pnpm#13164 and #13179, fix open at pnpm/pnpm#13185. Every @pnpm/*
dependency of 1100.0.15 is itself exact-pinned upstream, so that one pin fixes
the whole pnpm closure; all six were checked for complete payloads. @pnpm/types
is pinned directly too, since release-pack.core.ts now imports ProjectManifest
from it rather than deriving the type structurally.

Verified: packing lit-ui-router before and after produces byte-identical
tarballs (every packed file, including package.json at sha256 0ae76468...), so
no release is owed; check:published-diff returns the same verdicts as before
(3 packages, no ship-affecting drift, 3 ship-inert); the working tree is
restored after pack; check:pack, release tests, typecheck, lint and format all
green.
simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Jul 23, 2026
The Pack step re-serialized the manifest itself — JSON.parse, drop
devDependencies/scripts, `JSON.stringify(rest, null, 2)` — which hardcoded
two-space indent and would silently reformat any manifest that used something
else. Reading and writing both go through
@pnpm/workspace.project-manifest-reader instead, the same reader `pnpm pack`
reads with, so the stripped file keeps the source manifest's own formatting.
The restore is the manifest the reader handed back, so the step no longer
keeps its own copy of the original bytes to write over the top.

strippedManifest now takes and returns the parsed manifest rather than JSON
text. Parsing and formatting concerns move to the reader, so their unit tests
go with them; a non-mutation test replaces them, since the caller now holds
the manifest object across the pack and restores from it.

check-published-diff reuses that same strip instead of shelling out to
`npm pkg delete`. Its job is to answer "would a publish ship different bytes",
which is only sound if the local side is packed from byte-identical input —
sharing the strip guarantees that, where a second implementation could only
agree with it until one of them changed. That removes the last `npm pkg`
caller; STRIPPED_MANIFEST_FIELDS stays as the packed-manifest gate's statement
of intent, and its test now pins both ends so the two can't drift silently.

Pinned to 1100.0.15, not the 1100.0.19 tip: pnpm's release workflow stopped
verifying packed payloads, and 1100.0.16 onward ship only lib/index.js — no
readFile.js, no .d.ts — so they fail at import. Same regression as
pnpm/pnpm#13164 and #13179, fix open at pnpm/pnpm#13185. Every @pnpm/*
dependency of 1100.0.15 is itself exact-pinned upstream, so that one pin fixes
the whole pnpm closure; all six were checked for complete payloads. @pnpm/types
is pinned directly too, since release-pack.core.ts now imports ProjectManifest
from it rather than deriving the type structurally.

Verified: packing each publishable package leaves its package.json
byte-identical (sha unchanged, clean git status), so the reader round-trip
restores exactly what the raw-bytes copy did; packing lit-ui-router still
produces a tarball identical to the pre-refactor baseline, every packed file
included (package.json at sha256 0ae76468...), so no release is owed;
check:published-diff returns the same verdicts as before (3 packages, no
ship-affecting drift, 3 ship-inert); check:pack, release tests, typecheck,
lint and format all green.
simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Jul 23, 2026
The Pack step re-serialized the manifest itself — JSON.parse, drop
devDependencies/scripts, `JSON.stringify(rest, null, 2)` — which hardcoded
two-space indent and would silently reformat any manifest that used something
else. Reading and writing both go through
@pnpm/workspace.project-manifest-reader instead, the same reader `pnpm pack`
reads with, so the stripped file keeps the source manifest's own formatting.
The restore is the manifest the reader handed back, so the step no longer
keeps its own copy of the original bytes to write over the top.

strippedManifest now takes and returns the parsed manifest rather than JSON
text. Parsing and formatting concerns move to the reader, so their unit tests
go with them; a non-mutation test replaces them, since the caller now holds
the manifest object across the pack and restores from it.

check-published-diff reuses that same strip instead of shelling out to
`npm pkg delete`. Its job is to answer "would a publish ship different bytes",
which is only sound if the local side is packed from byte-identical input —
sharing the strip guarantees that, where a second implementation could only
agree with it until one of them changed. That removes the last `npm pkg`
caller; STRIPPED_MANIFEST_FIELDS stays as the packed-manifest gate's statement
of intent, and its test now pins both ends so the two can't drift silently.

Pinned to 1100.0.15, not the 1100.0.19 tip: pnpm's release workflow stopped
verifying packed payloads, and 1100.0.16 onward ship only lib/index.js — no
readFile.js, no .d.ts — so they fail at import. Same regression as
pnpm/pnpm#13164 and #13179, fix open at pnpm/pnpm#13185. Every @pnpm/*
dependency of 1100.0.15 is itself exact-pinned upstream, so that one pin fixes
the whole pnpm closure; all six were checked for complete payloads. @pnpm/types
is pinned directly too, since release-pack.core.ts now imports ProjectManifest
from it rather than deriving the type structurally.

Verified: packing each publishable package leaves its package.json
byte-identical (sha unchanged, clean git status), so the reader round-trip
restores exactly what the raw-bytes copy did; packing lit-ui-router still
produces a tarball identical to the pre-refactor baseline, every packed file
included (package.json at sha256 0ae76468...), so no release is owed;
check:published-diff returns the same verdicts as before (3 packages, no
ship-affecting drift, 3 ship-inert); check:pack, release tests, typecheck,
lint and format all green.
zkochan added 3 commits July 23, 2026 15:00
Replace the per-package pack loop with four concurrent pnpm pack
--dry-run --json chunks whose reported file lists the verifier checks
directly: no tarballs are written or read, no per-package script
spawns, and no per-file tar extractions. The compiled payloads are
built once with pn compile-only beforehand, since pack does not run
prepublishOnly. Publishable projects are selected by explicit name
filters because recursive pack, unlike recursive publish, does not
skip private packages, and packing the private workspace root would
walk the whole repository.

Give `@pnpm/modules-mounter.daemon` the lib/index.js entry its
manifest (and the meta-updater exports rule) declares: the verifier
caught that the file never existed, in the published tarballs as well.
Drop the two-package republish changeset, superseded by the
all-packages republish changeset from pnpm#13231.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/scripts/verify-packed-package-payload.mjs (1)

118-120: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Expand positive files globs before comparing.

At Line 119, entries containing *, ?, or [ are ignored entirely. A package using files: ["lib/**/*.js"] can therefore pass while required non-entrypoint runtime files are omitted. Enumerate matching source paths and add each to the expected set.

Based on PR objectives, the verifier must cover manifest-declared files.

🤖 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 @.github/scripts/verify-packed-package-payload.mjs around lines 118 - 120,
Update the manifest.files handling loop in verify-packed-package-payload to
expand positive glob entries containing *, ?, or [ into matching source paths
and add every match to the expected set. Continue ignoring negated entries,
preserve literal-file handling, and ensure all manifest-declared files are
included in verification.
🤖 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.

Outside diff comments:
In @.github/scripts/verify-packed-package-payload.mjs:
- Around line 118-120: Update the manifest.files handling loop in
verify-packed-package-payload to expand positive glob entries containing *, ?,
or [ into matching source paths and add every match to the expected set.
Continue ignoring negated entries, preserve literal-file handling, and ensure
all manifest-declared files are included in verification.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d9fd79ed-1e2c-4194-b3b8-d6d359e96b12

📥 Commits

Reviewing files that changed from the base of the PR and between 30f7c37 and b0aea76.

📒 Files selected for processing (3)
  • .changeset/daemon-missing-entry-point.md
  • .github/scripts/verify-packed-package-payload.mjs
  • .github/workflows/release.yml

@zkochan

zkochan commented Jul 23, 2026

Copy link
Copy Markdown
Member

Pushed b0aea76 (maintainer-side rework) — thanks for the verifier and the groundwork, xianjianlf2! The payload-computation logic is yours nearly unchanged; what changed is how it runs, to keep the release job fast, plus composition with what landed in pnpm/pnpm#13231 since this PR was opened:

  • Replaced the per-package loop with one parallel dry-run pack. The loop spawned pn run prepublishOnly + pn run prepublish + pn pack per package (~570 process spawns) and the verifier extracted every file with its own tar spawn — about 5–15 minutes of release-job time. Now: one pn compile-only (pack doesn't run prepublishOnly), four concurrent pnpm pack --dry-run --json chunks (recursive pack packs one project at a time and, unlike recursive publish, doesn't skip private packages — so publishable projects are selected by explicit name filters), and a single verifier pass over the JSON-reported file lists. No tarballs are written or read; the dry-run file lists come from the same packing code publish uses. Locally this runs in ~15–40s.
  • The verifier now aggregates all failures instead of stopping at the first, and its single-tarball mode reads one tar -tf listing (still fails against the broken @pnpm/[email protected] on npm, as your original did).
  • It caught a real pre-existing defect on the first full run: @pnpm/modules-mounter.daemon declares main: lib/index.js (stamped by the meta-updater's exports convention) but never had a src/index.ts, so every published tarball lacks its entry point. Added the index (re-exporting createFuseHandlers) with a changeset.
  • Dropped the two-package republish changeset — superseded by the all-packages republish changeset that fix(fs-packlist): let the files allowlist override workspace-inherited ignores #13231 merged.
  • Merged current main into the branch so the step composes with the temporary shadow-.npmignore step (which must run first; it does — it precedes build-artifacts).

Full-workspace verification passes locally with the shadow file in place: Verified payloads of 193 packages. Without it, the verifier reproduces the exact incident failure against the pinned pacquet — which is the guard doing its job.


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

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan
zkochan merged commit a1ae5b8 into pnpm:main Jul 23, 2026
28 checks passed
simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Jul 23, 2026
…442)

* chore(tooling): roll the npm pin forward to 12.0.1

Bumps the single version authority (`"npm:npm"` in .config/mise/config.toml,
regenerated mise.lock) off the aged 11 line onto npm 12.

The 12 major's headline break — dependency lifecycle scripts gated behind an
`allowScripts` allowlist — turned out to be a no-op here: all three examples
already carry the allowlist, and `npm approve-scripts --allow-scripts-pending`
reports no unreviewed scripts in any of them. `[email protected]` is the only
package with `hasInstallScript` across the three lockfiles and it matches its
pin exactly; a clean-`node_modules` reinstall under 12 leaves its native
binding in place, so the entry is load-bearing and the approval is honored.

Drops the `[email protected]` entries: vite 8 dropped esbuild and it appears in
none of the three lockfiles, so they allowlisted a package that is not there.

Also declares the examples' package manager explicitly via `devEngines`, since
they are standalone `npm ci` projects sitting in a pnpm workspace. `devEngines`
is npm-native and enforced before install/ci/run; corepack's `packageManager`
field does not support npm (nodejs/node#51888), so it would have been inert.
No version floor: the mise pin is the one npm authority, and StackBlitz ships
its own npm (10.8.2 today), so `onFail: "warn"` keeps that expected drift quiet.

Auditing npm 12's `npm pkg` surface turned up stale comments: several described
the strip as publish-npm.yml running `npm pkg delete`, but that step became TS
(release-pack.core.ts) and the workflow has no `npm pkg` step. The one real
remaining caller is check-published-diff, which still strips that way to
reproduce the Pack step. Comments corrected to say so; no behavior change.

Verified against npm 12.0.1:
- all three `npm ci --prefix` legs green, zero warnings, no lockfile churn,
  standalone, from clean node_modules, and through the workspace postinstall
- `npm view <pkg> dist-tags.latest` output byte-identical to npm 11, and E404
  still lands in stderr for unpublished packages (resolve-published.ts)
- check:published-diff passes — `npm pkg delete`, `pnpm pack` and `npm diff`
  all intact; the 3 ship-inert package.json drifts are pre-existing
- check:pack, release tests, examples lint/typecheck/format all green
- root .npmrc is a plain scoped-registry line, safe under 12's throw-on-
  unknown-config

Closes #326

* refactor(release): pack through pnpm's project-manifest reader

The Pack step re-serialized the manifest itself — JSON.parse, drop
devDependencies/scripts, `JSON.stringify(rest, null, 2)` — which hardcoded
two-space indent and would silently reformat any manifest that used something
else. Reading and writing both go through
@pnpm/workspace.project-manifest-reader instead, the same reader `pnpm pack`
reads with, so the stripped file keeps the source manifest's own formatting.
The restore is the manifest the reader handed back, so the step no longer
keeps its own copy of the original bytes to write over the top.

strippedManifest now takes and returns the parsed manifest rather than JSON
text. Parsing and formatting concerns move to the reader, so their unit tests
go with them; a non-mutation test replaces them, since the caller now holds
the manifest object across the pack and restores from it.

check-published-diff reuses that same strip instead of shelling out to
`npm pkg delete`. Its job is to answer "would a publish ship different bytes",
which is only sound if the local side is packed from byte-identical input —
sharing the strip guarantees that, where a second implementation could only
agree with it until one of them changed. That removes the last `npm pkg`
caller; STRIPPED_MANIFEST_FIELDS stays as the packed-manifest gate's statement
of intent, and its test now pins both ends so the two can't drift silently.

Pinned to 1100.0.15, not the 1100.0.19 tip: pnpm's release workflow stopped
verifying packed payloads, and 1100.0.16 onward ship only lib/index.js — no
readFile.js, no .d.ts — so they fail at import. Same regression as
pnpm/pnpm#13164 and #13179, fix open at pnpm/pnpm#13185. Every @pnpm/*
dependency of 1100.0.15 is itself exact-pinned upstream, so that one pin fixes
the whole pnpm closure; all six were checked for complete payloads. @pnpm/types
is pinned directly too, since release-pack.core.ts now imports ProjectManifest
from it rather than deriving the type structurally.

Verified: packing each publishable package leaves its package.json
byte-identical (sha unchanged, clean git status), so the reader round-trip
restores exactly what the raw-bytes copy did; packing lit-ui-router still
produces a tarball identical to the pre-refactor baseline, every packed file
included (package.json at sha256 0ae76468...), so no release is owed;
check:published-diff returns the same verdicts as before (3 packages, no
ship-affecting drift, 3 ship-inert); check:pack, release tests, typecheck,
lint and format all green.

* refactor(release): resolve dist-tags through pacote, not `npm view`

resolve-published.ts shelled out to `npm view <pkg> dist-tags.latest` and
decided "never published" by matching E404 in the child's stderr. pacote is
already this package's registry client (tarball.ts fetches published tarballs
with it), reads the same packument, and rejects with npm's own error code — so
the unpublished case is a code comparison rather than a string search, and one
subprocess per package goes away.

The failure semantics matter here and are unchanged: only E404 resolves to
null. Network, 5xx and auth errors still throw, because a swallowed one would
record the package as unpublished and silently suppress its drift check.

Verified: resolves the same three dist-tags as the `npm view` implementation
([email protected], [email protected],
[email protected]), and check:published-diff still
passes with the same verdicts.

* refactor(release): make the strip and its gate share one field list

STRIPPED_MANIFEST_FIELDS lived in check-pack.core.ts while strippedManifest
named the same two fields in a destructure, so the guard and the thing it
guards were two independent statements of the same list. The test standing
between them only asserted that a constant equalled its own literal — it
caught edits to that line, not drift between the two.

The list moves next to the strip in release-pack.core.ts, the strip iterates
it, and the packed-manifest gate imports it. One list with two readers: drift
is now unrepresentable rather than tested for, so the change-detector test is
deleted rather than relocated. strippedManifest's behavioural tests (drops
exactly these fields, preserves key order, no-op when absent, does not mutate
its input) still cover the semantics, and now exercise the copy-and-delete
implementation.

Verified: lit-ui-router packs to a tarball identical to the pre-refactor
baseline and its package.json restores byte-exact; check:pack and
check:published-diff both pass unchanged.

* docs(release): trim the pack-refactor comments to what the code needs

The comments added across this PR were carrying rationale that belongs in
the history instead of the source. Moved here, removed there:

- release-pack.core.ts named `@pnpm/read-project-manifest` in its header.
  Wrong package — we read through `@pnpm/workspace.project-manifest-reader`
  (the 1100 workspace line); the old standalone reader is not a dependency.

- `strippedManifest` takes and returns a parsed manifest rather than JSON
  text so the caller can write it back through pnpm's project-manifest
  writer, which reproduces the file's own indentation instead of imposing
  the function's. It copies rather than mutates because release-pack holds
  the same object across the pack and restores from it. Both properties are
  covered by unit tests; the signature and "a copy of" say the rest.

- release-pack.ts's try/finally replaces the workflow's
  `git checkout -- package.json`, byte-equivalent on CI's clean checkout and
  additionally correct when the pack itself fails.

- resolve-published.ts reads the registry through pacote rather than
  shelling out to `npm view`: one less subprocess, and an unpublished
  package arrives as an E404 code instead of a string to match in stderr.

- `npm pkg delete` no longer exists anywhere in the release tooling, so the
  three comments still explaining the strip in its terms were describing a
  command the reader cannot find.

No behaviour change: 23 tasks green, 142 release tests pass.

* refactor(release): constrain STRIPPED_MANIFEST_FIELDS to ProjectManifest keys

`as const satisfies readonly (keyof ProjectManifest)[]` — the list is what
both the strip and the packed-manifest gate iterate, so a typo silently
stripped nothing and silently guarded nothing. Now it fails at the
declaration: TS2820, with the "did you mean 'scripts'?" suggestion.

`satisfies` rather than an annotation so the inferred type stays the literal
tuple `readonly ['devDependencies', 'scripts']` — check-pack.core.ts indexes
PackageManifest with it, which needs the literals, not `keyof`.

Considered and rejected: narrowing further to only the *optional* keys, to
confirm each field is actually strippable. Vacuous here — every field on
ProjectManifest (and its BaseManifest parent) is declared optional, `name?`
and `version?` included, so `Exclude<keyof T, OptionalKeys<T>>` is `never`
and the refinement admits exactly the same set as `keyof`. The `delete` in
strippedManifest would enforce optionality independently anyway.

* docs(release): drop the bash-glob backstory from pickTarball
simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Aug 1, 2026
)

pnpm peers check reported @pnpm/logger unmet on every install: installed
1001.0.1, wanted ^1100.0.0 by @pnpm/core-loggers, @pnpm/cli.utils,
@pnpm/pkg-manifest.utils, @pnpm/config.package-is-installable and both
workspace readers.

No package depends on the logger directly — all six declare it as a peer,
so it was auto-installed. The stale resolution dates to #440: before it the
SDKs peered on ^1001.0.1 and 1001.0.1 satisfied that; #440 moved them to
the 1100 line with peer ^1100.0.0, but the already-locked auto-peer never
re-resolved. Declaring it explicitly in the two packages that consume the
SDKs pins it, the same way catalogued @types/node keeps pnpm from
auto-peering something unintended.

Pinned exact at 1100.0.0, matching the other @pnpm/* SDK entries. Its
tarball ships the complete lib/ (not the truncated shape of the
pnpm/pnpm#13185 broken publishes) and declares the same exports and
dependencies as 1001.0.1, adding only engines >=22.13, which this repo
clears.

Nothing was observably broken: both readProjectManifest and findPackages
worked before and after. This clears the warning and removes the latent
mismatch.
simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Aug 8, 2026
…t, rolldown, pnpm SDK) (#519)

Ship-inert dev-tooling slice carved out of Dependabot #513.

- @types/lodash ^4.17.24 -> ^4.17.25
- eslint-plugin-turbo ^2.10.7 -> ^2.10.8
- turbo ^2.10.7 -> ^2.10.8 (moves with eslint-plugin-turbo, which peers on it)
- playwright ^1.62.0 -> ^1.62.1
- release-it ^21.0.0 -> ^21.0.1
- rolldown ^1.2.0 -> ^1.2.2
- start-server-and-test ^3.0.11 -> ^3.0.12
- vue-tsc ^3.3.8 -> ^3.3.9
- @pnpm/types 1101.6.0 -> 1101.8.0
- @pnpm/workspace.project-manifest-reader 1100.0.20 -> 1100.0.22
- @pnpm/workspace.projects-reader 1101.0.19 -> 1101.0.21
- @pnpm/workspace.workspace-manifest-reader 1100.1.2 -> 1100.1.4

The pnpm SDK quartet stays exact-pinned by design. All four tarballs were
checked against pnpm/pnpm#13185 (truncated publishes): file lists are
byte-for-byte identical to the currently pinned versions and the closure
imports cleanly in node.

`pnpm peers check` reports no peer dependency issues.
simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Aug 12, 2026
@pnpm/types 1101.8.0 -> 1101.9.0,
@pnpm/workspace.project-manifest-reader 1100.0.22 -> 1100.0.23,
@pnpm/workspace.projects-reader 1101.0.21 -> 1101.0.22,
@pnpm/workspace.workspace-manifest-reader 1100.1.4 -> 1100.1.5.

All four candidate tarballs were downloaded and listed before adopting:
each ships its full lib/ tree with .d.ts, not the index-only truncation
of pnpm/pnpm#13185. `pnpm peers check` re-run after the bump — auto-peers
do not re-resolve on their own when an SDK line moves.
simshanith added a commit to simshanith/lit-ui-router that referenced this pull request Aug 12, 2026
@pnpm/types 1101.8.0 -> 1101.9.0,
@pnpm/workspace.project-manifest-reader 1100.0.22 -> 1100.0.23,
@pnpm/workspace.projects-reader 1101.0.21 -> 1101.0.22,
@pnpm/workspace.workspace-manifest-reader 1100.1.4 -> 1100.1.5.

All four candidate tarballs were downloaded and listed before adopting:
each ships its full lib/ tree with .d.ts, not the index-only truncation
of pnpm/pnpm#13185. `pnpm peers check` re-run after the bump — auto-peers
do not re-resolve on their own when an SDK line moves.
@qodo-code-review qodo-code-review Bot mentioned this pull request Aug 29, 2026
5 tasks done
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@pnpm/lockfile.fs package broken due to missing files as of 1100.1.12

2 participants