Conversation
📝 WalkthroughWalkthroughThe PR externalizes Next.js configuration logic from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
next.config.ts (1)
56-58: Type mismatch withpersistBakedArtifactsparameter.
publicEnvhere isparsed.data(the validated object), butpersistBakedArtifactsinconfig/runtimeConfig.tsdeclares the parameter asstring. This works becauseJSON.stringifyhandles both, but the type declaration should be corrected inruntimeConfig.tsfor accuracy.
🤖 Fix all issues with AI agents
In @config/runtimeConfig.ts:
- Around line 4-21: persistBakedArtifacts currently swallows all errors and has
a wrong parameter type: change the publicEnv parameter from string to the proper
object type (e.g., Record<string, unknown> or the validated config interface) so
JSON.stringify serializes an object rather than double-serializing a prebuilt
string, and replace the empty catch with a proper error handler that catches
(err) and logs a clear, contextual error (including function name
persistBakedArtifacts and relevant params or err.message) and either rethrows or
surfaces the failure so callers like loadBakedRuntimeConfig can detect missing
artifacts.
🧹 Nitpick comments (2)
config/runtimeConfig.ts (1)
23-32: JSON parse errors are not wrapped with context.Lines 26 and 28 call
JSON.parsedirectly. If the file or environment variable contains malformed JSON, the raw parse error won't indicate which source failed. Consider wrapping with context for easier debugging.Suggested improvement
export function loadBakedRuntimeConfig(VERSION: string) { let baked = {}; if (process.env["PUBLIC_RUNTIME"]) { - baked = JSON.parse(process.env["PUBLIC_RUNTIME"]); + try { + baked = JSON.parse(process.env["PUBLIC_RUNTIME"]); + } catch (e) { + throw new Error("Failed to parse PUBLIC_RUNTIME env variable", { cause: e }); + } } else if (fs.existsSync(".next/PUBLIC_RUNTIME.json")) { - baked = JSON.parse(fs.readFileSync(".next/PUBLIC_RUNTIME.json", "utf8")); + try { + baked = JSON.parse(fs.readFileSync(".next/PUBLIC_RUNTIME.json", "utf8")); + } catch (e) { + throw new Error("Failed to parse .next/PUBLIC_RUNTIME.json", { cause: e }); + } } const parsed = publicEnvSchema.safeParse({ ...baked, VERSION }); if (!parsed.success) throw parsed.error; return parsed.data; }config/version.ts (1)
3-9: Unused environment variable assignment.Line 6 sets
process.env["__LOG_ENV_ONCE__"] = "1"on every call tologOnceConfig, but this variable is never read anywhere. This appears to be dead code or an incomplete feature.Suggested removal
export function logOnceConfig(label: string, message: string) { if (!process.env[`__LOG_${label}_ONCE__`]) { process.env[`__LOG_${label}_ONCE__`] = "1"; - process.env["__LOG_ENV_ONCE__"] = "1"; console.log(`${label}: ${message}`); } }
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
config/assets.tsconfig/nextConfig.tsconfig/runtimeConfig.tsconfig/securityHeaders.tsconfig/version.tsnext.config.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version
**/*.{ts,tsx,js,jsx}: Remove unnecessary Effects. If the Effect's only job is to derive or sync internal state, calculate during render or useuseMemoinstead.
UseuseEffectEventfor non-reactive logic inside Effects to read the latest props/state without turning them into dependencies or causing unnecessary re-runs.
Use explicit caching with"use cache"directive at the top of Server Components, routes, or functions. ConfigurecacheComponents: trueinnext.config.tsas needed.
**/*.{ts,tsx,js,jsx}: Remove unnecessary Effects; if the Effect only derives state, compute during render instead
UseuseEffectEventwhen listening to external events but needing the latest props/state without re-running the Effect
Move data fetching from client Effects to Server Components; mutations go through Server Actions ('use server')
Files:
config/nextConfig.tsconfig/runtimeConfig.tsconfig/version.tsconfig/securityHeaders.tsconfig/assets.tsnext.config.ts
{.env*,*.env,**/config/**}
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
Configure Task Master behavior via environment variables: ANTHROPIC_API_KEY (required), MODEL, MAX_TOKENS, TEMPERATURE, DEBUG, LOG_LEVEL, DEFAULT_SUBTASKS, DEFAULT_PRIORITY, PROJECT_NAME, PROJECT_VERSION, PERPLEXITY_API_KEY, and PERPLEXITY_MODEL
Files:
config/nextConfig.tsconfig/runtimeConfig.tsconfig/version.tsconfig/securityHeaders.tsconfig/assets.ts
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (GEMINI.md)
Run
npm run lintto ensure code satisfies ESLint (Next's Core Web Vitals + React Hooks). Code must pass linting before completing any task.
**/*.{js,ts,jsx,tsx}: Code must satisfy ESLint with Next's Core Web Vitals and React Hooks rules by runningnpm run lint
Do not addeslint-disablecomments unless explicitly instructed; prefer refactors aligned with React 19.2, React Compiler, and Next.js 16 conventions
Files:
config/nextConfig.tsconfig/runtimeConfig.tsconfig/version.tsconfig/securityHeaders.tsconfig/assets.tsnext.config.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (GEMINI.md)
Use TypeScript with React functional components and hooks. Follow existing code style and naming conventions.
Files:
config/nextConfig.tsconfig/runtimeConfig.tsconfig/version.tsconfig/securityHeaders.tsconfig/assets.tsnext.config.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript with React functional components and hooks
Files:
config/nextConfig.tsconfig/runtimeConfig.tsconfig/version.tsconfig/securityHeaders.tsconfig/assets.tsnext.config.ts
**/*.{ts,js}
📄 CodeRabbit inference engine (AGENTS.md)
When parsing Seize URLs or similar, fail fast if base origin is unavailable instead of falling back to placeholder origins
Files:
config/nextConfig.tsconfig/runtimeConfig.tsconfig/version.tsconfig/securityHeaders.tsconfig/assets.tsnext.config.ts
**/*.{tsx,ts,jsx,js}
📄 CodeRabbit inference engine (AGENTS.md)
Prefer direct named imports from React (
useMemo,useRef,FC) overReact.namespace usage
Files:
config/nextConfig.tsconfig/runtimeConfig.tsconfig/version.tsconfig/securityHeaders.tsconfig/assets.tsnext.config.ts
next.config.{js,ts,mjs,mts}
📄 CodeRabbit inference engine (GEMINI.md)
next.config.{js,ts,mjs,mts}: With Next.js 16,next lintis removed. Use the ESLint CLI driven byeslint-config-next(flat config). Remove anyeslintoptions fromnext.config.*.
Enable React Compiler innext.config.tsonce CI is green by settingreactCompiler: trueto auto-memoize components and reduce manualuseMemo/useCallbackusage.
Files:
next.config.ts
{eslint.config.js,next.config.ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use ESLint CLI driven by
eslint-config-next(flat config) instead ofnext lint(removed in Next.js 16)
Files:
next.config.ts
next.config.ts
📄 CodeRabbit inference engine (AGENTS.md)
Enable React Compiler in
next.config.tsby settingreactCompiler: truewhen CI is green
Files:
next.config.ts
next.config.{ts,js,mjs}
📄 CodeRabbit inference engine (AGENTS.md)
Remove any
eslintoptions fromnext.config.*files in Next.js 16
Files:
next.config.ts
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:19.360Z
Learning: Applies to next.config.{ts,js,mjs} : Remove any `eslint` options from `next.config.*` files in Next.js 16
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use NextJS features that match the current version
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-30T14:31:53.006Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use explicit caching with `"use cache"` directive at the top of Server Components, routes, or functions. Configure `cacheComponents: true` in `next.config.ts` as needed.
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-30T14:31:53.006Z
Learning: Applies to next.config.{js,ts,mjs,mts} : Enable React Compiler in `next.config.ts` once CI is green by setting `reactCompiler: true` to auto-memoize components and reduce manual `useMemo`/`useCallback` usage.
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:19.360Z
Learning: Applies to {eslint.config.js,next.config.ts} : Use ESLint CLI driven by `eslint-config-next` (flat config) instead of `next lint` (removed in Next.js 16)
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:44.885Z
Learning: Applies to app/api/**/*.{ts,tsx} : Follow the project default responses (`NextResponse.json`) and reuse existing util modules instead of duplicating logic.
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:19.360Z
Learning: Applies to proxy.ts : Rename `middleware.ts` to `proxy.ts` for request boundary logic and export `proxy` function (Next.js 16+)
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-30T14:31:53.006Z
Learning: Applies to next.config.{js,ts,mjs,mts} : With Next.js 16, `next lint` is removed. Use the ESLint CLI driven by `eslint-config-next` (flat config). Remove any `eslint` options from `next.config.*`.
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:19.360Z
Learning: Applies to next.config.ts : Enable React Compiler in `next.config.ts` by setting `reactCompiler: true` when CI is green
📚 Learning: 2025-12-30T14:32:19.360Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:19.360Z
Learning: Applies to next.config.{ts,js,mjs} : Remove any `eslint` options from `next.config.*` files in Next.js 16
Applied to files:
config/nextConfig.tsnext.config.ts
📚 Learning: 2025-12-30T14:31:53.006Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-30T14:31:53.006Z
Learning: Applies to next.config.{js,ts,mjs,mts} : Enable React Compiler in `next.config.ts` once CI is green by setting `reactCompiler: true` to auto-memoize components and reduce manual `useMemo`/`useCallback` usage.
Applied to files:
config/nextConfig.tsnext.config.ts
📚 Learning: 2025-12-30T14:31:53.006Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-30T14:31:53.006Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use explicit caching with `"use cache"` directive at the top of Server Components, routes, or functions. Configure `cacheComponents: true` in `next.config.ts` as needed.
Applied to files:
config/nextConfig.tsconfig/runtimeConfig.tsconfig/assets.tsnext.config.ts
📚 Learning: 2025-12-30T14:32:19.360Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:19.360Z
Learning: Applies to next.config.ts : Enable React Compiler in `next.config.ts` by setting `reactCompiler: true` when CI is green
Applied to files:
config/nextConfig.tsnext.config.ts
📚 Learning: 2025-12-30T14:32:19.360Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:19.360Z
Learning: Applies to proxy.ts : Rename `middleware.ts` to `proxy.ts` for request boundary logic and export `proxy` function (Next.js 16+)
Applied to files:
config/nextConfig.tsnext.config.ts
📚 Learning: 2025-12-30T14:32:44.885Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:44.885Z
Learning: Applies to app/api/**/*.{ts,tsx} : When needing custom headers or timeouts for external requests, pass them via the `@/lib/security/urlGuard` helper options rather than re-implementing your own wrapper.
Applied to files:
config/securityHeaders.ts
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use NextJS features that match the current version
Applied to files:
next.config.ts
📚 Learning: 2025-12-30T14:31:53.006Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-30T14:31:53.006Z
Learning: Applies to next.config.{js,ts,mjs,mts} : With Next.js 16, `next lint` is removed. Use the ESLint CLI driven by `eslint-config-next` (flat config). Remove any `eslint` options from `next.config.*`.
Applied to files:
next.config.ts
📚 Learning: 2025-12-30T14:31:53.006Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-30T14:31:53.006Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions. Do not add `// eslint-disable` comments unless explicitly instructed.
Applied to files:
next.config.ts
📚 Learning: 2025-12-30T14:32:19.360Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:19.360Z
Learning: Applies to {eslint.config.js,next.config.ts} : Use ESLint CLI driven by `eslint-config-next` (flat config) instead of `next lint` (removed in Next.js 16)
Applied to files:
next.config.ts
📚 Learning: 2025-12-30T14:32:37.305Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: __tests__/AGENTS.md:0-0
Timestamp: 2025-12-30T14:32:37.305Z
Learning: Applies to __tests__/**/*.{ts,tsx,js},!**/__tests__/**,!**/__mocks__/**,!**/*.d.ts : Use one import per module with ordering: external → internal → types, no duplicates
Applied to files:
next.config.ts
🧬 Code graph analysis (2)
config/nextConfig.ts (3)
config/env.ts (1)
publicEnv(7-7)config/env.schema.ts (1)
PublicEnv(129-129)config/securityHeaders.ts (1)
createSecurityHeaders(1-46)
config/runtimeConfig.ts (2)
config/env.ts (1)
publicEnv(7-7)config/env.schema.ts (1)
publicEnvSchema(10-127)
⏰ 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). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (7)
config/assets.ts (1)
3-16: LGTM with minor nit.The logic is correct and the file-based fallback pattern aligns well with the runtime config loading approach. Minor observation:
.toString()on lines 5 and 11 is unnecessary sinceprocess.envvalues are already strings, though it doesn't cause harm.config/securityHeaders.ts (1)
1-1: LGTM!The explicit type annotation with a default empty string improves type safety and ensures the CSP
connect-srcdirective doesn't contain "undefined" as a literal string.config/version.ts (1)
11-25: LGTM!The version resolution logic with git fallback is well-structured. The fail-fast approach with a sensible default ("6529seize") when git is unavailable handles CI/CD and containerized environments appropriately.
next.config.ts (1)
33-125: Well-structured modularization.The refactoring cleanly separates concerns: version computation, asset flag resolution, runtime config persistence/loading, and shared config building are now in dedicated modules. The phase-based configuration logic is preserved correctly, and the fail-fast validation approach at both build and runtime phases is appropriate.
config/nextConfig.ts (3)
64-64: Minification is disabled.
config.optimization.minimize = falsedisables minification for client bundles. Combined withproductionBrowserSourceMaps: true, this significantly increases bundle size. Verify this is intentional for debugging purposes and not accidentally left from development.
6-78: Good centralization of shared Next.js config.The
sharedConfigfunction consolidates common configuration that was previously duplicated or inline. ThereactCompiler: truesetting aligns with the learnings for Next.js 16. Security headers are properly integrated viacreateSecurityHeaders.
67-75: All Turbopack alias paths are correctly configured and files exist.The stub files and alias target files referenced in the
resolveAliasconfiguration are present and committed:
stubs/empty.jsexists (22 bytes)lib/storage/idb-keyval.tsexists (10,390 bytes)No action needed.

Summary by CodeRabbit
Release Notes
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.