bug: pnpm cache hits provide little install speedup because lockfile verification is not cached
Maintainer thường phản hồi trong vòng 7 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- github-actions, node.js, typescript
Hướng nghiên cứu
Read the pnpm cache handling in actions/setup-node and trace how it resolves, restores, and saves the package store cache. Check the existing tests for pnpm caching, then identify how a separate key can use the OS, architecture, and lockfile hash while keeping failures non-fatal. Done when the verification log is independently restored and saved, including on a store cache hit, with npm and Yarn behavior unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
With pnpm 11+, actions/setup-node's cache: pnpm can provide little or no installation speedup, even when the cache is successfully restored.
The reason is that setup-node caches only pnpm's package store, while pnpm stores lockfile verification results separately in <cacheDir>/lockfile-verified.jsonl.
These results allow pnpm to avoid repeating registry-backed verification of lockfile entries, including integrity checks and applicable supply-chain policies such as minimumReleaseAge and trustPolicy.
Because the verification log is not included in the cache, every CI job repeats the verification, even when the package store is fully cached and the lockfile is unchanged.
In workloads where verification dominates installation time, the store cache becomes largely ineffective.
Action version
actions/[email protected]
Platform
- Ubuntu
- macOS
- Windows
Runner type
- Hosted
- Self-hosted
Tools version
- pnpm: 12.16.1
- Node.js: Not recorded
- Lockfile: Approximately 2,000 entries (868 KB)
- Configuration:
minimumReleaseAge: 1440trustPolicy: no-downgrade
Repro steps
- Configure
actions/setup-nodewithcache: pnpmin a repository using pnpm 12 and the supply-chain policies above. - Run
pnpm install --frozen-lockfile. - Run the workflow again without changing the lockfile.
- Confirm that the package store cache is restored successfully.
- Compare installation times with and without the cache, and with the lockfile verification log restored separately.
Measurements
| Scenario | Result |
|---|---|
| GitHub Actions, warm store (27 install jobs) | 13–22s/job, 392s total |
| Cold install without any cache | 13–14s |
| Controlled test: warm store, verification log missing | 26s |
| Controlled test: warm store, verification log restored | 20s |
| Parallel CI fleet (25 jobs), before → after | Median 32s → 18s; aggregate 818s → 455s |
Despite a successful store cache hit, installation time was comparable to a completely uncached installation.
Restoring the verification log reduced dependency setup time by approximately 6 seconds per job in the controlled experiment.
The fleet-level improvement was larger, although it also included other configuration changes.
Similar results were reported in pnpm/setup#30: lockfile verification accounted for 16.6 of 17.6 seconds on Linux and 40.1 of 42.4 seconds on Windows.
Expected behavior
When the lockfile is unchanged and previously computed verification results remain valid, cache: pnpm should reuse those results along with the package store.
A successful cache hit should avoid redundant verification work, allowing subsequent installations to benefit from caching.
Actual behavior
setup-node restores only the package store.
The lockfile verification log is never restored, so pnpm repeats registry-backed verification on every job.
As a result, cache: pnpm provides almost no performance benefit in workloads dominated by lockfile verification, despite reporting successful cache hits.
Suggested solution
Cache <cacheDir>/lockfile-verified.jsonl independently of the package store.
- Resolve the cache directory using
pnpm cache path, available in pnpm 12. If unavailable, retain the existing behavior. - Use a separate cache key, incorporating the OS, architecture, and lockfile hash, without prefix-based fallback.
- Restore the verification log independently of whether the package store cache hits or misses.
- Save the verification log even when the package store cache hits. The current implementation skips saving on an exact store cache hit. Simply adding this file to the existing store cache paths would not populate verification logs for existing cache entries.
- Keep failures non-fatal. A missing or unusable verification cache should cause pnpm to perform its normal verification.
- Leave npm and Yarn unchanged.
Only the verification log should be cached, rather than the entire pnpm cache directory.
Security considerations
Restoring the verification log does not bypass pnpm's supply-chain protections.
pnpm itself determines whether previously recorded verification results can be trusted for the current lockfile and policy configuration. Unusable results trigger normal verification.
This approach is already implemented by pnpm/setup.
References
- Ngôn ngữ chính
- TypeScript
- Star
- 5k
- Fork
- 1.7k
- Merge trung bình
- 5 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của actions/setup-node
-
`mirror-token` is sent to GitHub instead of `token` when `mirror` is setCó thể đã có người làm @v-gowridurgad đã nhận 10 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
actions/setup-node#1662 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 7 ngày
-
feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
actions/setup-node#1531 · 1 bình luận · 4 reaction ·
Maintainer thường phản hồi trong vòng 7 ngày
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
actions/setup-node#1670 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Provide `allow-prereleases` (or similar) option for Node.js 27 AlphaCó thể đã có người làm @v-priyagupta108 đã nhận 7 ngày trước. Đang mởfeature request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
actions/setup-node#1657 · 5 bình luận · 4 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Improved error message when a required os lib is missingCó thể đã có người làm @OKAN-SOFTWARE đã nhận 20 ngày trước. Đang mởfeature request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
actions/setup-node#1651 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 7 ngày
Tất cả issue của actions/setup-node
Issue tương tự
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysCó thể đã có người làm @pcbeingused333 đã nhận hôm nay. Đang mởBug db: d1-sqlite Payload OSS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
payloadcms/payload#19766 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
device-management-toolkit/sample-web-ui#3711 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
elastic/kibana#306401 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
agentes-chat/agentes-chat#927 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tabCó thể đã có người làm @seenimohamed đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ardia-browser/ardia#2769 ·
Maintainer thường phản hồi trong vòng 1 ngày