Skip to content

fix: sync env lockfile when devEngines.packageManager version is stale#11392

Merged
zkochan merged 4 commits into
mainfrom
fix/11387
Apr 29, 2026
Merged

fix: sync env lockfile when devEngines.packageManager version is stale#11392
zkochan merged 4 commits into
mainfrom
fix/11387

Conversation

@zkochan

@zkochan zkochan commented Apr 29, 2026

Copy link
Copy Markdown
Member

Summary

  • When devEngines.packageManager declared a pnpm version that the lockfile no longer satisfied, pnpm previously left the stale packageManagerDependencies entry in place — silently breaking the integrity record while still using the new version.
  • Add syncEnvLockfile, invoked after checkPackageManager for pnpm, which detects a stale lockfile entry and re-resolves it against the currently running pnpm version (already verified to satisfy the wanted range). No-ops when there is no env lockfile, no existing entry, the entry already satisfies, or the running pnpm doesn't satisfy.
  • Closes No validation error when devEngines.packageManager version mismatches lockfile packageManagerDependencies #11387.

Test plan

  • pnpm exec tsgo --build clean
  • pnpm run lint clean (only pre-existing warnings)
  • New unit tests in pnpm/src/syncEnvLockfile.test.ts (8 tests, 100% coverage of the new module) pass
  • pnpm/test/switchingVersions.test.ts (12 tests) pass
  • pnpm/test/packageManagerCheck.test.ts + pnpm/test/configurationalDependencies.test.ts (28 tests) pass

Update the env lockfile's `packageManagerDependencies` entry when
`devEngines.packageManager` declares a pnpm version that the lockfile
no longer satisfies. Previously the stale entry was kept even though
the running pnpm matched the declared version, silently breaking the
integrity record.

Closes #11387
@zkochan zkochan marked this pull request as ready for review April 29, 2026 12:55
@zkochan zkochan merged commit ca474f1 into main Apr 29, 2026
12 checks passed
@zkochan zkochan deleted the fix/11387 branch April 29, 2026 19:07
zkochan added a commit that referenced this pull request Apr 29, 2026
#11392)

* fix: sync env lockfile when devEngines.packageManager version is stale

Update the env lockfile's `packageManagerDependencies` entry when
`devEngines.packageManager` declares a pnpm version that the lockfile
no longer satisfies. Previously the stale entry was kept even though
the running pnpm matched the declared version, silently breaking the
integrity record.

Closes #11387

* refactor: drop redundant pm.name guard in main.ts (syncEnvLockfile already checks)

* refactor: hoist pm.onFail !== 'ignore' guard so each clause appears once

* test: assert syncEnvLockfile actually rewrites the lockfile entry on disk
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.

No validation error when devEngines.packageManager version mismatches lockfile packageManagerDependencies

1 participant