Skip to content

Conversation

@schiller-manuel
Copy link
Contributor

@schiller-manuel schiller-manuel commented Oct 17, 2025

Summary by CodeRabbit

  • Chores
    • Internal improvements to server function handling and file path normalization to enhance system reliability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 17, 2025

Walkthrough

Server function ID generation in dev environments now normalizes trailing slashes via a helper function and adjusts file path computation to construct routes with leading slash prefixes. Concurrently, the fake manifest's getServerFnById function transitions from synchronous to asynchronous with a Promise return type.

Changes

Cohort / File(s) Summary
Server function path normalization
packages/server-functions-plugin/src/index.ts
Adds withTrailingSlash() helper for trailing slash normalization; updates generateFunctionId to compute root from serverDevEnv.config.root, strip root prefix from filename, and construct file path with leading slash (e.g., /@id...); updates serverFn.file accordingly
Fake manifest async transition
packages/start-server-core/src/fake-start-server-fn-manifest.ts
Changes getServerFnById from synchronous to asynchronous, updating signature to export async function getServerFnById(): Promise<any> {}

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Poem

🐰 With trailing slashes trimmed so neat,
And async paths that now compete,
The rabbit hops through routes divine,
Where /@id marks the dev-time line!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix: dev serverfn resolution on windows" directly relates to the primary change in the changeset. The modifications focus on updating how server function file paths are resolved in the server-dev environment, specifically by introducing path normalization logic (withTrailingSlash helper) and adjusting filename handling when computing the file identifier. The title is specific and meaningful—it indicates this is a bug fix for server function resolution in dev mode on Windows, which aligns with the source branch name "fix-serverfn-win" and the platform-specific path handling logic evident in the changes. A developer scanning the repository history would understand this addresses a Windows-specific issue with server function resolution during development.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-serverfn-win

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Oct 17, 2025

View your CI Pipeline Execution ↗ for commit f535282

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 4m 46s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 21s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-17 22:09:21 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 17, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5520

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5520

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5520

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5520

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5520

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5520

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5520

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5520

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5520

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5520

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5520

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5520

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5520

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5520

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5520

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5520

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5520

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5520

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5520

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5520

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5520

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5520

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5520

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5520

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5520

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5520

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5520

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5520

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5520

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5520

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5520

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5520

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5520

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5520

commit: f535282

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d8e105 and f535282.

📒 Files selected for processing (2)
  • packages/server-functions-plugin/src/index.ts (1 hunks)
  • packages/start-server-core/src/fake-start-server-fn-manifest.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • packages/start-server-core/src/fake-start-server-fn-manifest.ts
  • packages/server-functions-plugin/src/index.ts
packages/{*-start,start-*}/**

📄 CodeRabbit inference engine (AGENTS.md)

Name and place Start framework packages under packages/-start/ or packages/start-/

Files:

  • packages/start-server-core/src/fake-start-server-fn-manifest.ts
🧬 Code graph analysis (2)
packages/start-server-core/src/fake-start-server-fn-manifest.ts (1)
packages/start-server-core/src/getServerFnById.ts (1)
  • getServerFnById (1-1)
packages/server-functions-plugin/src/index.ts (1)
packages/directive-functions-plugin/src/compilers.ts (1)
  • GenerateFunctionIdFn (26-30)
⏰ 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: Preview
  • GitHub Check: Test
🔇 Additional comments (3)
packages/server-functions-plugin/src/index.ts (3)

71-76: LGTM! Clean helper for path normalization.

The withTrailingSlash helper correctly ensures a trailing slash on paths, which is essential for consistent path prefix matching on different platforms.


96-96: Correct application of normalized path.

Using the computed file value instead of extractedFilename ensures the server function receives the properly normalized path with the /@id prefix for module resolution.


83-91: Verify path normalization handles Windows edge cases.

The path normalization logic looks sound—using withTrailingSlash(root) for the prefix check while slicing by root.length (without trailing slash) correctly preserves the leading slash. However, please verify:

  1. Edge case: If extractedFilename equals root exactly, file becomes empty and line 90 produces "/@id/". Confirm this is handled appropriately.
  2. Windows paths: Ensure that both serverDevEnv.config.root and extractedFilename are normalized to forward slashes by Vite before this code runs, as mixing backslashes and forward slashes would break the startsWith check.

@@ -1 +1 @@
export function getServerFnById() {}
export async function getServerFnById(): Promise<any> {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Missing required parameter in function signature.

The fake implementation is missing the id parameter that the real implementation includes (see packages/server-functions-plugin/src/index.ts lines 191 and 211). Even though this is a stub, the signature should match to maintain type consistency and prevent runtime errors if this fake is accidentally invoked.

Apply this diff to fix the signature:

-export async function getServerFnById(): Promise<any> {}
+export async function getServerFnById(id: string): Promise<any> {}

Additionally, consider tightening the return type from Promise<any> to be more specific if the actual return type is known.

📝 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.

Suggested change
export async function getServerFnById(): Promise<any> {}
export async function getServerFnById(id: string): Promise<any> {}
🤖 Prompt for AI Agents
In packages/start-server-core/src/fake-start-server-fn-manifest.ts around line
1, the exported async function is missing the required id parameter present in
the real implementation; update the function signature to accept the same id
parameter (and any other parameters that the real implementation defines at
lines 191 and 211 in packages/server-functions-plugin/src/index.ts) so the stub
matches the real API, and tighten the return type from Promise<any> to the
actual return type if known (or to a more specific union/interface) to maintain
type consistency and avoid runtime/typing surprises.

@schiller-manuel schiller-manuel merged commit cf4f3e6 into main Oct 17, 2025
6 checks passed
@schiller-manuel schiller-manuel deleted the fix-serverfn-win branch October 17, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants