Skip to content

fix(config): report kebab-case keys in the global config.yaml - #13862

Merged
zkochan merged 2 commits into
mainfrom
fix-13650
Aug 14, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-13650

Conversation

@zkochan

@zkochan zkochan commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Summary

A key written in kebab-case in the global config.yaml passes the gate whose job is to reject unsupported keys, and is then discarded by the next one without a word:

# ~/.config/pnpm/config.yaml
state-dir: /tmp/kebab-state

getConfig filters the file through isConfigFileKey(kebabCase(key)), which is kebab-based and accepts state-dir. What survives is handed to addSettingsFromWorkspaceManifestToConfig, whose loop drops every key failing isCamelCase. So the setting does nothing, warnings is empty, and the camelCase spelling of the same key in the same file works — the two spellings disagree and only one of them says so.

The kebab spellings are now collected in the same pass and reported, naming the spelling that works:

The following settings in the global config file ("/home/user/.config/pnpm/config.yaml") were ignored because they are not written in camelCase: "state-dir" (use "stateDir").

Reporting rather than accepting the kebab spelling keeps the file camelCase-only, which is what pnpm config set --global writes and what the docs describe.

This is TypeScript-only. pacquet parses config.yaml into a typed struct that does not use deny_unknown_fields, so serde drops a kebab key silently — it has no equivalent warning to extend, and none for the isConfigFileKey rejections either. I'll file that parity gap separately rather than grow this fix into it.

Closes #13650

Squash Commit Body

The global config.yaml is filtered through `isConfigFileKey(kebabCase(key))`,
which accepts `state-dir`, and the settings that survive that gate are then
picked up in camelCase only — so the key passed the check whose job is to
report unsupported keys, and was dropped by the next one without a word.

Report those keys, naming the spelling that works. The two spellings
disagreed and only one of them said so.

Closes pnpm/pnpm#13650

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

Written by an agent (Claude Code, claude-opus-5).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes

    • Global config.yaml settings written in kebab-case are now reported instead of silently ignored.
    • Warnings identify the expected camelCase equivalent for each affected setting.
    • Valid camelCase settings continue to be applied as expected.
    • Added coverage to verify this configuration behavior.
  • Documentation

    • Added release notes describing the updated global configuration handling.

The global config.yaml is filtered through `isConfigFileKey(kebabCase(key))`,
which accepts `state-dir`, and the settings that survive that gate are then
picked up in camelCase only — so the key passed the check whose job is to
report unsupported keys, and was dropped by the next one without a word.

Report those keys, naming the spelling that works. The two spellings
disagreed and only one of them said so.

Closes #13650
Copilot AI lite review requested due to automatic review settings August 12, 2026 11:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 260f0ece-d22d-416a-9c6d-b8aa0b7d9a97

📥 Commits

Reviewing files that changed from the base of the PR and between cdc9a4f and eda8533.

📒 Files selected for processing (1)
  • pnpm11/config/reader/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/config/reader/src/index.ts

📝 Walkthrough

Walkthrough

Global configuration parsing now reports recognized kebab-case keys with their camelCase equivalents. A regression test verifies that kebab-case settings are ignored, valid camelCase settings remain applied, and the warning identifies the configuration file.

Changes

Global configuration reporting

Layer / File(s) Summary
Kebab-case configuration handling
pnpm11/config/reader/src/index.ts
Global configuration processing removes recognized kebab-case keys and warns with their camelCase equivalents.
Regression coverage and release metadata
pnpm11/config/reader/test/index.ts, .changeset/quiet-pugs-invent.md
Tests verify state-dir is ignored, storeDir is applied, and the warning recommends stateDir. The changeset records patch releases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to eda85

This localized change reports ignored kebab-case global configuration keys while preserving the existing camelCase-only behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Assessment against linked issues

Objective Addressed Explanation
Report kebab-case global configuration keys instead of silently dropping them [#13650] ✅

Possibly related issues

  • [#13863] — Requests equivalent kebab-case reporting in pacquet’s separate Rust configuration parser.

Possibly related PRs

  • pnpm/pnpm#13197 — Modifies configuration-key filtering and warning behavior in the same reader.
  • pnpm/pnpm#13864 — Updates global config.yaml handling to report ignored kebab-case settings.

Suggested labels: product: pnpm@11

✨ 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 fix-13650

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 install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Warn on kebab-case keys in global config.yaml (suggest camelCase)

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Detect kebab-case keys in global config.yaml that previously passed validation then got dropped.
• Emit a targeted warning that includes the camelCase spelling that will work.
• Add regression coverage to ensure kebab-case keys are ignored but explicitly reported.
Diagram

graph TD
  A["getConfig()"] --> B[("global config.yaml")] --> C{{"Key allowed?\n(isConfigFileKey + kebabCase)"}}
  C -->|"unknown key"| E["Add warning: unsupported"] --> F["warnings[]"]
  C -->|"known key"| D{{"camelCase?"}} -->|"yes"| G["Apply to config"]
  D -->|"no (kebab)"| H["Add warning: use camelCase"] --> F
  subgraph Legend
    direction LR
    _p["Process"] ~~~ _d{{"Decision"}} ~~~ _db[("YAML file")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Normalize kebab-case to camelCase (accept + deprecate)
  • ➕ More forgiving UX (existing kebab-case configs start working immediately)
  • ➕ Could ease migration from docs or other tooling that emits kebab-case
  • ➖ Introduces two accepted spellings, increasing long-term ambiguity
  • ➖ Risk of conflicting keys (both spellings present) and unclear precedence
  • ➖ Contradicts current tooling/docs that write camelCase-only
2. Make the first gate camelCase-only (reject kebab earlier)
  • ➕ Simpler validation story (one spelling throughout)
  • ➕ Avoids passing keys that later get filtered
  • ➖ Harder to produce a high-quality message that suggests the correct camelCase key
  • ➖ Still requires special-casing to distinguish unsupported vs wrong casing
3. Schema-driven validation with structured diagnostics
  • ➕ Single source of truth for allowed keys and casing
  • ➕ Can produce consistent, testable error messages across config sources
  • ➖ Larger refactor with higher risk for a small behavioral fix
  • ➖ May require broader changes across config reader modules

Recommendation: The PR’s approach (warn and ignore kebab-case, while suggesting the working camelCase key) is the best fit for current pnpm behavior: it preserves the camelCase-only contract while eliminating the silent drop. Normalizing and accepting kebab-case would be a larger UX policy change that can introduce precedence/ambiguity issues.

Files changed (3) +47 / -2

Bug fix (1) +14 / -2
index.tsDetect and warn on kebab-case keys in global config.yaml +14/-2

Detect and warn on kebab-case keys in global config.yaml

• Extends global YAML key filtering to separately collect keys that pass the supported-key gate but fail camelCase enforcement. Emits a new warning that lists the kebab-case keys and suggests their camelCase equivalents.

pnpm11/config/reader/src/index.ts

Tests (1) +27 / -0
index.tsRegression test for kebab-case key warning in global config.yaml +27/-0

Regression test for kebab-case key warning in global config.yaml

• Adds a test that writes a global config.yaml containing both kebab-case and camelCase keys. Verifies the kebab-case value is not applied and that an explicit warning with the suggested camelCase key is returned.

pnpm11/config/reader/test/index.ts

Documentation (1) +6 / -0
quiet-pugs-invent.mdAdd changeset noting kebab-case global config warning +6/-0

Add changeset noting kebab-case global config warning

• Introduces a patch changeset for @pnpm/config.reader and pnpm. Documents that kebab-case keys in the global config.yaml are now reported instead of silently ignored.

.changeset/quiet-pugs-invent.md

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The PR appears safe to merge, with only the non-blocking cleanup of a narrative source comment recommended.

The changed filtering and warning behavior is covered by a focused test, and no concrete runtime regression remains; the sole accepted concern is duplicated explanatory prose.

Files Needing Attention: pnpm11/config/reader/src/index.ts

Reviews (1): Last reviewed commit: "fix(config): report kebab-case keys in t..." | Re-trigger Greptile

Comment thread pnpm11/config/reader/src/index.ts Resolved
@qodo-code-review

qodo-code-review Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Comment says “would… instead” ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The added comment describes the prior behavior (“would pass … dropped without a word”) rather than
the current behavior/contract, which can become stale and misleading over time. Rewrite it to
describe the present rules (global config keys must be camelCase; kebab-case keys are ignored and
warned).
Code

pnpm11/config/reader/src/index.ts[R324-326]

+    // This gate is kebab-based, but the settings that survive it are picked up
+    // in camelCase. A kebab spelling would pass here and be dropped without a
+    // word, so it is reported instead — with the spelling that works.
Relevance

●●● Strong

Team has accepted rewriting comments to avoid temporal/historical phrasing and reduce
staleness/drift.

PR-#13727
PR-#13383

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 requires comments to describe current behavior rather than historical
implementations. The comment at pnpm11/config/reader/src/index.ts[324-326] uses
hypothetical/historical wording (“would pass … dropped … so it is reported instead”), which frames
the old bug rather than the present contract.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm11/config/reader/src/index.ts[324-326]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added inline comment describes historical/previous behavior (“would pass… and be dropped… so it is reported instead”) instead of documenting the current behavior/contract.

## Issue Context
Per the review guidelines, comments should describe current behavior and avoid historical framing that can become outdated.

## Fix Focus Areas
- pnpm11/config/reader/src/index.ts[324-326]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context
✅ Compliance rules (platform): 18 rules

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@pnpm11/config/reader/test/index.ts`:
- Around line 3814-3823: Update the getConfig call in this test to pass an
isolated env object that clears both PNPM_CONFIG_STATE_DIR and
PNPM_CONFIG_STORE_DIR, preventing inherited values from overriding the YAML
settings while preserving the existing XDG_CONFIG_HOME setup and afterEach
restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e4d3c4e6-e9a0-4b7c-8f22-7c6153078916

📥 Commits

Reviewing files that changed from the base of the PR and between 26f45df and cdc9a4f.

📒 Files selected for processing (3)
  • .changeset/quiet-pugs-invent.md
  • pnpm11/config/reader/src/index.ts
  • pnpm11/config/reader/test/index.ts

Comment thread pnpm11/config/reader/test/index.ts Resolved
The three-line note re-narrated the branch below it; the non-obvious half
is only that the gate is kebab-based while the surviving keys are read in
camelCase.
Copilot AI review requested due to automatic review settings August 13, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 13, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit eda8533

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan
zkochan merged commit 2d8c3e2 into main Aug 14, 2026
32 checks passed
@zkochan
zkochan deleted the fix-13650 branch August 14, 2026 12:14
KSXGitHub pushed a commit that referenced this pull request Aug 14, 2026
#13862 added a third category to the global config.yaml
warning block: keys that pass the kebab-based gate but are only read
back in camelCase. This branch had split the same block's ignoredKeys
into the ones a project manifest accepts and the ones it refuses.

The two are disjoint, so the resolution keeps all three warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A kebab-case key in the global config.yaml passes the key filter and is then silently dropped

2 participants