Skip to content

[rush] Up-to-date install still regenerates and rewrites every project's shrinkwrap-deps.json (~17 s per rush install/start)聽#6129

Open

Description

馃 Filed by GitHub Copilot acting for Naman Kanakiya (@namankanakiya) (light review only).

Version: @microsoft/rush / rush-lib 5.181.0, pnpm workspaces, Linux.

Summary: after every install, including one that reports "Installation is already up-to-date", WorkspaceInstallManager.postInstallAsync regenerates and rewrites every project's .rush/temp/shrinkwrap-deps.json. The same path runs from rush start's alwaysInstall check (doBasicInstallAsync). In a large monorepo this costs ~17 s per command for no change.

Repro (large repo, ~1,800 projects):

  1. rush install (completes).
  2. rush install again: Rush reports the install is already up-to-date.
  3. Observe that every <project>/.rush/temp/shrinkwrap-deps.json was rewritten (mtime updated), and the command took ~21 s.

Measured (same machine, up-to-date install, n=3 medians):

Variant Time Files rewritten
Published 5.181.0 21.2 s 1835
JsonFile.saveAsync(..., { onlyIfChanged: true }) 15.2 s 0
Skip the shrinkwrap-deps regeneration when the install itself was skipped 3.9 s 0

A CPU profile attributes ~10.8 s of CPU to updateProjectShrinkwrapAsync plus ~10 s of I/O wait.

Expected: an up-to-date install (and rush start's alwaysInstall check when nothing changed) does not regenerate or rewrite unchanged shrinkwrap-deps.json files.

Suggested fix (either or both):

  • Skip the per-project shrinkwrap-deps regeneration in postInstallAsync when the install was skipped as up-to-date.
  • Save with onlyIfChanged: true, so unchanged files are not rewritten (which also avoids invalidating downstream watchers and output timestamps).

Plugins cannot opt out of postInstallAsync, so there is no workaround short of patching rush-lib. Happy to test a candidate fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions