Repository navigation
refactor: report first-run and lock failures as actionable errors - #1445
Conversation
commit: |
4e3a770 to
3344516
Compare
π WalkthroughWalkthroughThe CLI now uses Estimated code review effort: 3 (Moderate) | ~20 minutes π₯ Pre-merge checks | β 4 | β 1β Failed checks (1 warning)
β Passed checks (4 passed)
β¨ Finishing Touches π‘ 1π 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.
Actionable comments posted: 1
π§Ή Nitpick comments (1)
packages/nuxt-cli/test/unit/commands/analyze.spec.ts (1)
158-162: π― Functional Correctness | π΅ Trivial | β‘ Quick winProtect the
ActionableErrortype contract in both lock-conflict tests.The current assertions pass when a generic
Errorcontains the expected message.
packages/nuxt-cli/test/unit/commands/analyze.spec.ts#L158-L162: assert that the rejection is anActionableError.packages/nuxt-cli/test/unit/commands/build.spec.ts#L128-L132: assert that the rejection is anActionableError.π€ 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 `@packages/nuxt-cli/test/unit/commands/analyze.spec.ts` around lines 158 - 162, Strengthen the lock-conflict rejection assertions in packages/nuxt-cli/test/unit/commands/analyze.spec.ts lines 158-162 and packages/nuxt-cli/test/unit/commands/build.spec.ts lines 128-132 to require an ActionableError instance, not merely an error message containing βlockedβ; preserve the existing formatLockError assertions and lock-conflict behavior in both tests.
π€ 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 `@packages/nuxt-cli/src/utils/lockfile.ts`:
- Around line 335-344: Update formatLockError to distinguish an omitted
outputDir from an explicitly empty string: treat only undefined as absent, and
render an empty outputDir as "." in the writing-message path while preserving
existing non-empty paths.
---
Nitpick comments:
In `@packages/nuxt-cli/test/unit/commands/analyze.spec.ts`:
- Around line 158-162: Strengthen the lock-conflict rejection assertions in
packages/nuxt-cli/test/unit/commands/analyze.spec.ts lines 158-162 and
packages/nuxt-cli/test/unit/commands/build.spec.ts lines 128-132 to require an
ActionableError instance, not merely an error message containing βlockedβ;
preserve the existing formatLockError assertions and lock-conflict behavior in
both tests.
πͺ 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 17dc8537-bcc2-4def-95d9-4d5b405266e1
π Files selected for processing (17)
packages/nuxt-cli/src/commands/analyze.tspackages/nuxt-cli/src/commands/build.tspackages/nuxt-cli/src/commands/devtools.tspackages/nuxt-cli/src/commands/test.tspackages/nuxt-cli/src/dev/cert.tspackages/nuxt-cli/src/dev/listen.tspackages/nuxt-cli/src/dev/preflight.tspackages/nuxt-cli/src/dev/takeover.tspackages/nuxt-cli/src/dev/utils.tspackages/nuxt-cli/src/utils/config.tspackages/nuxt-cli/src/utils/console.tspackages/nuxt-cli/src/utils/kit.tspackages/nuxt-cli/src/utils/lockfile.tspackages/nuxt-cli/src/utils/stdout.tspackages/nuxt-cli/test/unit/commands/analyze.spec.tspackages/nuxt-cli/test/unit/commands/build.spec.tspackages/nuxt-cli/test/unit/lockfile.spec.ts
π€ Files with no reviewable changes (1)
- packages/nuxt-cli/src/utils/console.ts
| export function formatLockError(info: LockInfo, options: { outputDir?: string } = {}): string { | ||
| const isWindows = process.platform === 'win32' | ||
| const killCmd = isWindows ? `taskkill /PID ${info.pid} /F` : `kill ${info.pid}` | ||
| const label = info.command === 'dev' ? 'dev server' : 'build' | ||
|
|
||
| const lines = [ | ||
| '', | ||
| `Another Nuxt ${label} is already running:`, | ||
| options.outputDir | ||
| ? `Another Nuxt ${label} is already writing to ${options.outputDir}:` | ||
| : `Another Nuxt ${label} is already running:`, |
There was a problem hiding this comment.
π― Functional Correctness | π‘ Minor | β‘ Quick win
Preserve output context when outputDir is empty.
If a caller passes '', this truthiness check emits the generic βalready runningβ message. Treat undefined as the absent-value case and render an empty relative path as ..
Proposed fix
- options.outputDir
- ? `Another Nuxt ${label} is already writing to ${options.outputDir}:`
+ options.outputDir !== undefined
+ ? `Another Nuxt ${label} is already writing to ${options.outputDir || '.'}:`π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export function formatLockError(info: LockInfo, options: { outputDir?: string } = {}): string { | |
| const isWindows = process.platform === 'win32' | |
| const killCmd = isWindows ? `taskkill /PID ${info.pid} /F` : `kill ${info.pid}` | |
| const label = info.command === 'dev' ? 'dev server' : 'build' | |
| const lines = [ | |
| '', | |
| `Another Nuxt ${label} is already running:`, | |
| options.outputDir | |
| ? `Another Nuxt ${label} is already writing to ${options.outputDir}:` | |
| : `Another Nuxt ${label} is already running:`, | |
| export function formatLockError(info: LockInfo, options: { outputDir?: string } = {}): string { | |
| const isWindows = process.platform === 'win32' | |
| const killCmd = isWindows ? `taskkill /PID ${info.pid} /F` : `kill ${info.pid}` | |
| const label = info.command === 'dev' ? 'dev server' : 'build' | |
| const lines = [ | |
| '', | |
| options.outputDir !== undefined | |
| ? `Another Nuxt ${label} is already writing to ${options.outputDir || '.'}:` | |
| : `Another Nuxt ${label} is already running:`, |
π€ 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 `@packages/nuxt-cli/src/utils/lockfile.ts` around lines 335 - 344, Update
formatLockError to distinguish an omitted outputDir from an explicitly empty
string: treat only undefined as absent, and render an empty outputDir as "." in
the writing-message path while preserving existing non-empty paths.
3344516 to
000e2f9
Compare
000e2f9 to
96ee7bb
Compare
π Linked issue
π Description
this adopts the
ActionableErrorfrom #1444 to strip stacktraces from errors which don't need them, in more places