Skip to content

Preserve catalog: specifiers for pnpm isolates - #200

Merged
0x80 merged 2 commits into
mainfrom
thijs/0529-fix-catalog
May 29, 2026
Merged

Preserve catalog: specifiers for pnpm isolates#200
0x80 merged 2 commits into
mainfrom
thijs/0529-fix-catalog

Conversation

@0x80

@0x80 0x80 commented May 29, 2026

Copy link
Copy Markdown
Owner

When isolating a pnpm workspace package that uses catalog: dependency specifiers, the adapted manifest had its catalog: refs resolved to concrete versions while the generated lockfile importers kept catalog:. This desync made pnpm install --frozen-lockfile fail with ERR_PNPM_OUTDATED_LOCKFILE (specifiers in the lockfile don't match specifiers in package.json), breaking deploys such as Firebase where frozen installs are the default.

For pnpm (non-forceNpm) the isolated output is itself a workspace and keeps pnpm-workspace.yaml with its catalog definitions, so catalog: specifiers can be preserved verbatim, exactly like workspace:* already is. Catalog resolution is therefore skipped for pnpm and only applied for bun, npm, yarn, and forceNpm, where the catalog is not available in the isolated output.

Pruning the lockfile also dropped the catalogs snapshot (the same way it drops overrides), so the manifest and lockfile were inconsistent even when specifiers matched. The snapshot is now restored after pruning, narrowed to the entries referenced by the retained importers to mirror what pnpm itself writes, so catalog entries belonging to unrelated workspace packages do not leak into the output.

Closes #198

Scope: packages (isolate-package)
Visibility: user-facing

0x80 added 2 commits May 29, 2026 10:40
When isolating a pnpm workspace package that uses "catalog:" dependency
specifiers, the adapted manifest had its "catalog:" refs resolved to
concrete versions while the generated lockfile importers kept "catalog:".
This desync made `pnpm install --frozen-lockfile` fail with
ERR_PNPM_OUTDATED_LOCKFILE, breaking deploys (e.g. Firebase).

For pnpm (non-forceNpm) the isolated output is itself a workspace and
keeps pnpm-workspace.yaml with its catalog definitions, so "catalog:"
should be preserved verbatim, exactly like "workspace:*". Catalog
resolution is now skipped for pnpm and only applied for bun, npm, yarn,
and forceNpm, where the catalog is not available in the output.

Pruning also drops the lockfile "catalogs" snapshot, so it is restored
after pruning, narrowed to the entries referenced by the retained
importers to mirror what pnpm itself writes.
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b0f36166-f9bc-4d53-bdeb-ff5edb19fd75

📥 Commits

Reviewing files that changed from the base of the PR and between 8049880 and 83fdf28.

📒 Files selected for processing (5)
  • src/lib/lockfile/helpers/generate-pnpm-lockfile.test.ts
  • src/lib/lockfile/helpers/generate-pnpm-lockfile.ts
  • src/lib/manifest/adapt-target-package-manifest.ts
  • src/lib/manifest/helpers/adapt-internal-package-manifests.test.ts
  • src/lib/manifest/helpers/adapt-internal-package-manifests.ts

Walkthrough

This PR adds pnpm catalog specifier preservation for isolated packages that remain pnpm workspaces. It restores catalog snapshot metadata to pnpm v9 lockfiles after pruning and conditionally resolves catalog specifiers in package manifests. For pnpm workspace outputs (pnpm without forceNpm), catalog specifiers remain unchanged; for other package managers or forceNpm: true, they are resolved to concrete versions. The changes include type definitions, conditional resolution logic, and comprehensive test coverage for both presence and absence of catalogs.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: preserving catalog: specifiers for pnpm isolates, which is the core objective of this PR.
Description check ✅ Passed The description comprehensively explains the problem (catalog: specifier mismatch causing frozen-lockfile failures), the solution (conditional preservation for pnpm), and technical details about lockfile snapshot restoration.
Linked Issues check ✅ Passed The PR fully addresses issue #198 by implementing conditional catalog resolution: preserving catalog: specifiers for pnpm (non-forceNpm) while resolving them for other package managers.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the catalog: specifier preservation objective: manifest adaptation logic, lockfile helper functions, and corresponding test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch thijs/0529-fix-catalog

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

@0x80
0x80 merged commit d429750 into main May 29, 2026
5 checks passed
@0x80
0x80 deleted the thijs/0529-fix-catalog branch May 29, 2026 09:56
@ChromeQ

ChromeQ commented May 29, 2026

Copy link
Copy Markdown
Contributor

Installed latest version, confirmed it is working as intended. Thanks again,,

Image

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.

Stop catalog resolution for pnpm (non forceNpm option)

2 participants