Skip to content

fix(lockfile): respect lockfile-include-tarball-url=false for non-standard URLs#10621

Merged
zkochan merged 2 commits intopnpm:mainfrom
veeceey:fix/issue-6667-lockfile-include-tarball-url
Feb 25, 2026
Merged

fix(lockfile): respect lockfile-include-tarball-url=false for non-standard URLs#10621
zkochan merged 2 commits intopnpm:mainfrom
veeceey:fix/issue-6667-lockfile-include-tarball-url

Conversation

@veeceey
Copy link
Copy Markdown
Contributor

@veeceey veeceey commented Feb 15, 2026

Fixes #6667

Problem

When lockfile-include-tarball-url is set to false (the default), packages hosted under non-standard tarball URLs still have their tarball field written to pnpm-lock.yaml. This causes flaky behavior -- the lockfile can differ between environments depending on registry responses, URL encoding, and redirect behavior.

This has been a long-standing pain point especially for teams using private registries or npm Enterprise, where the inconsistent tarball URLs cause merge conflicts, CI failures, and general confusion.

Fix

The lockfileIncludeTarballUrl option was effectively binary (true = always include, everything else = heuristic), so setting it to false had no way to override the "non-standard URL" heuristic.

I made it tri-state internally:

  • true: always include tarball URLs (unchanged)
  • false: never include tarball URLs (this is the fix)
  • undefined (not explicitly set): use the existing heuristic that includes tarball URLs only for packages with non-standard registry URLs (unchanged default behavior)

This is done by:

  1. Removing the false default for lockfileIncludeTarballUrl in extendInstallOptions, so when the user hasn't set it, it's undefined
  2. Adding an explicit lockfileIncludeTarballUrl === false check in toLockfileResolution that skips the non-standard URL heuristic

Test plan

  • Added test: tarball URL excluded for standard packages when option is false
  • Added test: tarball URL excluded for non-standard packages when option is false
  • Verified existing tests still pass (heuristic behavior preserved when option is undefined)
  • Ran full lockfile test suite: 71 passed, 0 failed

…ndard URLs

When lockfile-include-tarball-url is explicitly set to false, tarball URLs
are now always excluded from the lockfile. Previously, packages hosted under
non-standard tarball URLs would still have their tarball field written to the
lockfile even when the setting was false, causing flaky and inconsistent
behavior across environments.

The fix makes the option tri-state internally:
- true: always include tarball URLs
- false: never include tarball URLs
- undefined (not set): use the existing heuristic that includes tarball URLs
  only for packages with non-standard registry URLs

Fixes pnpm#6667
@veeceey veeceey requested a review from zkochan as a code owner February 15, 2026 10:16
@welcome
Copy link
Copy Markdown

welcome bot commented Feb 15, 2026

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a long-standing issue where the lockfile-include-tarball-url=false setting was not fully respected. When set to false, packages hosted under non-standard tarball URLs (e.g., npm Enterprise installations) would still have their tarball field written to pnpm-lock.yaml, causing flaky behavior, merge conflicts, and CI failures.

Changes:

  • Made lockfileIncludeTarballUrl tri-state internally: true (always include), false (never include), and undefined (use heuristic based on URL standard-ness)
  • Removed the default false value so the option is undefined when not explicitly set, preserving the existing heuristic behavior as the default
  • Added explicit check for lockfileIncludeTarballUrl === false that bypasses the non-standard URL heuristic

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pkg-manager/resolve-dependencies/src/updateLockfile.ts Added explicit check to exclude tarball URLs when option is false, before the non-standard URL heuristic
pkg-manager/core/src/install/extendInstallOptions.ts Changed lockfileIncludeTarballUrl type to optional and removed default value
pkg-manager/core/test/lockfile.ts Added tests verifying tarball URLs are excluded for both standard and non-standard packages when option is false
.changeset/fix-lockfile-include-tarball-url.md Added changeset documenting the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zkochan zkochan merged commit e73da5e into pnpm:main Feb 25, 2026
13 of 14 checks passed
@welcome
Copy link
Copy Markdown

welcome bot commented Feb 25, 2026

Congrats on merging your first pull request! 🎉🎉🎉

zkochan pushed a commit that referenced this pull request Mar 7, 2026
…ndard URLs (#10621)

When lockfile-include-tarball-url is explicitly set to false, tarball URLs
are now always excluded from the lockfile. Previously, packages hosted under
non-standard tarball URLs would still have their tarball field written to the
lockfile even when the setting was false, causing flaky and inconsistent
behavior across environments.

The fix makes the option tri-state internally:
- true: always include tarball URLs
- false: never include tarball URLs
- undefined (not set): use the existing heuristic that includes tarball URLs
  only for packages with non-standard registry URLs

close #6667
zkochan pushed a commit that referenced this pull request Mar 7, 2026
…ndard URLs (#10621)

When lockfile-include-tarball-url is explicitly set to false, tarball URLs
are now always excluded from the lockfile. Previously, packages hosted under
non-standard tarball URLs would still have their tarball field written to the
lockfile even when the setting was false, causing flaky and inconsistent
behavior across environments.

The fix makes the option tri-state internally:
- true: always include tarball URLs
- false: never include tarball URLs
- undefined (not set): use the existing heuristic that includes tarball URLs
  only for packages with non-standard registry URLs

close #6667
zkochan added a commit that referenced this pull request Mar 9, 2026
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.

"lockfile-include-tarball-url" behaviour is flaky

3 participants