Repository navigation
fix: allow global named registries config - #12862
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds global ChangesGlobal registries config support
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant getConfig
participant npmrc
participant global config.yaml
participant workspace manifest
participant pnpmConfig
getConfig->>npmrc: read registriesFromNpmrc
getConfig->>global config.yaml: apply global YAML settings
global config.yaml-->>getConfig: globalYamlRegistries
getConfig->>workspace manifest: read manifest registries
workspace manifest-->>getConfig: workspaceManifestRegistries
getConfig->>pnpmConfig: merge registries and apply auth/CLI-scoped entries
Assessment against linked issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 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.
🧹 Nitpick comments (1)
pnpm11/config/reader/test/index.ts (1)
3583-3615: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding a precedence test for workspace manifest vs global YAML registries.
The current test verifies global YAML registries override npmrc defaults, but doesn't cover the case where both global
config.yamland a workspacepnpm-workspace.yamldefineregistries— the workspace manifest should win. Adding such a test would fully satisfy the REVIEW_GUIDE.md expectation of asserting "correct precedence."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm11/config/reader/test/index.ts` around lines 3583 - 3615, Add a precedence test in the existing config reader test suite to cover the case where both global config.yaml and pnpm-workspace.yaml define registries, and assert that the workspace manifest values win over the global YAML values. Reuse the existing getConfig setup and the registries/namedRegistries assertions so the new test clearly contrasts global config versus workspace manifest precedence.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pnpm11/config/reader/test/index.ts`:
- Around line 3583-3615: Add a precedence test in the existing config reader
test suite to cover the case where both global config.yaml and
pnpm-workspace.yaml define registries, and assert that the workspace manifest
values win over the global YAML values. Reuse the existing getConfig setup and
the registries/namedRegistries assertions so the new test clearly contrasts
global config versus workspace manifest precedence.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f323b70d-61a1-46e2-9b20-d16d092cf5c6
📒 Files selected for processing (6)
.changeset/global-registries-config.mdpnpm11/config/commands/src/configSet.tspnpm11/config/commands/test/configSet.test.tspnpm11/config/reader/src/configFileKey.tspnpm11/config/reader/src/index.tspnpm11/config/reader/test/index.ts
c839e54 to
e92adc7
Compare
Cover the precedence case where both the global config.yaml and a pnpm-workspace.yaml define registries, asserting the workspace manifest value wins while a scope present only in the global YAML still resolves. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
PR Code Suggestions ✨Latest suggestions up to 24b1ddb Warning
Previous suggestionsSuggestions up to commit 2998fe7
Suggestions up to commit c08c15b
Suggestions
|
|||||||||||||||||||||||||||||||||||||||
Code Review by Qodo
Context used✅ Tickets:
🎫 Can't define `namedRegistries` globally✅ Compliance rules (platform):
51 rules 1.
|
PR Code Suggestions ✨Warning
|
|||||||||
Mirror the TypeScript fix so `pnpm config set --global registries` and `--global named-registries` are accepted instead of rejected with an unsupported-key error. pacquet already reads these structured settings from the global config.yaml via its typed workspace-manifest struct, but the config-file key allowlist omitted them: is_config_file_key filtered them out (so validate_yaml_config_key rejected them) and validate_workspace_key could not camelCase the hyphenated named-registries key. Add registries/named-registries to the config-file key allowlist and let validate_workspace_key accept config-file keys, matching structuredConfigFileKeys and validateWorkspaceKey in the TypeScript stack. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…th tokens Lock in the security-relevant merge ordering added by this change: global config.yaml registries sit below `_auth` routes, so a user's global registry alias cannot rebind an `_auth`-bound token's host. A repo that overrides such a scope receives no credential because tokens stay host-bound. Covers the new global-config path in both stacks, mirroring the existing repo-controlled `pnpm-workspace.yaml` redirect tests. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit c08c15b |
|
Code review by qodo was updated up to the latest commit 2998fe7 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12862 +/- ##
=======================================
Coverage 85.32% 85.32%
=======================================
Files 451 451
Lines 70701 70705 +4
=======================================
+ Hits 60323 60329 +6
+ Misses 10378 10376 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The global-config redirect test set process.env.XDG_CONFIG_HOME without restoring it, which could make later tests in the same Jest worker read an unintended global config directory. getConfig already resolves the config dir from its env option, so pass XDG_CONFIG_HOME there instead of mutating the shared process environment. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 24b1ddb |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
Summary
registriesandnamedRegistriesin the globalconfig.yamlallowlist (TypeScript CLI and pacquet)._authand CLI overrides.pnpm config set --global registries/named-registriessucceed instead of erroring with an unsupported-key error, in both stacks.config set, precedence, and security regression coverage.Fixes #12858.
Validation
TypeScript CLI:
pnpm --filter @pnpm/config.commands test test/configSet.test.tspnpm --filter @pnpm/config.reader test test/index.tspnpm --filter @pnpm/config.commands lint/pnpm --filter @pnpm/config.reader lintpacquet:
cargo nextest run -p pacquet-config -p pacquet-clicargo clippy --locked -p pacquet-config -p pacquet-cli --all-targets -- --deny warningscargo fmt -p pacquet-config -p pacquet-cli -- --checkSquash Commit Body
Checklist
pacquet/(config-file key allowlist andconfig setvalidation), so both stacks stay in sync.pnpm changeset) if this PR changes any published package. Keep it short and written for pnpm users — it becomes a release note.Summary by CodeRabbit
registriesandnamedRegistriesin the globalconfig.yamlfile.registriesandnamed-registries.registriessettings from redirecting_authtoken routing unexpectedly.registries/namedRegistriesand verifying precedence and security behavior.