fix(config/reader): only sync registries.default to registry when workspace contributes it#11754
Conversation
…kspace contributes it The sync introduced in #11744 unconditionally overwrote the unnormalized registry value parsed from .npmrc with the normalized registries.default, causing a trailing slash to appear in config.registry when the user only configured a registry in .npmrc. Restrict the sync to cases where pnpm-workspace.yaml actually contributes a default registry different from what .npmrc provided.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (1)📚 Learning: 2026-05-14T09:04:00.133ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughThis PR tightens the conditions for syncing the workspace registry default to the top-level config. When ChangesRegistry Default Sync Conditions
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes a regression from #11744 where pnpm-workspace.yaml→config.registry sync also overwrote the unnormalized registry value from .npmrc with a normalized (trailing-slash) form, even when the workspace manifest didn't contribute a default. The sync now only fires when the post-merge registries.default differs from the npmrc-derived default.
Changes:
- Tighten the condition for syncing
registries.default→pnpmConfig.registryto require a workspace-contributed difference. - Add a changeset describing the bug fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| config/reader/src/index.ts | Adds pnpmConfig.registries.default !== registriesFromNpmrc.default guard to the registry sync. |
| .changeset/config-reader-registry-sync-npmrc.md | Patch changeset for @pnpm/config.reader and pnpm. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
registries.default→pnpmConfig.registrysync introduced in fix: synchronize default registry from pnpm-workspace.yaml for login/logout commands #11744 to cases wherepnpm-workspace.yamlactually contributes a default different from what.npmrcprovided.registryvalue parsed straight from.npmrcwith the normalized form (with a trailing slash), causingconfig.registryto gain an unexpected trailing slash whenever a user setregistry = …in.npmrc.Repro
The test
config/reader/test/index.ts: "getConfig() returns the userconfig even when overridden locally"started failing onmain:The user has
registry = https://project-local.example.testin.npmrc, nopnpm-workspace.yaml, and the new sync fired anyway becauseregistrywasn't on the CLI.Test plan
config.registrystays unnormalized when only.npmrcprovides it (existing test re-passes).pnpm-workspace.yamlregistries.defaultstill flows intoconfig.registry(covered by"pnpm-workspace.yaml registries.default is reflected in config.registry (#10099)").--registrystill wins over both (covered by"CLI --registry overrides pnpm-workspace.yaml registries.default (#10099)").Written by an agent (Claude Code, claude-opus-4-7).
Summary by CodeRabbit
.npmrcwithout explicit workspace manifest defaults.