Repository navigation
chore(pnpm): gate pnpm-lock on package-lock and declare hoisted imports #11625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
efdd802
chore(pnpm): gate pnpm-lock on package-lock and declare hoisted imports
yiliang114 0c67d48
chore(pnpm): regenerate vscode NOTICES and pin the new smoke path
yiliang114 1e43a5b
fix(pnpm): close lockfile-gate gaps found in review
qwen-code-ci-bot f89eee0
Merge remote-tracking branch 'origin/main' into HEAD
yiliang114 f6fe67c
docs(verification): correct pnpm stage-2 measurement recipe
yiliang114 d7fe18d
docs(verification): fix stage-2 recipe's dispatch and macOS fs probe
yiliang114 7637d8c
test(lockfile): cover stale-gap and alias arms of check-lockfile
yiliang114 ea184e4
Merge branch 'main' into chore/pnpm-lock-gates
qwen-code-dev-bot c507a6f
fix(lockfile): close the empty-env seam and name the overrides remedy
yiliang114 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # pnpm Stage 2 go/no-go evidence | ||
|
|
||
| The post-Stage 1 review on | ||
| [#10444](https://github.com/QwenLM/qwen-code/issues/10444#issuecomment-5630188013) | ||
| recommends holding Stage 2 (pnpm for development and CI) until two | ||
| measurements exist. Neither could run on the machine that wrote this brief, | ||
| because it does not run builds or test suites. Every number below that is not | ||
| marked as measured comes from #10444 and has not been reproduced here. | ||
|
|
||
| Report results as a comment on #10444, then add a `results.md` next to this | ||
| file. | ||
|
|
||
| ## Already measured | ||
|
|
||
| On `main` at `642d36e`, Linux, Node 22.23.2, pnpm 11.24.0: | ||
|
|
||
| - Two consecutive `corepack pnpm import` runs produced byte-identical | ||
| `pnpm-lock.yaml` output, about 51 s each with a cold metadata cache. | ||
| `corepack pnpm install --frozen-lockfile --lockfile-only` accepts the | ||
| result. | ||
| - After the import, every `name@version` in `pnpm-lock.yaml` is also locked | ||
| in `package-lock.json`, except `mime-db@1.52.0`. That exception is a gap in | ||
| the npm lockfile; `scripts/check-lockfile.js` explains it. | ||
|
|
||
| ## 1. Per-worktree disk on the hosts that run worktrees | ||
|
|
||
| **Premise under test:** pnpm's 93% disk saving (1,472 → 99 MiB per worktree) | ||
| depends on a copy-on-write filesystem, because `packageImportMethod` is | ||
| `clone-or-copy`. On ext4 the saving should shrink to roughly 1.47 → 1.2 GiB. | ||
| A reflink clone of the primary checkout's `node_modules` should match pnpm on | ||
| CoW filesystems without pnpm. | ||
|
|
||
| Run this on every host class that creates worktrees: the ECS runner hosts and | ||
| developer Macs. | ||
|
|
||
| 1. Record the filesystem. On Linux, run `df -T <repo>`. On macOS, run | ||
| `diskutil info / | grep Personality`. | ||
|
yiliang114 marked this conversation as resolved.
Resolved
|
||
|
|
||
| 2. Prepare three fresh worktrees of the same commit from the primary | ||
| checkout. The primary checkout must already have a completed `npm ci`. | ||
| Warm the pnpm store once, in a throwaway worktree, before measuring. | ||
|
|
||
| 3. For each method below, record the change in the `df` used column and the | ||
| wall time. Use `df`, not `du`: `du` counts cloned files at full size. | ||
|
yiliang114 marked this conversation as resolved.
Resolved
|
||
|
|
||
| | Method | Command in the new worktree | | ||
| | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | npm | `QWEN_SKIP_PREPARE=1 npm ci --prefer-offline` | | ||
| | pnpm | `node scripts/setup-worktree.js` | | ||
| | reflink copy | copy the primary's `node_modules` and each `packages/*/node_modules`, using `cp -c -R` on APFS or `cp -R --reflink=always` on btrfs/XFS reflink | | ||
|
|
||
| 4. For the reflink copy, confirm the workspace links point into the new | ||
| worktree: | ||
| - `readlink node_modules/@qwen-code/qwen-code-core` prints | ||
| `../../packages/core`. | ||
| - `node -p "require.resolve('@qwen-code/qwen-code-core/package.json')"`, | ||
| run in the worktree, prints a path inside that worktree. | ||
|
|
||
| 5. Record the peak number of concurrent worktrees per host over a week, for | ||
| example by sampling `git worktree list | wc -l` daily. | ||
|
|
||
| **Report:** a table of host, filesystem, method, `df` delta and wall time; | ||
| the peak concurrent worktree count; and free disk per host. | ||
|
|
||
| **Decision this feeds:** disk alone justifies Stage 2 only if the peak count | ||
| times the npm delta exceeds the host's disk budget, and the reflink copy is | ||
| not an option on that filesystem. | ||
|
|
||
| ## 2. Hoisted parity: the CI matrix on a pnpm-installed tree | ||
|
|
||
| **Premise under test:** with `nodeLinker: hoisted`, the existing npm scripts | ||
| run unchanged on a pnpm-installed tree. Stage 2 would then need almost no | ||
| script changes. | ||
|
|
||
| 1. On a scratch branch, add these steps to the `ubuntu-latest` job of | ||
| `.github/workflows/pnpm-worktree-smoke.yml`, after the install step: | ||
| `npm run build`, `npm run typecheck`, `npm run lint:ci`, `npm run test:ci`, | ||
| `npm run bundle`, and `npm run check:serve-fast-path-bundle`. | ||
| 2. Run the job with | ||
| `gh workflow run pnpm-worktree-smoke.yml --ref <branch>`. | ||
| 3. Repeat the run with the install step replaced by `npm ci`. This is the | ||
| npm baseline on the same runner class. | ||
|
|
||
| **Report:** pass or fail and duration for each step under both installers, | ||
| the first failure's log for any step that fails only under pnpm, and the | ||
| install step duration for each installer. | ||
|
|
||
| **Decision this feeds:** the real Stage 2 change surface, and the CI time | ||
| benefit. Do not extrapolate that benefit from the worktree benchmark. | ||
|
|
||
| ## Claims these results may contradict | ||
|
|
||
| - The ext4 per-worktree estimate of about 1.2 GiB, which comes from the | ||
| AGENTS.md note. | ||
| - "npm scripts run unchanged on a hoisted pnpm tree." | ||
| - The recommendation to freeze at Stage 1. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.