Skip to content

fix(pnpm): reuse cached builds in the engine rebuild - #10788

Merged
zkochan merged 2 commits into
teambit:masterfrom
zkochan:pnpm/rebuild-skip-side-effects-cache
Oct 11, 2026
Merged

zkochan merged 2 commits into
teambit:masterfrom
zkochan:pnpm/rebuild-skip-side-effects-cache

Conversation

@zkochan

@zkochan zkochan commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Proposed Changes

  • rebuild passes skipIfHasSideEffectsCache to nodeApi.rebuild. fusepm calls result.rebuild({ pending: true, skipIfHasSideEffectsCache: true }) after mounting each capsule, so that a package whose build the side-effects cache already holds is restored instead of built again. lynx.ts dropped the option (its comment said the engine had no such selector, which was true until @pnpm/napi 12.11.0), so every capsule ran the install scripts of packages like esbuild and ssh2 again. In a ripple sign that printed dozens of "ssh2: Running install script..." lines per capsule.
  • Measured in the ripple container (Bit 2.2.102, fusepm 6.0.3), signing community-cloud: with this change, esbuild's postinstall ran once per version and was restored from the cache in the later capsules.
  • @pnpm/napi 12.12.1 includes fix(building): let a rebuild skip a cached build that changed nothing pnpm/pnpm#16843. In a container without a build toolchain, ssh2's install script changes nothing, and the engine's rebuild did not count such an empty cache entry as built, so ssh2 ran its script in every capsule. With a local build of that fix, ssh2's script ran once and was skipped in the later capsules. pnpm-lock.yaml changes only in the napi version entries.

🤖 Generated with Claude Code

fusepm rebuilds the pending packages of every capsule with
skipIfHasSideEffectsCache set, so that a package whose build the
side-effects cache holds is restored instead of built again. lynx dropped
the option, as the engine had none until @pnpm/napi 12.11.0, and every
capsule ran the install scripts of packages like esbuild again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Forward side-effects cache option to pnpm rebuild

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Pass the caller’s cache-skip option to pnpm rebuild so cached builds are restored instead of
 repeated.
• Preserve pending-package selection while avoiding redundant install scripts across capsules.
Diagram

graph TD
  Caller["Capsule caller"] --> Lynx["Lynx rebuild"] --> Engine["pnpm engine"] --> Cache[("Side-effects cache")] -->|hit| Restore["Restore build"]
  Lockfile[("Build list")] --> Lynx
  Cache -->|miss| Scripts["Run install scripts"]
Loading
High-Level Assessment

Forwarding the existing caller option to the pnpm engine is the smallest appropriate fix; duplicating cache-selection logic in Lynx would add unnecessary complexity. The separate pnpm fix needed for empty cache entries, such as the reported ssh2 case, remains a follow-up.

Files changed (1) +6 / -4

Bug fix (1) +6 / -4
lynx.tsForward cache-skip option during rebuild +6/-4

Forward cache-skip option during rebuild

• The rebuild callback now accepts skipIfHasSideEffectsCache and passes it to nodeApi.rebuild, allowing cached builds to be restored instead of rerunning scripts. Pending-package selection remains unchanged, and the obsolete comment claiming the engine lacks this option is removed.

scopes/dependencies/pnpm/lynx.ts

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

qodo-free-for-open-source-projects Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider

Great, no issues found!

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

Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 43ac490 ⚖️ Balanced

Results up to commit f7f1bd4


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

Great, no issues found!

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

Grey Divider

Qodo Logo

12.12.1 includes pnpm/pnpm#16843: a rebuild with skipIfHasSideEffectsCache
skips a package whose cached build changed nothing inside it, such as
ssh2 when its optional native binding cannot compile. Before, such a
package ran its install script in every fusepm capsule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zkochan zkochan changed the title fix(pnpm): pass skipIfHasSideEffectsCache to the engine rebuild fix(pnpm): reuse cached builds in the engine rebuild Oct 11, 2026
@zkochan
zkochan enabled auto-merge (squash) October 11, 2026 11:31
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 43ac490

@zkochan
zkochan merged commit eb1ac58 into teambit:master Oct 11, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants