fix: warnings in store|config should be printed to stderr#12434
Conversation
|
💖 Thanks for opening this pull request! 💖 |
Code Review by Qodo
Context used 1. run missing useStderr
|
|
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:
📝 WalkthroughWalkthroughThe Changesstore command stderr routing
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 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 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
Note
Copilot was unable to run its full agentic suite in this review.
This PR routes reporter output for the pnpm store command to stderr so that the stdout output (notably pnpm store path) can be safely captured in scripts without warnings/noise.
Changes:
- Add
storeto the list of commands that forceconfig.useStderr = true - Add a changeset documenting the behavior change for
pnpm store path/storeoutput streams
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pnpm/src/main.ts | Forces stderr reporter output for the store command by setting config.useStderr |
| .changeset/store-use-stderr.md | Adds release note describing the stdout/stderr behavior change for pnpm store path |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PR Summary by QodoRoute pnpm store/config reporter warnings & progress to stderr WalkthroughsDescription• Send pnpm store and pnpm config|set|get reporter output to stderr to keep stdout clean. • Reuse a single isConfigCommand guard for config-related behavior. • Add a changeset documenting the behavioral change for scripting/automation. Diagramgraph TD
U([Shell / CI script]) --> M["pnpm/src/main.ts"] --> C{"Command\nclassification"} --> S["config.useStderr = true"] --> R["Reporter output"] --> E["stderr (warnings/progress)"]
C -->|"other commands"| R --> O["stdout (command output)"]
High-Level AssessmentSetting File ChangesBug fix (1)
Documentation (1)
|
6fedddc to
01ce930
Compare
01ce930 to
f766492
Compare
f766492 to
403526e
Compare
|
Code review by qodo was updated up to the latest commit 403526e |
pnpm store should be printed to stderrstore|config should be printed to stderr
ddbd73e to
e730e1a
Compare
e730e1a to
c60414d
Compare
|
Code review by qodo was updated up to the latest commit c60414d |
c60414d to
311fe05
Compare
|
Code review by qodo was updated up to the latest commit 311fe05 |
| if (isDlxOrCreateCommand || isConfigCommand || cmd === 'sbom' || cmd === 'with' || cmd === 'store') { | ||
| config.useStderr = true |
There was a problem hiding this comment.
1. run missing usestderr 📎 Requirement gap ≡ Correctness
The override deprecation warning is emitted via globalWarn() and will be printed by the default/append-only reporter to stdout unless config.useStderr is enabled. main() only enables useStderr for a small set of commands, so pnpm build (parsed as cmd === 'run') can still contaminate stdout with the override deprecation warning and break scripts/tooling that consume stdout.
Agent Prompt
## Issue description
`config.useStderr` is not enabled for `cmd === 'run'` (the fallback command used by `pnpm <script>` such as `pnpm build`). As a result, the override deprecation warning emitted via `globalWarn()` can still be routed to `stdout`, violating the requirement that warnings must not corrupt `stdout`.
## Issue Context
- The override deprecation warning is emitted in the config reader via `globalWarn()`.
- The default/append-only reporter writes to `proc.stdout` unless `useStderr` is set.
- `pnpm build` is parsed as `cmd === 'run'` via `fallbackCommand: 'run'`.
## Fix Focus Areas
- pnpm/src/main.ts[137-146]
- pnpm/src/parseCliArgs.ts[19-33]
- config/reader/src/getOptionsFromRootManifest.ts[51-60]
- cli/default-reporter/src/index.ts[52-56]
- cli/default-reporter/src/index.ts[80-83]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Good catch — this is a real instance of the same bug class, but routing run/exec reporter output to stderr the simple way (adding them to the useStderr set) breaks more than it fixes.
When pnpm runs multiple scripts — recursive (-r), --parallel, or several scripts in one project — it captures each child's stdout and re-emits it through its own reporter. So flipping the reporter to stderr would send the actual script output (not just warnings) to stderr, breaking pnpm -r build > out.txt. I verified this: adding run/exec to the set fails 4 tests in pnpm/test/run.ts (recursive args echo, collapsed multi-script output, --parallel, --reporter-hide-prefix), all because the script output lands on the wrong stream.
Only the single-script/single-project case inherits the child stdio directly, so the boundary is "single vs. multiplexed run", not "recursive vs. not" — it can't be expressed cleanly in main.ts's command classification. The correct fix is to separate pnpm's own warnings (e.g. the override-deprecation notice) from multiplexed child output during runs, which is a larger reporter/logger change.
Deferring run/exec to a dedicated follow-up PR; keeping this one scoped to store/config.
Written by an agent (Claude Code, claude-opus-4-8).
|
Code review by qodo was updated up to the latest commit a0faaeb |
Closes #12432
Summary by CodeRabbit
storecommand so warnings/progress are sent to stderr instead of stdout, avoiding contamination of captured output in automation.config-related subcommands (config,set,get) for consistent behavior.