Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughUpdates include a null-safety fix to breadcrumb computation in the docs page, a change to the docs content source fallback repository URL (and an added TODO), a new route rule to prerender Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 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)
server/middleware/error-docs-redirect.ts (1)
11-16: Consider tightening the regex to match only valid error code formats.The current regex
(.+)is very permissive and will redirect any path under/docs/errors/to the versioned path, even invalid ones like/docs/errors/fooor paths with extra segments. While this won't cause security issues (it just results in 404s), it's inconsistent with the strict validation inserver/routes/e/[code].get.ts.For consistency with the route handler and clearer intent, consider restricting to the expected error code format:
♻️ Optional: Align regex with expected error code format
- // Match /docs/errors/... but NOT /docs/3.x/errors/... or /docs/4.x/errors/... - const match = path.match(/^\/docs\/errors\/(.+)$/) + // Match /docs/errors/E1001 or /docs/errors/B1001 (E or B followed by digits) + const match = path.match(/^\/docs\/errors\/([EB]\d+)$/)Alternatively, if the permissive approach is intentional to gracefully handle future formats, the current implementation is acceptable.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@server/middleware/error-docs-redirect.ts` around lines 11 - 16, The current permissive regex in the error-docs redirect (the path.match call) allows any segment under /docs/errors/ to be redirected; change it to validate only the expected error-code format used by server/routes/e/[code].get.ts (e.g., three-digit codes with optional slug/segment patterns) before calling sendRedirect(event, `/docs/4.x/errors/${match[1]}`, 302). Update the path.match expression to mirror the same pattern used by the route handler so only valid error codes are redirected and everything else is ignored.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@content.config.ts`:
- Around line 13-14: The repo fallback currently points to the feature branch
'https://github.com/nuxt/nuxt/tree/feat/error-context' when
process.env.NUXT_V4_PATH is not set; change this so the default does not
reference a feature branch by replacing that URL with the stable
'https://github.com/nuxt/nuxt/tree/4.x' (or set repository to undefined and
require an explicit env var to opt into the feature branch), updating the
`repository` assignment that references process.env.NUXT_V4_PATH to ensure
previews are only selected via an explicit environment variable rather than
defaulting to the feat/error-context branch.
---
Nitpick comments:
In `@server/middleware/error-docs-redirect.ts`:
- Around line 11-16: The current permissive regex in the error-docs redirect
(the path.match call) allows any segment under /docs/errors/ to be redirected;
change it to validate only the expected error-code format used by
server/routes/e/[code].get.ts (e.g., three-digit codes with optional
slug/segment patterns) before calling sendRedirect(event,
`/docs/4.x/errors/${match[1]}`, 302). Update the path.match expression to mirror
the same pattern used by the route handler so only valid error codes are
redirected and everything else is ignored.
🪄 Autofix (Beta)
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
Run ID: 2035a71d-eb5e-47ec-8126-fb12bc66cde1
📒 Files selected for processing (5)
app/pages/docs/[...slug].vuecontent.config.tsnuxt.config.tsserver/middleware/error-docs-redirect.tsserver/routes/e/[code].get.ts
content.config.ts
Outdated
| // TODO: revert to 4.x branch before merging | ||
| repository: !process.env.NUXT_V4_PATH ? 'https://github.com/nuxt/nuxt/tree/feat/error-context' : undefined, |
There was a problem hiding this comment.
Avoid shipping a feature-branch fallback for v4 docs source.
Line 14 points to feat/error-context, and with default envs this becomes the effective source. That’s risky for merge/release because it can drift or break when the feature branch changes. Please revert the fallback to 4.x before merge (or gate preview branch selection behind an explicit env var).
Suggested fix
const docsV4Source = {
cwd: process.env.NUXT_V4_PATH ?? undefined,
- // TODO: revert to 4.x branch before merging
- repository: !process.env.NUXT_V4_PATH ? 'https://github.com/nuxt/nuxt/tree/feat/error-context' : undefined,
+ repository: !process.env.NUXT_V4_PATH ? 'https://github.com/nuxt/nuxt/tree/4.x' : undefined,
include: 'docs/**/*',
exclude: ['docs/**/*.json'],
prefix: '/docs/4.x'
}📝 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.
| // TODO: revert to 4.x branch before merging | |
| repository: !process.env.NUXT_V4_PATH ? 'https://github.com/nuxt/nuxt/tree/feat/error-context' : undefined, | |
| const docsV4Source = { | |
| cwd: process.env.NUXT_V4_PATH ?? undefined, | |
| repository: !process.env.NUXT_V4_PATH ? 'https://github.com/nuxt/nuxt/tree/4.x' : undefined, | |
| include: 'docs/**/*', | |
| exclude: ['docs/**/*.json'], | |
| prefix: '/docs/4.x' | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@content.config.ts` around lines 13 - 14, The repo fallback currently points
to the feature branch 'https://github.com/nuxt/nuxt/tree/feat/error-context'
when process.env.NUXT_V4_PATH is not set; change this so the default does not
reference a feature branch by replacing that URL with the stable
'https://github.com/nuxt/nuxt/tree/4.x' (or set repository to undefined and
require an explicit env var to opt into the feature branch), updating the
`repository` assignment that references process.env.NUXT_V4_PATH to ensure
previews are only selected via an explicit environment variable rather than
defaulting to the feat/error-context branch.
paired with nuxt/nuxt#34719
Note
The
content.config.tschange pointingdocsV4Sourcetofeat/error-contextis temporary for preview purposes. It must be reverted to4.xbefore merging.Preview URLs to test
/e/NUXT_E1001→ should redirect to error page/docs/errors/E1001→ should redirect to versioned error page/docs/4.x/errors/E1001→ should render the error doc/docs/4.x/errors→ should render the error codes index