feat(view): show deprecation warning and bin info#12271
Conversation
Code Review by Qodo
1. Unnormalized bin names
|
|
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:
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 (1)
📜 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). (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (2)📚 Learning: 2026-05-14T09:04:00.133ZApplied to files:
📚 Learning: 2026-06-05T13:47:26.046ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughThe view command now displays deprecation notices and improves bin field handling. When a package has deprecation metadata, a "DEPRECATED!" section is appended. The bin field is normalized from string or object and rendered as a comma-separated ChangesView Command Deprecation and Bin Display
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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)
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
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. Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds additional information to the pnpm view text output and expands test coverage to validate the new sections.
Changes:
- Display deprecation notices in text output when
info.deprecatedis present - Display
binentries in text output wheninfo.binis present - Add tests asserting the presence of
binand deprecation output
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| deps/inspection/commands/src/view/index.ts | Adds deprecated and bin sections to text view output formatting. |
| deps/inspection/commands/test/view.ts | Adds assertions to ensure bin and deprecation sections appear in text output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
deps/inspection/commands/test/view.ts (2)
127-130: ⚡ Quick winConsider testing both bin formats.
The test only verifies the output for a single package (
uuid@10.0.0). To ensure robust coverage, consider adding a test case that explicitly verifies:
- String
binformat (single executable)- Object
binformat (multiple commands)This would catch any issues with the bin normalization logic in the handler.
🤖 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 `@deps/inspection/commands/test/view.ts` around lines 127 - 130, The test for view.handler currently only asserts a single-package case and misses verifying both bin formats; add at least one more test that calls view.handler (using VIEW_OPTIONS and the same Config & ConfigContext typing) with a package whose package.json uses an object-style bin (multiple commands) and assert the output contains each expected "bin: <name>" entry in addition to keeping the existing string-style test for uuid@10.0.0 so the bin normalization logic in view.handler is covered for both string and object formats.
151-154: ⚡ Quick winConsider verifying the actual deprecation message.
The test only checks for the presence of the
"DEPRECATED! - "prefix. To strengthen the assertion, consider also verifying that the actual deprecation message appears in the output, not just the label.For example:
expect(result).toContain('DEPRECATED! - ') + expect(result).toMatch(/DEPRECATED! - .+/)This ensures the deprecation message content is actually rendered, not just the label.
🤖 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 `@deps/inspection/commands/test/view.ts` around lines 151 - 154, The test "view: text output for deprecated package shows deprecation" currently only asserts the prefix 'DEPRECATED! - ' is present; update the assertion to also verify the actual deprecation message is rendered by checking view.handler's output (the call using VIEW_OPTIONS and ['uuid@10.0.0']) contains a non-empty message after that prefix — either assert a concrete expected message string if known or use a regex/assertion that ensures 'DEPRECATED! - ' is followed by some non-whitespace text (e.g. match /DEPRECATED! - \S+/) so the test validates the deprecation content as well.
🤖 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 `@deps/inspection/commands/test/view.ts`:
- Around line 127-130: The test for view.handler currently only asserts a
single-package case and misses verifying both bin formats; add at least one more
test that calls view.handler (using VIEW_OPTIONS and the same Config &
ConfigContext typing) with a package whose package.json uses an object-style bin
(multiple commands) and assert the output contains each expected "bin: <name>"
entry in addition to keeping the existing string-style test for uuid@10.0.0 so
the bin normalization logic in view.handler is covered for both string and
object formats.
- Around line 151-154: The test "view: text output for deprecated package shows
deprecation" currently only asserts the prefix 'DEPRECATED! - ' is present;
update the assertion to also verify the actual deprecation message is rendered
by checking view.handler's output (the call using VIEW_OPTIONS and
['uuid@10.0.0']) contains a non-empty message after that prefix — either assert
a concrete expected message string if known or use a regex/assertion that
ensures 'DEPRECATED! - ' is followed by some non-whitespace text (e.g. match
/DEPRECATED! - \S+/) so the test validates the deprecation content as well.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 005c8f81-8433-4d92-9d73-e030e4b4ab2f
📒 Files selected for processing (2)
deps/inspection/commands/src/view/index.tsdeps/inspection/commands/test/view.ts
📜 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). (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Compile & Lint
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Use Standard Style with trailing commas, prefer functions over classes, declare functions after they are used (relying on hoisting), limit functions to no more than two or three arguments, and use a single options object for functions needing more parameters
Follow import order: standard libraries first, then external dependencies (sorted alphabetically), then relative imports
Do not write comments that restate what the code already says; rename variables, split helpers, or move checks to more obvious places instead
Do not repeat documentation at call sites that already lives on the callee; update the JSDoc once and let every call site benefit
Use JSDoc for the function's contract (preconditions, postconditions, edge cases, why the function exists), not for re-narrating the function body
Do not record past implementation shape, refactor history, or removed code in comments; use git log and git blame for that information instead
Write comments only when the reason for code is non-obvious, a hidden invariant exists, a workaround for a known bug is needed, or an exception to surrounding pattern is deliberate
Files:
deps/inspection/commands/test/view.tsdeps/inspection/commands/src/view/index.ts
🧠 Learnings (3)
📚 Learning: 2026-05-14T09:04:00.133Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11622
File: resolving/npm-resolver/test/publishedBy.test.ts:350-354
Timestamp: 2026-05-14T09:04:00.133Z
Learning: In the pnpm/pnpm repository, ESLint is the authoritative style linter. Do not raise review findings for missing trailing commas in multiline function calls (e.g., `fs.writeFileSync(...)`) when this repo’s ESLint configuration does not report them and lint passes. Prefer deferring to the ESLint results for this specific trailing-comma rule rather than enforcing it manually in code review.
Applied to files:
deps/inspection/commands/test/view.tsdeps/inspection/commands/src/view/index.ts
📚 Learning: 2026-06-05T13:47:05.929Z
Learnt from: vsumner
Repo: pnpm/pnpm PR: 12190
File: installing/deps-installer/test/install/frozenStore.ts:2-17
Timestamp: 2026-06-05T13:47:05.929Z
Learning: In the pnpm/pnpm repository, the shared Jest preset keeps `injectGlobals` at its default (`true`), so `test` and `expect` are available as Jest globals. Therefore, reviewers should not flag (or treat as TypeScript/compilation errors) missing `import { test, expect } from 'jest/globals'` when a test file uses `test`/`expect` without importing them. Importing from `jest/globals` may still be used for consistency with sibling files, but it is not required for execution in this repo unless a Jest preset is explicitly configured with `injectGlobals: false`.
Applied to files:
deps/inspection/commands/test/view.ts
📚 Learning: 2026-06-05T13:47:26.046Z
Learnt from: vsumner
Repo: pnpm/pnpm PR: 12190
File: installing/deps-installer/src/install/index.ts:2337-2343
Timestamp: 2026-06-05T13:47:26.046Z
Learning: In the pnpm/pnpm codebase, `PnpmError` automatically prefixes `err.code` with `ERR_PNPM_` when you pass a code that does not already start with `ERR_PNPM_` (it normalizes `this.code` via `code.startsWith('ERR_PNPM_') ? code : `ERR_PNPM_${code}``). Therefore, during code review you should NOT flag `new PnpmError(...)` call sites for passing a bare error code (e.g., `new PnpmError('FROZEN_STORE_INCOMPATIBLE_WITH_PNPR', ...)`); the resulting `err.code` will still be `ERR_PNPM_FROZEN_STORE_INCOMPATIBLE_WITH_PNPR`.
Applied to files:
deps/inspection/commands/test/view.tsdeps/inspection/commands/src/view/index.ts
🔇 Additional comments (2)
deps/inspection/commands/src/view/index.ts (2)
127-130: LGTM!
137-141: Fixbinrendering for string-forminfo.binCurrent rendering treats
info.bindifferently by type: when it’s an object, it prints command names (Object.keys(info.bin)), but when it’s a string it prints the string value itself. Per npm’sbin: "<path>"convention, the command name should be the package name (info.name), not the path string.The view test only asserts the
uuid@10.0.0output containsbin: uuid, so it may be exercising the object-form mock rather than the string-form.
- Location:
deps/inspection/commands/src/view/index.ts(lines ~137-141)- Minor: remove the extra space after
?on the ternary (line ~138)🛠️ Proposed fix
if (info.bin) { - const bins = typeof info.bin === 'string' ? [info.bin] : Object.keys(info.bin) - lines.push(''); + const bins = typeof info.bin === 'string' ? (info.name ? [info.name] : [info.bin]) : Object.keys(info.bin) + lines.push('') lines.push(`bin: ${chalk.cyan(bins.join(', '))}`) }
|
Code review by qodo was updated up to the latest commit 521da3e |
|
Code review by qodo was updated up to the latest commit 36a825c |
|
Code review by qodo was updated up to the latest commit c85cfed |
|
Code review by qodo was updated up to the latest commit 01eb3fc |
|
Code review by qodo was updated up to the latest commit 1599363 |
Integrate the 9 commits main gained (#12271, #12294, #12301, #12303, #12305, #12312, #12315, #12316, and the release/version bumps). Conflict resolution: all four conflicts (record_lockfile_verified, build_modules, hoisted_dep_graph, install) were between this branch's lint edits and main's feature changes — took main's authoritative versions; lint compliance is re-derived by re-running clippy in the follow-up commit.
Closes #11610
This is similar to the
npmviewcommand.Summary by CodeRabbit
New Features
Tests
Chores