fix(install): skip lifecycle script comparison for workspace packages

Closed
RO
7mo ago
+166-1

Summary

Fixes #26070

Workspace packages with lifecycle scripts (e.g., prepare, postinstall) were incorrectly triggering dependency re-resolution and unnecessary HTTP requests to the npm registry when running bun install after the lockfile cache expired.

Root Cause

The Diff.generate() function in src/install/lockfile/Package.zig compared lifecycle scripts for all non-root packages, including workspace packages. Since workspace packages are freshly parsed from their package.json files during diff generation, this could produce false positives even when scripts hadn't changed.

Solution

Skip lifecycle script comparison for workspace packages since:

  • Workspace packages are resolved locally from their package.json files
  • Script changes don't affect dependency resolution
  • Any actual script changes are still detected and run during script execution

Test plan

  • Added regression test test/regression/issue/26070.test.ts that verifies:
    • Test fails with system bun (reproduces bug)
    • Test passes with the fix
  • Verified existing workspace tests pass (12 pre-existing failures due to network issues, no new failures)

šŸ¤– Generated with Claude Code