Skip to content

Conversation

@schiller-manuel
Copy link
Contributor

@schiller-manuel schiller-manuel commented Dec 25, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added middleware function metadata demonstration showcasing server and client metadata handling.
  • Tests

    • Added comprehensive test coverage validating middleware function metadata flow between client and server.
  • Documentation

    • Exported metadata types (ClientFnMeta, ServerFnMeta) for developer use.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 25, 2025

📝 Walkthrough

Walkthrough

This pull request refactors server function metadata handling by replacing scattered functionId and filename parameters with a structured serverFnMeta object containing id, name, and filename. Changes span type definitions, RPC creation, middleware options, compiler plugin logic, serialization adapters, and test snapshots, along with a new e2e test demonstrating middleware metadata flow.

Changes

Cohort / File(s) Summary
Type Definitions and Exports
packages/start-client-core/src/constants.ts, packages/start-client-core/src/index.tsx
Added new exported types ClientFnMeta (with id: string) and ServerFnMeta (extending ClientFnMeta with name and filename).
Middleware Interfaces
packages/start-client-core/src/createMiddleware.ts
Replaced separate functionId and filename fields with unified serverFnMeta: ServerFnMeta (server) and serverFnMeta: ClientFnMeta (client) in middleware option interfaces.
Client RPC
packages/start-client-core/src/client-rpc/createClientRpc.ts
Changed return value from exposing functionId directly to returning serverFnMeta: ClientFnMeta object with id extracted from functionId.
Client Serialization
packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts
Updated type predicate to recognize serverFnMeta: { id: string } instead of functionId, and modified serialization to extract id from serverFnMeta.
Server Function Creation
packages/start-client-core/src/createServerFn.ts
Added serverFnMeta: ServerFnMeta as required property on CompiledFetcherFn, propagated it into server execution context, and replaced functionId with serverFnMeta: ClientFnMeta in middleware options.
Server RPC & SSR RPC
packages/start-server-core/src/createServerRpc.ts, packages/start-server-core/src/createSsrRpc.ts
Updated createServerRpc signature to accept ServerFnMeta object instead of string functionId, and createSsrRpc now returns serverFnMeta property instead of functionId.
Server Serialization
packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts
Updated type guard to match serverFnMeta: { id: string }, modified toSerializable to extract id from serverFnMeta, and changed fromSerializable behavior.
Static Function Middleware
packages/start-static-server-functions/src/staticFunctionMiddleware.ts
Updated cache key references from ctx.functionId to ctx.serverFnMeta.id in two locations.
Compiler Plugin Handler
packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts
Replaced string-based functionId template usage with structured serverFnMeta object builder; generates metadata objects with id, name, and filename fields.
Compiler Plugin Tests
packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
Updated test expectations to reflect absolute file paths (/test/src/test.ts) and new object-based serverFnMeta construction in RPC generation.
Test Snapshots (Client)
packages/start-plugin-core/tests/createServerFn/snapshots/client/*.tsx
Updated createClientRpc payload strings across all handler variants to reflect new metadata structure (7 files affected).
Test Snapshots (Server Caller)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/*.tsx
Updated dynamic import paths to absolute (/test/src/test.ts) and createSsrRpc payloads to reflect new metadata handling (7 files affected).
Test Snapshots (Server Provider)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/*.tsx
Changed createServerRpc calls from string-based IDs to structured objects with id, name, and filename fields (7 files affected).
Route Metadata Examples
e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx, e2e/react-start/server-functions/src/routeTree.gen.ts
Added new e2e route demonstrating middleware metadata flow; route generator updated with new middleware function-metadata path and type mappings.
Middleware Index
e2e/react-start/server-functions/src/routes/middleware/index.tsx
Added new navigation link to function-metadata example with test identifier.
E2E Tests
e2e/react-start/server-functions/tests/server-functions.spec.ts
Added comprehensive test validating that client middleware receives partial serverFnMeta (id only) while server middleware receives full metadata (id, name, filename).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • chorobin

Poem

🐰 Hoppity-hop, the IDs now rest,
In structured objects, nested and blessed,
From flat strings to metadata trees,
Our middleware flows with newfound ease,
A refactor complete—what metadata feats!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% 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 title 'feat: add server fn meta' clearly describes the main change—introducing server function metadata throughout the codebase, which is the core objective of this PR.
✨ 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 serverfn-meta

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f46e9b and add0805.

📒 Files selected for processing (34)
  • e2e/react-start/server-functions/src/routeTree.gen.ts
  • e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx
  • e2e/react-start/server-functions/src/routes/middleware/index.tsx
  • e2e/react-start/server-functions/tests/server-functions.spec.ts
  • packages/start-client-core/src/client-rpc/createClientRpc.ts
  • packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts
  • packages/start-client-core/src/constants.ts
  • packages/start-client-core/src/createMiddleware.ts
  • packages/start-client-core/src/createServerFn.ts
  • packages/start-client-core/src/index.tsx
  • packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-server-core/src/createServerRpc.ts
  • packages/start-server-core/src/createSsrRpc.ts
  • packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts
  • packages/start-static-server-functions/src/staticFunctionMiddleware.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode with extensive type safety for all code

Files:

  • packages/start-client-core/src/constants.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsx
  • e2e/react-start/server-functions/src/routes/middleware/index.tsx
  • packages/start-static-server-functions/src/staticFunctionMiddleware.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx
  • e2e/react-start/server-functions/src/routeTree.gen.ts
  • e2e/react-start/server-functions/tests/server-functions.spec.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-server-core/src/createServerRpc.ts
  • packages/start-server-core/src/createSsrRpc.ts
  • packages/start-client-core/src/index.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-client-core/src/client-rpc/createClientRpc.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-client-core/src/createMiddleware.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx
  • e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-client-core/src/createServerFn.ts
  • packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx
  • packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Implement ESLint rules for router best practices using the ESLint plugin router

Files:

  • packages/start-client-core/src/constants.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsx
  • e2e/react-start/server-functions/src/routes/middleware/index.tsx
  • packages/start-static-server-functions/src/staticFunctionMiddleware.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx
  • e2e/react-start/server-functions/src/routeTree.gen.ts
  • e2e/react-start/server-functions/tests/server-functions.spec.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-server-core/src/createServerRpc.ts
  • packages/start-server-core/src/createSsrRpc.ts
  • packages/start-client-core/src/index.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-client-core/src/client-rpc/createClientRpc.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-client-core/src/createMiddleware.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx
  • e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-client-core/src/createServerFn.ts
  • packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx
  • packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx
🧠 Learnings (6)
📚 Learning: 2025-12-16T02:59:11.506Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 6104
File: packages/start-plugin-core/tests/split-exports-plugin/snapshots/exports/functionExports.ts:1-1
Timestamp: 2025-12-16T02:59:11.506Z
Learning: In transformation test snapshots (e.g., split-exports plugin), comments at the top of snapshot files often describe the original input scenario being tested (e.g., "Multiple function exports") rather than the transformed output in the snapshot itself. This helps document what transformation is being validated.

Applied to files:

  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx
📚 Learning: 2025-10-01T18:31:35.420Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5330
File: e2e/react-start/custom-basepath/src/routeTree.gen.ts:58-61
Timestamp: 2025-10-01T18:31:35.420Z
Learning: Do not review files named `routeTree.gen.ts` in TanStack Router repositories, as these are autogenerated files that should not be manually modified.

Applied to files:

  • e2e/react-start/server-functions/src/routeTree.gen.ts
📚 Learning: 2025-12-17T02:17:55.086Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 6120
File: packages/router-generator/src/generator.ts:654-657
Timestamp: 2025-12-17T02:17:55.086Z
Learning: In `packages/router-generator/src/generator.ts`, pathless_layout routes must receive a `path` property when they have a `cleanedPath`, even though they are non-path routes. This is necessary because child routes inherit the path from their parent, and without this property, child routes would not have the correct full path at runtime.

Applied to files:

  • e2e/react-start/server-functions/src/routeTree.gen.ts
📚 Learning: 2025-10-08T08:11:47.088Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5402
File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21
Timestamp: 2025-10-08T08:11:47.088Z
Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.

Applied to files:

  • e2e/react-start/server-functions/src/routeTree.gen.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
📚 Learning: 2025-09-28T21:41:45.233Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5284
File: e2e/react-start/basic/server.js:50-0
Timestamp: 2025-09-28T21:41:45.233Z
Learning: In Express v5, catch-all routes must use named wildcards. Use `/*splat` to match everything except root path, or `/{*splat}` (with braces) to match including root path. The old `*` syntax is not allowed and will cause "Missing parameter name" errors. This breaking change requires explicit naming of wildcard parameters.

Applied to files:

  • e2e/react-start/server-functions/src/routeTree.gen.ts
📚 Learning: 2025-11-02T16:16:24.898Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.

Applied to files:

  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-client-core/src/index.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
🧬 Code graph analysis (23)
e2e/react-start/server-functions/src/routes/middleware/index.tsx (2)
e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx (1)
  • Route (35-38)
e2e/react-start/server-functions/src/routes/middleware/middleware-factory.tsx (1)
  • Route (72-74)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (1)
packages/start-client-core/src/client-rpc/createClientRpc.ts (1)
  • createClientRpc (5-18)
packages/start-server-core/src/createServerRpc.ts (2)
packages/start-client-core/src/constants.ts (1)
  • ServerFnMeta (23-28)
packages/start-client-core/src/index.tsx (1)
  • ServerFnMeta (87-87)
packages/start-server-core/src/createSsrRpc.ts (5)
packages/start-client-core/src/createServerFn.ts (1)
  • ServerFn (316-324)
packages/start-client-core/src/index.tsx (2)
  • ServerFn (62-62)
  • ClientFnMeta (87-87)
packages/start-plugin-core/src/start-compiler-plugin/types.ts (1)
  • ServerFn (79-93)
packages/start-server-core/src/tanstack-start.d.ts (1)
  • ServerFn (14-14)
packages/start-client-core/src/constants.ts (1)
  • ClientFnMeta (14-17)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx (3)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx (3)
  • myAuthedFn (27-27)
  • createAuthServerFn (25-25)
  • deleteUserFn (28-28)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (3)
  • myAuthedFn (27-27)
  • createAuthServerFn (25-25)
  • deleteUserFn (28-28)
packages/start-client-core/src/client-rpc/createClientRpc.ts (3)
packages/start-client-core/src/constants.ts (1)
  • ClientFnMeta (14-17)
packages/start-client-core/src/index.tsx (1)
  • ClientFnMeta (87-87)
packages/start-client-core/src/client-rpc/serverFnFetcher.ts (1)
  • serverFnFetcher (20-106)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (2)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-client-core/src/createServerFn.ts (1)
  • createServerFn (53-176)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx (2)
packages/start-client-core/src/createServerFn.ts (1)
  • createServerFn (53-176)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-client-core/src/createMiddleware.ts (2)
packages/start-client-core/src/constants.ts (2)
  • ServerFnMeta (23-28)
  • ClientFnMeta (14-17)
packages/start-client-core/src/index.tsx (2)
  • ServerFnMeta (87-87)
  • ClientFnMeta (87-87)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx (6)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (1)
  • withUseServer (3-5)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx (1)
  • withUseServer (3-5)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (1)
  • withUseServer (4-6)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx (1)
  • withUseServer (3-5)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx (1)
  • withUseServer (3-5)
e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx (2)
packages/start-client-core/src/createMiddleware.ts (1)
  • createMiddleware (29-62)
packages/start-client-core/src/createServerFn.ts (1)
  • createServerFn (53-176)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx (1)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx (2)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (3)
  • withoutUseServer (13-15)
  • withVariable (16-18)
  • withZodValidator (19-21)
packages/start-client-core/src/createServerFn.ts (1)
packages/start-client-core/src/constants.ts (2)
  • ServerFnMeta (23-28)
  • ClientFnMeta (14-17)
packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts (2)
packages/start-client-core/src/constants.ts (1)
  • TSS_SERVER_FUNCTION (2-2)
packages/start-client-core/src/index.tsx (1)
  • TSS_SERVER_FUNCTION (83-83)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx (1)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx (2)
packages/start-client-core/src/createServerFn.ts (1)
  • createServerFn (53-176)
packages/start-client-core/src/client-rpc/createClientRpc.ts (1)
  • createClientRpc (5-18)
packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx (2)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (3)
  • myAuthedFn (27-27)
  • createAuthServerFn (25-25)
  • deleteUserFn (28-28)
packages/start-client-core/src/client-rpc/createClientRpc.ts (1)
  • createClientRpc (5-18)
packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts (2)
packages/start-client-core/src/constants.ts (1)
  • TSS_SERVER_FUNCTION (2-2)
packages/start-client-core/src/index.tsx (1)
  • TSS_SERVER_FUNCTION (83-83)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx (2)
packages/start-client-core/src/client-rpc/createClientRpc.ts (1)
  • createClientRpc (5-18)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (3)
  • withoutUseServer (12-14)
  • withVariable (15-17)
  • withZodValidator (18-20)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx (2)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (3)
  • withUseServer (4-6)
  • withoutUseServer (13-15)
  • withZodValidator (19-21)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (1)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx (1)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
⏰ 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: Test
  • GitHub Check: Preview
🔇 Additional comments (56)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx (2)

6-10: LGTM! Structured metadata transformation is correct.

The transformation properly converts the server function handler to use the new structured serverFnMeta object format with id, name, and filename properties. This aligns with the PR objectives to replace scattered parameters with a unified metadata object.


13-17: Consistent transformation pattern.

This second handler transformation follows the same correct pattern as the first, demonstrating that the plugin properly handles multiple server functions within a single file with consistent metadata structure.

packages/start-static-server-functions/src/staticFunctionMiddleware.ts (1)

136-136: LGTM! Refactoring is complete and properly typed.

The refactoring from ctx.functionId to ctx.serverFnMeta.id is consistent across both client and server middleware paths. Type definitions confirm that ServerFnMeta and ClientFnMeta properly expose the id property in the middleware context, and no remaining ctx.functionId usage exists in the codebase. The ID value format is preserved since it's sourced from the same metadata object.

packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts (5)

28-29: LGTM! Clear documentation of test setup.

Using an absolute path for test consistency is a good practice, and the comment clearly explains the reasoning.


125-149: Snapshots correctly updated to reflect the new API structure.

All inline snapshots have been consistently updated across client, server-caller, and server-provider scenarios:

  • Client: uses createClientRpc with encoded ID
  • Server-caller: uses createSsrRpc with encoded ID and dynamic import
  • Server-provider: uses createServerRpc with the new object structure

The changes are uniform and align well with the refactoring objectives.

Also applies to: 174-176, 188-190, 203-221


250-250: Consistent use of absolute paths in test setup.

The test cases correctly use the absolute path /test/src/test.ts, which is consistent with the changes in the compile helper function.

Also applies to: 301-301


316-320: Test expectations correctly updated for absolute paths.

The resolveId mock expectations are properly updated to use the absolute path /test/src/test.ts as the importer argument, which is consistent with the overall change to use absolute paths in tests.


142-146: No action required. The path handling is intentional and consistent.

The filename field uses a relative path (src/test.ts) by design, which is appropriate for middleware and runtime code that needs to reference the file. The test infrastructure path (/test/) and encoded ID prefix (/@id/) serve different purposes and do not represent inconsistencies. All snapshot files throughout the codebase confirm this is the expected behavior.

packages/start-client-core/src/constants.ts (1)

10-28: LGTM!

The new ClientFnMeta and ServerFnMeta interfaces are well-designed with clear separation of concerns—clients receive only the function ID while servers have access to full metadata (name, filename). The inheritance relationship is appropriate, and the JSDoc comments provide helpful context about compile-time embedding and security considerations.

packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx (1)

6-8: LGTM!

The snapshot correctly reflects the updated client-side compiled output. The createClientRpc calls receive the encoded function ID strings, which aligns with the client-only metadata approach (clients only get the ID, not full metadata).

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx (1)

6-8: LGTM!

The snapshot correctly reflects the SSR caller compiled output. The createSsrRpc calls receive the function ID string and an importer function, which aligns with the SSR RPC signature that uses ClientFnMeta internally (only containing the ID).

packages/start-client-core/src/index.tsx (1)

87-87: LGTM!

The type exports are correctly added to the public API surface. Using export type is appropriate for interfaces with no runtime component.

packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts (1)

8-15: LGTM!

The serialization adapter is correctly updated to work with the new serverFnMeta structure. The test type guard properly identifies server functions by their serverFnMeta.id property, and toSerializable correctly extracts the ID for serialization.

packages/start-client-core/src/createMiddleware.ts (3)

3-3: LGTM!

The import is correctly added for the new metadata types.


499-516: LGTM!

The FunctionMiddlewareServerFnOptions interface is correctly updated to use the structured serverFnMeta: ServerFnMeta type. Server middleware now has access to the full metadata (id, name, filename) through a single cohesive property.


601-612: LGTM!

The FunctionMiddlewareClientFnOptions interface correctly uses serverFnMeta: ClientFnMeta, which only exposes the function ID to client middleware. This aligns with the security consideration mentioned in the type definitions—client middleware should not have access to server internals like filename.

packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts (5)

15-33: LGTM!

The template updates correctly differentiate between provider files (which receive the full serverFnMeta object) and caller files (which only receive the functionId string). The comments clearly explain the purpose of each template.


120-134: LGTM!

The buildServerFnMetaObject helper is well-implemented. It creates a clean AST representation of the metadata object with id, name, and filename properties.


140-148: LGTM!

The generateProviderRpcStub function signature is correctly updated to accept the full serverFnMeta object expression for provider files.


150-185: LGTM!

The generateCallerRpcStub correctly continues to use only the functionId string for client and SSR callers. The added comment on line 153 clearly documents that callers only receive the function ID, not full metadata—maintaining the security boundary between client and server.


344-355: LGTM!

The provider file transformation correctly builds the serverFnMeta object with all three properties (id, name, filename) and passes it to the RPC stub generator. The variable naming is clear and the logic follows naturally from the helper function.

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx (1)

4-8: LGTM!

The snapshot correctly reflects the updated server-provider compiled output. The createServerRpc call now receives a structured metadata object with id, name, and filename properties, matching the ServerFnMeta interface. This provides server middleware with full context about the function being invoked.

packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsx (1)

1-6: LGTM - Snapshot correctly reflects serverFnMeta refactor.

The updated base64-encoded payload passed to createClientRpc aligns with the PR's objective to use structured metadata objects instead of string IDs. This snapshot documents the expected plugin transformation output.

packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx (1)

1-14: LGTM - Consistent snapshot updates across all handlers.

All four server function handlers (withUseServer, withoutUseServer, withVariable, withZodValidator) have been updated with new base64-encoded payloads, consistently reflecting the serverFnMeta refactor across the renamed import pattern.

packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx (1)

1-14: LGTM - Star import pattern snapshot properly updated.

All handlers have been consistently updated with new RPC payloads, correctly documenting the transformation for star import patterns (import * as TanStackStart).

e2e/react-start/server-functions/src/routes/middleware/index.tsx (1)

53-60: LGTM - Navigation link properly integrated.

The new link to the function-metadata route follows the established pattern and includes the appropriate data-testid for e2e testing. The label clearly describes the feature being tested.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx (1)

1-14: LGTM - Server-caller snapshot correctly updated.

The transition from relative to absolute import paths (/test/src/test.ts?tss-serverfn-split) along with updated RPC payloads consistently documents the expected server-caller transformation output.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (1)

1-24: LGTM - Comprehensive server-caller snapshot properly updated.

All seven handler variants have been consistently updated with absolute import paths and new RPC payloads, correctly documenting the expected transformation for the destructured import pattern.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx (1)

1-6: LGTM - Validator snapshot correctly updated.

The snapshot properly documents the transformation for server functions with validators, using absolute import paths and updated RPC payloads consistent with the serverFnMeta refactor.

packages/start-server-core/src/createServerRpc.ts (1)

1-17: LGTM - Type-safe refactor to structured metadata.

The transition from a string functionId parameter to a structured ServerFnMeta object improves type safety and enables richer metadata propagation (id, name, filename). The implementation correctly derives the URL from serverFnMeta.id and attaches the full metadata object for downstream consumers. All call sites have been properly updated to pass the structured ServerFnMeta object—no unmigrated code remains.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx (1)

5-14: LGTM! Test snapshot updates align with metadata refactoring.

The updated base64-encoded payloads in the createSsrRpc calls now contain structured metadata (id, name, filename) instead of just a function identifier. These snapshot changes correctly reflect the compiler plugin's new output format for server function registration.

Based on learnings, these test snapshots document the transformation being validated and should be auto-generated by the test suite.

packages/start-client-core/src/createServerFn.ts (4)

7-11: LGTM! Proper type imports for metadata refactoring.

The imports correctly bring in the new ClientFnMeta and ServerFnMeta types that structure the server function metadata. This aligns with the new typed metadata approach documented in packages/start-client-core/src/constants.ts.


143-146: LGTM! Clear explanation of metadata propagation.

The comment and code correctly ensure that the full ServerFnMeta (containing id, name, and filename) from the provider file's extractedFn is used in server execution, rather than the partial ClientFnMeta (containing only id) from SSR/client callers. This distinction is important for middleware that may need access to the function name or filename.


337-337: LGTM! Type signature correctly requires full metadata.

The CompiledFetcherFn type now requires serverFnMeta: ServerFnMeta, which provides the complete metadata (id, name, filename) needed for server-side execution and middleware.


615-615: LGTM! Middleware options use client-side metadata appropriately.

The ServerFnMiddlewareOptions correctly uses ClientFnMeta (containing only the id) rather than the full ServerFnMeta. This is appropriate since middleware executing on the client side only needs the function identifier to route requests.

packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (1)

5-23: LGTM! Client snapshot updates are consistent with metadata refactoring.

All createClientRpc calls have been updated with new base64-encoded payloads that encode the structured metadata format. The changes are applied consistently across all server function exports (withUseServer, withArrowFunction, withArrowFunctionAndFunction, withoutUseServer, withVariable, withZodValidator, withValidatorFn).

Based on learnings, test snapshots document the expected transformation output.

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx (2)

27-31: LGTM! Server RPC registration uses new structured metadata API.

The createServerRpc call now accepts a structured object with { id, name, filename } instead of a positional string parameter. This aligns with the new ServerFnMeta type and provides richer metadata for server-side execution and middleware.

The metadata structure correctly includes:

  • id: Base64-encoded identifier
  • name: Original function variable name ("myAuthedFn")
  • filename: Source file path ("src/test.ts")

35-39: LGTM! Consistent metadata structure for admin function.

The deleteUserFn handler follows the same structured metadata pattern, maintaining consistency across the codebase.

packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts (2)

7-7: LGTM! Type guard correctly checks for new metadata structure.

The type guard now checks for serverFnMeta: { id: string } instead of the old functionId: string, correctly identifying objects that follow the new metadata format.


14-15: LGTM! Serialization adapter bridges old and new formats.

The serialization logic correctly:

  • Extracts the id from serverFnMeta for the wire format (toSerializable)
  • Reconstructs the client RPC using the extracted functionId (fromSerializable)

This maintains wire format compatibility while using the new structured metadata internally.

packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx (1)

27-28: LGTM! Factory snapshot updates align with metadata refactoring.

The createClientRpc calls for myAuthedFn and deleteUserFn have been updated with new base64-encoded payloads that reflect the structured metadata format. These changes are consistent with the broader refactoring.

Based on learnings, test snapshots document the expected compiler plugin transformation output.

packages/start-server-core/src/createSsrRpc.ts (3)

2-2: LGTM! Proper type import for SSR RPC metadata.

The import of ClientFnMeta is appropriate since SSR RPCs are created from encoded payloads that only contain the function id, not the full metadata with name and filename.


10-10: LGTM! SSR RPC correctly uses client-side metadata.

Creating a ClientFnMeta object with just the id is appropriate for SSR RPCs, which are instantiated from encoded identifiers without access to the full ServerFnMeta (name and filename) available on the provider side.


23-23: LGTM! API updated to expose structured metadata.

The returned object now exposes serverFnMeta instead of a bare functionId, making the API consistent with other RPC creation functions and providing a structured interface for accessing function metadata.

packages/start-client-core/src/client-rpc/createClientRpc.ts (3)

2-2: LGTM! Proper type import for client RPC metadata.

The import of ClientFnMeta is appropriate for client-side RPC creation, which only has access to the function identifier.


7-7: LGTM! Client RPC uses appropriate metadata structure.

Creating a ClientFnMeta object with the function id is correct for client-side RPC creation. The client side only needs the identifier to route requests to the server.


15-15: LGTM! Consistent API surface across RPC creation functions.

The returned object now exposes serverFnMeta instead of functionId, maintaining API consistency with createSsrRpc and other RPC creation functions. This provides a uniform interface for accessing function metadata across different RPC types.

e2e/react-start/server-functions/tests/server-functions.spec.ts (1)

668-749: LGTM! Comprehensive test for serverFnMeta middleware flow.

The test properly validates that:

  • Server middleware receives full serverFnMeta (id, name, filename)
  • Client middleware receives only the id
  • Metadata flows correctly through sendContext
  • Both SSR and client-side invocations work as expected
e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx (3)

5-20: LGTM! Middleware correctly captures and forwards serverFnMeta.

The implementation properly demonstrates the metadata flow:

  • Client middleware captures serverFnMeta and sends via sendContext
  • Server middleware receives both server-side serverFnMeta and client-captured metadata
  • Pattern aligns with the createMiddleware API

89-90: Type assertions acceptable for test demonstration.

The (as any) casts are intentionally used to access name and filename properties that should be undefined at runtime on the client side. The fallback to 'undefined' string ensures proper display in the test UI.

This pattern is appropriate for a test route that demonstrates runtime behavior, though in production code, proper type guards would be preferable.

Also applies to: 96-97, 147-149, 154-156


23-33: LGTM! Server function correctly returns captured metadata.

The handler properly returns both server-captured and client-captured metadata from the context, with clear comments explaining the client middleware limitations.

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx (1)

4-8: LGTM! Snapshot correctly reflects the serverFnMeta transformation.

The compiler transformation consistently updates all createServerRpc calls to use the structured object form with id, name, and filename fields, replacing the previous string-based ID approach. This aligns with the PR's goal of providing richer metadata for server functions.

Also applies to: 16-20, 28-32, 46-50

e2e/react-start/server-functions/src/routeTree.gen.ts (1)

1-10: Skipping review of autogenerated file.

This file is automatically generated by TanStack Router and should not be manually modified or reviewed.

Based on learnings, routeTree.gen.ts files are excluded from review.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (1)

27-28: LGTM! Snapshot correctly reflects absolute import path transformation.

The transformation from relative to absolute import paths (/test/src/test.ts?tss-serverfn-split) improves clarity and is consistently applied to both server function registrations. The RPC payload strings are updated accordingly.

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx (1)

4-8: LGTM! Snapshot correctly handles star import transformation.

The compiler transformation correctly applies the serverFnMeta object structure even when using star import syntax (import * as TanStackStart). All handlers are consistently updated to use { id, name, filename } in their createServerRpc calls.

Also applies to: 18-22, 30-34, 48-52

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx (1)

4-8: LGTM! Comprehensive snapshot demonstrates consistent transformation across handler patterns.

The compiler transformation correctly applies the serverFnMeta object structure ({ id, name, filename }) to all seven server function handlers, regardless of their implementation style (async function, arrow function, abstracted function, validators). This demonstrates robust handling of various syntax patterns.

Also applies to: 16-20, 24-28, 32-36, 44-48, 62-66, 74-78


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

@nx-cloud
Copy link

nx-cloud bot commented Dec 25, 2025

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit add0805

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ❌ Failed 18m 3s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 40s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-25 11:10:54 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 25, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6213

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6213

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6213

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: add0805

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts (1)

16-26: Remove the as never type assertion and provide explicit typing for the returned function.

The as never cast violates TanStack Router's type safety practices and masks real type mismatches at call sites. According to TanStack Router patterns, the proper approach is to either ensure the return type is correctly inferred or provide an explicit, specific type assertion rather than never.

Consider either:

  1. Properly type the fn function with a specific interface/type that matches what callers expect (e.g., ServerFunction<any, any>)
  2. Use a more specific type assertion that reflects the actual callable signature instead of never

Also verify: Was the createServerRpc(functionId, fn) wrapper intentionally removed from this location? If it previously added properties like url, serverFnMeta, or a TSS_SERVER_FUNCTION symbol that downstream consumers depend on, its removal may break those expectations.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f46e9b and add0805.

📒 Files selected for processing (34)
  • e2e/react-start/server-functions/src/routeTree.gen.ts
  • e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx
  • e2e/react-start/server-functions/src/routes/middleware/index.tsx
  • e2e/react-start/server-functions/tests/server-functions.spec.ts
  • packages/start-client-core/src/client-rpc/createClientRpc.ts
  • packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts
  • packages/start-client-core/src/constants.ts
  • packages/start-client-core/src/createMiddleware.ts
  • packages/start-client-core/src/createServerFn.ts
  • packages/start-client-core/src/index.tsx
  • packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-server-core/src/createServerRpc.ts
  • packages/start-server-core/src/createSsrRpc.ts
  • packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts
  • packages/start-static-server-functions/src/staticFunctionMiddleware.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode with extensive type safety for all code

Files:

  • packages/start-client-core/src/constants.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsx
  • e2e/react-start/server-functions/src/routes/middleware/index.tsx
  • packages/start-static-server-functions/src/staticFunctionMiddleware.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx
  • e2e/react-start/server-functions/src/routeTree.gen.ts
  • e2e/react-start/server-functions/tests/server-functions.spec.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-server-core/src/createServerRpc.ts
  • packages/start-server-core/src/createSsrRpc.ts
  • packages/start-client-core/src/index.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-client-core/src/client-rpc/createClientRpc.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-client-core/src/createMiddleware.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx
  • e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-client-core/src/createServerFn.ts
  • packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx
  • packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Implement ESLint rules for router best practices using the ESLint plugin router

Files:

  • packages/start-client-core/src/constants.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsx
  • e2e/react-start/server-functions/src/routes/middleware/index.tsx
  • packages/start-static-server-functions/src/staticFunctionMiddleware.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx
  • e2e/react-start/server-functions/src/routeTree.gen.ts
  • e2e/react-start/server-functions/tests/server-functions.spec.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-server-core/src/createServerRpc.ts
  • packages/start-server-core/src/createSsrRpc.ts
  • packages/start-client-core/src/index.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-client-core/src/client-rpc/createClientRpc.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-client-core/src/createMiddleware.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx
  • e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-client-core/src/createServerFn.ts
  • packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx
  • packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx
🧠 Learnings (6)
📚 Learning: 2025-12-16T02:59:11.506Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 6104
File: packages/start-plugin-core/tests/split-exports-plugin/snapshots/exports/functionExports.ts:1-1
Timestamp: 2025-12-16T02:59:11.506Z
Learning: In transformation test snapshots (e.g., split-exports plugin), comments at the top of snapshot files often describe the original input scenario being tested (e.g., "Multiple function exports") rather than the transformed output in the snapshot itself. This helps document what transformation is being validated.

Applied to files:

  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx
📚 Learning: 2025-10-01T18:31:35.420Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5330
File: e2e/react-start/custom-basepath/src/routeTree.gen.ts:58-61
Timestamp: 2025-10-01T18:31:35.420Z
Learning: Do not review files named `routeTree.gen.ts` in TanStack Router repositories, as these are autogenerated files that should not be manually modified.

Applied to files:

  • e2e/react-start/server-functions/src/routeTree.gen.ts
📚 Learning: 2025-12-17T02:17:55.086Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 6120
File: packages/router-generator/src/generator.ts:654-657
Timestamp: 2025-12-17T02:17:55.086Z
Learning: In `packages/router-generator/src/generator.ts`, pathless_layout routes must receive a `path` property when they have a `cleanedPath`, even though they are non-path routes. This is necessary because child routes inherit the path from their parent, and without this property, child routes would not have the correct full path at runtime.

Applied to files:

  • e2e/react-start/server-functions/src/routeTree.gen.ts
📚 Learning: 2025-10-08T08:11:47.088Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5402
File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21
Timestamp: 2025-10-08T08:11:47.088Z
Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.

Applied to files:

  • e2e/react-start/server-functions/src/routeTree.gen.ts
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
📚 Learning: 2025-09-28T21:41:45.233Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5284
File: e2e/react-start/basic/server.js:50-0
Timestamp: 2025-09-28T21:41:45.233Z
Learning: In Express v5, catch-all routes must use named wildcards. Use `/*splat` to match everything except root path, or `/{*splat}` (with braces) to match including root path. The old `*` syntax is not allowed and will cause "Missing parameter name" errors. This breaking change requires explicit naming of wildcard parameters.

Applied to files:

  • e2e/react-start/server-functions/src/routeTree.gen.ts
📚 Learning: 2025-11-02T16:16:24.898Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.

Applied to files:

  • packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx
  • packages/start-client-core/src/index.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx
  • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx
  • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
🧬 Code graph analysis (23)
e2e/react-start/server-functions/src/routes/middleware/index.tsx (2)
e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx (1)
  • Route (35-38)
e2e/react-start/server-functions/src/routes/middleware/middleware-factory.tsx (1)
  • Route (72-74)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (1)
packages/start-client-core/src/client-rpc/createClientRpc.ts (1)
  • createClientRpc (5-18)
packages/start-server-core/src/createServerRpc.ts (2)
packages/start-client-core/src/constants.ts (1)
  • ServerFnMeta (23-28)
packages/start-client-core/src/index.tsx (1)
  • ServerFnMeta (87-87)
packages/start-server-core/src/createSsrRpc.ts (5)
packages/start-client-core/src/createServerFn.ts (1)
  • ServerFn (316-324)
packages/start-client-core/src/index.tsx (2)
  • ServerFn (62-62)
  • ClientFnMeta (87-87)
packages/start-plugin-core/src/start-compiler-plugin/types.ts (1)
  • ServerFn (79-93)
packages/start-server-core/src/tanstack-start.d.ts (1)
  • ServerFn (14-14)
packages/start-client-core/src/constants.ts (1)
  • ClientFnMeta (14-17)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx (3)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx (3)
  • myAuthedFn (27-27)
  • createAuthServerFn (25-25)
  • deleteUserFn (28-28)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (3)
  • myAuthedFn (27-27)
  • createAuthServerFn (25-25)
  • deleteUserFn (28-28)
packages/start-client-core/src/client-rpc/createClientRpc.ts (3)
packages/start-client-core/src/constants.ts (1)
  • ClientFnMeta (14-17)
packages/start-client-core/src/index.tsx (1)
  • ClientFnMeta (87-87)
packages/start-client-core/src/client-rpc/serverFnFetcher.ts (1)
  • serverFnFetcher (20-106)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (2)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-client-core/src/createServerFn.ts (1)
  • createServerFn (53-176)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx (2)
packages/start-client-core/src/createServerFn.ts (1)
  • createServerFn (53-176)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-client-core/src/createMiddleware.ts (2)
packages/start-client-core/src/constants.ts (2)
  • ServerFnMeta (23-28)
  • ClientFnMeta (14-17)
packages/start-client-core/src/index.tsx (2)
  • ServerFnMeta (87-87)
  • ClientFnMeta (87-87)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx (6)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (1)
  • withUseServer (3-5)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx (1)
  • withUseServer (3-5)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (1)
  • withUseServer (4-6)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx (1)
  • withUseServer (3-5)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx (1)
  • withUseServer (3-5)
e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx (2)
packages/start-client-core/src/createMiddleware.ts (1)
  • createMiddleware (29-62)
packages/start-client-core/src/createServerFn.ts (1)
  • createServerFn (53-176)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx (1)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx (2)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (3)
  • withoutUseServer (13-15)
  • withVariable (16-18)
  • withZodValidator (19-21)
packages/start-client-core/src/createServerFn.ts (1)
packages/start-client-core/src/constants.ts (2)
  • ServerFnMeta (23-28)
  • ClientFnMeta (14-17)
packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts (2)
packages/start-client-core/src/constants.ts (1)
  • TSS_SERVER_FUNCTION (2-2)
packages/start-client-core/src/index.tsx (1)
  • TSS_SERVER_FUNCTION (83-83)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx (1)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx (2)
packages/start-client-core/src/createServerFn.ts (1)
  • createServerFn (53-176)
packages/start-client-core/src/client-rpc/createClientRpc.ts (1)
  • createClientRpc (5-18)
packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx (2)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (3)
  • myAuthedFn (27-27)
  • createAuthServerFn (25-25)
  • deleteUserFn (28-28)
packages/start-client-core/src/client-rpc/createClientRpc.ts (1)
  • createClientRpc (5-18)
packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts (2)
packages/start-client-core/src/constants.ts (1)
  • TSS_SERVER_FUNCTION (2-2)
packages/start-client-core/src/index.tsx (1)
  • TSS_SERVER_FUNCTION (83-83)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx (2)
packages/start-client-core/src/client-rpc/createClientRpc.ts (1)
  • createClientRpc (5-18)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (3)
  • withoutUseServer (12-14)
  • withVariable (15-17)
  • withZodValidator (18-20)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx (2)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (3)
  • withUseServer (4-6)
  • withoutUseServer (13-15)
  • withZodValidator (19-21)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (1)
packages/start-server-core/src/createSsrRpc.ts (1)
  • createSsrRpc (8-26)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx (1)
packages/start-server-core/src/createServerRpc.ts (1)
  • createServerRpc (6-17)
⏰ 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: Test
  • GitHub Check: Preview
🔇 Additional comments (56)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx (2)

6-10: LGTM! Structured metadata transformation is correct.

The transformation properly converts the server function handler to use the new structured serverFnMeta object format with id, name, and filename properties. This aligns with the PR objectives to replace scattered parameters with a unified metadata object.


13-17: Consistent transformation pattern.

This second handler transformation follows the same correct pattern as the first, demonstrating that the plugin properly handles multiple server functions within a single file with consistent metadata structure.

packages/start-static-server-functions/src/staticFunctionMiddleware.ts (1)

136-136: LGTM! Refactoring is complete and properly typed.

The refactoring from ctx.functionId to ctx.serverFnMeta.id is consistent across both client and server middleware paths. Type definitions confirm that ServerFnMeta and ClientFnMeta properly expose the id property in the middleware context, and no remaining ctx.functionId usage exists in the codebase. The ID value format is preserved since it's sourced from the same metadata object.

packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts (5)

28-29: LGTM! Clear documentation of test setup.

Using an absolute path for test consistency is a good practice, and the comment clearly explains the reasoning.


125-149: Snapshots correctly updated to reflect the new API structure.

All inline snapshots have been consistently updated across client, server-caller, and server-provider scenarios:

  • Client: uses createClientRpc with encoded ID
  • Server-caller: uses createSsrRpc with encoded ID and dynamic import
  • Server-provider: uses createServerRpc with the new object structure

The changes are uniform and align well with the refactoring objectives.

Also applies to: 174-176, 188-190, 203-221


250-250: Consistent use of absolute paths in test setup.

The test cases correctly use the absolute path /test/src/test.ts, which is consistent with the changes in the compile helper function.

Also applies to: 301-301


316-320: Test expectations correctly updated for absolute paths.

The resolveId mock expectations are properly updated to use the absolute path /test/src/test.ts as the importer argument, which is consistent with the overall change to use absolute paths in tests.


142-146: No action required. The path handling is intentional and consistent.

The filename field uses a relative path (src/test.ts) by design, which is appropriate for middleware and runtime code that needs to reference the file. The test infrastructure path (/test/) and encoded ID prefix (/@id/) serve different purposes and do not represent inconsistencies. All snapshot files throughout the codebase confirm this is the expected behavior.

packages/start-client-core/src/constants.ts (1)

10-28: LGTM!

The new ClientFnMeta and ServerFnMeta interfaces are well-designed with clear separation of concerns—clients receive only the function ID while servers have access to full metadata (name, filename). The inheritance relationship is appropriate, and the JSDoc comments provide helpful context about compile-time embedding and security considerations.

packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx (1)

6-8: LGTM!

The snapshot correctly reflects the updated client-side compiled output. The createClientRpc calls receive the encoded function ID strings, which aligns with the client-only metadata approach (clients only get the ID, not full metadata).

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx (1)

6-8: LGTM!

The snapshot correctly reflects the SSR caller compiled output. The createSsrRpc calls receive the function ID string and an importer function, which aligns with the SSR RPC signature that uses ClientFnMeta internally (only containing the ID).

packages/start-client-core/src/index.tsx (1)

87-87: LGTM!

The type exports are correctly added to the public API surface. Using export type is appropriate for interfaces with no runtime component.

packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts (1)

8-15: LGTM!

The serialization adapter is correctly updated to work with the new serverFnMeta structure. The test type guard properly identifies server functions by their serverFnMeta.id property, and toSerializable correctly extracts the ID for serialization.

packages/start-client-core/src/createMiddleware.ts (3)

3-3: LGTM!

The import is correctly added for the new metadata types.


499-516: LGTM!

The FunctionMiddlewareServerFnOptions interface is correctly updated to use the structured serverFnMeta: ServerFnMeta type. Server middleware now has access to the full metadata (id, name, filename) through a single cohesive property.


601-612: LGTM!

The FunctionMiddlewareClientFnOptions interface correctly uses serverFnMeta: ClientFnMeta, which only exposes the function ID to client middleware. This aligns with the security consideration mentioned in the type definitions—client middleware should not have access to server internals like filename.

packages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.ts (5)

15-33: LGTM!

The template updates correctly differentiate between provider files (which receive the full serverFnMeta object) and caller files (which only receive the functionId string). The comments clearly explain the purpose of each template.


120-134: LGTM!

The buildServerFnMetaObject helper is well-implemented. It creates a clean AST representation of the metadata object with id, name, and filename properties.


140-148: LGTM!

The generateProviderRpcStub function signature is correctly updated to accept the full serverFnMeta object expression for provider files.


150-185: LGTM!

The generateCallerRpcStub correctly continues to use only the functionId string for client and SSR callers. The added comment on line 153 clearly documents that callers only receive the function ID, not full metadata—maintaining the security boundary between client and server.


344-355: LGTM!

The provider file transformation correctly builds the serverFnMeta object with all three properties (id, name, filename) and passes it to the RPC stub generator. The variable naming is clear and the logic follows naturally from the helper function.

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx (1)

4-8: LGTM!

The snapshot correctly reflects the updated server-provider compiled output. The createServerRpc call now receives a structured metadata object with id, name, and filename properties, matching the ServerFnMeta interface. This provides server middleware with full context about the function being invoked.

packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsx (1)

1-6: LGTM - Snapshot correctly reflects serverFnMeta refactor.

The updated base64-encoded payload passed to createClientRpc aligns with the PR's objective to use structured metadata objects instead of string IDs. This snapshot documents the expected plugin transformation output.

packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx (1)

1-14: LGTM - Consistent snapshot updates across all handlers.

All four server function handlers (withUseServer, withoutUseServer, withVariable, withZodValidator) have been updated with new base64-encoded payloads, consistently reflecting the serverFnMeta refactor across the renamed import pattern.

packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsx (1)

1-14: LGTM - Star import pattern snapshot properly updated.

All handlers have been consistently updated with new RPC payloads, correctly documenting the transformation for star import patterns (import * as TanStackStart).

e2e/react-start/server-functions/src/routes/middleware/index.tsx (1)

53-60: LGTM - Navigation link properly integrated.

The new link to the function-metadata route follows the established pattern and includes the appropriate data-testid for e2e testing. The label clearly describes the feature being tested.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx (1)

1-14: LGTM - Server-caller snapshot correctly updated.

The transition from relative to absolute import paths (/test/src/test.ts?tss-serverfn-split) along with updated RPC payloads consistently documents the expected server-caller transformation output.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (1)

1-24: LGTM - Comprehensive server-caller snapshot properly updated.

All seven handler variants have been consistently updated with absolute import paths and new RPC payloads, correctly documenting the expected transformation for the destructured import pattern.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx (1)

1-6: LGTM - Validator snapshot correctly updated.

The snapshot properly documents the transformation for server functions with validators, using absolute import paths and updated RPC payloads consistent with the serverFnMeta refactor.

packages/start-server-core/src/createServerRpc.ts (1)

1-17: LGTM - Type-safe refactor to structured metadata.

The transition from a string functionId parameter to a structured ServerFnMeta object improves type safety and enables richer metadata propagation (id, name, filename). The implementation correctly derives the URL from serverFnMeta.id and attaches the full metadata object for downstream consumers. All call sites have been properly updated to pass the structured ServerFnMeta object—no unmigrated code remains.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsx (1)

5-14: LGTM! Test snapshot updates align with metadata refactoring.

The updated base64-encoded payloads in the createSsrRpc calls now contain structured metadata (id, name, filename) instead of just a function identifier. These snapshot changes correctly reflect the compiler plugin's new output format for server function registration.

Based on learnings, these test snapshots document the transformation being validated and should be auto-generated by the test suite.

packages/start-client-core/src/createServerFn.ts (4)

7-11: LGTM! Proper type imports for metadata refactoring.

The imports correctly bring in the new ClientFnMeta and ServerFnMeta types that structure the server function metadata. This aligns with the new typed metadata approach documented in packages/start-client-core/src/constants.ts.


143-146: LGTM! Clear explanation of metadata propagation.

The comment and code correctly ensure that the full ServerFnMeta (containing id, name, and filename) from the provider file's extractedFn is used in server execution, rather than the partial ClientFnMeta (containing only id) from SSR/client callers. This distinction is important for middleware that may need access to the function name or filename.


337-337: LGTM! Type signature correctly requires full metadata.

The CompiledFetcherFn type now requires serverFnMeta: ServerFnMeta, which provides the complete metadata (id, name, filename) needed for server-side execution and middleware.


615-615: LGTM! Middleware options use client-side metadata appropriately.

The ServerFnMiddlewareOptions correctly uses ClientFnMeta (containing only the id) rather than the full ServerFnMeta. This is appropriate since middleware executing on the client side only needs the function identifier to route requests.

packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (1)

5-23: LGTM! Client snapshot updates are consistent with metadata refactoring.

All createClientRpc calls have been updated with new base64-encoded payloads that encode the structured metadata format. The changes are applied consistently across all server function exports (withUseServer, withArrowFunction, withArrowFunctionAndFunction, withoutUseServer, withVariable, withZodValidator, withValidatorFn).

Based on learnings, test snapshots document the expected transformation output.

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx (2)

27-31: LGTM! Server RPC registration uses new structured metadata API.

The createServerRpc call now accepts a structured object with { id, name, filename } instead of a positional string parameter. This aligns with the new ServerFnMeta type and provides richer metadata for server-side execution and middleware.

The metadata structure correctly includes:

  • id: Base64-encoded identifier
  • name: Original function variable name ("myAuthedFn")
  • filename: Source file path ("src/test.ts")

35-39: LGTM! Consistent metadata structure for admin function.

The deleteUserFn handler follows the same structured metadata pattern, maintaining consistency across the codebase.

packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts (2)

7-7: LGTM! Type guard correctly checks for new metadata structure.

The type guard now checks for serverFnMeta: { id: string } instead of the old functionId: string, correctly identifying objects that follow the new metadata format.


14-15: LGTM! Serialization adapter bridges old and new formats.

The serialization logic correctly:

  • Extracts the id from serverFnMeta for the wire format (toSerializable)
  • Reconstructs the client RPC using the extracted functionId (fromSerializable)

This maintains wire format compatibility while using the new structured metadata internally.

packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx (1)

27-28: LGTM! Factory snapshot updates align with metadata refactoring.

The createClientRpc calls for myAuthedFn and deleteUserFn have been updated with new base64-encoded payloads that reflect the structured metadata format. These changes are consistent with the broader refactoring.

Based on learnings, test snapshots document the expected compiler plugin transformation output.

packages/start-server-core/src/createSsrRpc.ts (3)

2-2: LGTM! Proper type import for SSR RPC metadata.

The import of ClientFnMeta is appropriate since SSR RPCs are created from encoded payloads that only contain the function id, not the full metadata with name and filename.


10-10: LGTM! SSR RPC correctly uses client-side metadata.

Creating a ClientFnMeta object with just the id is appropriate for SSR RPCs, which are instantiated from encoded identifiers without access to the full ServerFnMeta (name and filename) available on the provider side.


23-23: LGTM! API updated to expose structured metadata.

The returned object now exposes serverFnMeta instead of a bare functionId, making the API consistent with other RPC creation functions and providing a structured interface for accessing function metadata.

packages/start-client-core/src/client-rpc/createClientRpc.ts (3)

2-2: LGTM! Proper type import for client RPC metadata.

The import of ClientFnMeta is appropriate for client-side RPC creation, which only has access to the function identifier.


7-7: LGTM! Client RPC uses appropriate metadata structure.

Creating a ClientFnMeta object with the function id is correct for client-side RPC creation. The client side only needs the identifier to route requests to the server.


15-15: LGTM! Consistent API surface across RPC creation functions.

The returned object now exposes serverFnMeta instead of functionId, maintaining API consistency with createSsrRpc and other RPC creation functions. This provides a uniform interface for accessing function metadata across different RPC types.

e2e/react-start/server-functions/tests/server-functions.spec.ts (1)

668-749: LGTM! Comprehensive test for serverFnMeta middleware flow.

The test properly validates that:

  • Server middleware receives full serverFnMeta (id, name, filename)
  • Client middleware receives only the id
  • Metadata flows correctly through sendContext
  • Both SSR and client-side invocations work as expected
e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx (3)

5-20: LGTM! Middleware correctly captures and forwards serverFnMeta.

The implementation properly demonstrates the metadata flow:

  • Client middleware captures serverFnMeta and sends via sendContext
  • Server middleware receives both server-side serverFnMeta and client-captured metadata
  • Pattern aligns with the createMiddleware API

89-90: Type assertions acceptable for test demonstration.

The (as any) casts are intentionally used to access name and filename properties that should be undefined at runtime on the client side. The fallback to 'undefined' string ensures proper display in the test UI.

This pattern is appropriate for a test route that demonstrates runtime behavior, though in production code, proper type guards would be preferable.

Also applies to: 96-97, 147-149, 154-156


23-33: LGTM! Server function correctly returns captured metadata.

The handler properly returns both server-captured and client-captured metadata from the context, with clear comments explaining the client middleware limitations.

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx (1)

4-8: LGTM! Snapshot correctly reflects the serverFnMeta transformation.

The compiler transformation consistently updates all createServerRpc calls to use the structured object form with id, name, and filename fields, replacing the previous string-based ID approach. This aligns with the PR's goal of providing richer metadata for server functions.

Also applies to: 16-20, 28-32, 46-50

e2e/react-start/server-functions/src/routeTree.gen.ts (1)

1-10: Skipping review of autogenerated file.

This file is automatically generated by TanStack Router and should not be manually modified or reviewed.

Based on learnings, routeTree.gen.ts files are excluded from review.

packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (1)

27-28: LGTM! Snapshot correctly reflects absolute import path transformation.

The transformation from relative to absolute import paths (/test/src/test.ts?tss-serverfn-split) improves clarity and is consistently applied to both server function registrations. The RPC payload strings are updated accordingly.

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsx (1)

4-8: LGTM! Snapshot correctly handles star import transformation.

The compiler transformation correctly applies the serverFnMeta object structure even when using star import syntax (import * as TanStackStart). All handlers are consistently updated to use { id, name, filename } in their createServerRpc calls.

Also applies to: 18-22, 30-34, 48-52

packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx (1)

4-8: LGTM! Comprehensive snapshot demonstrates consistent transformation across handler patterns.

The compiler transformation correctly applies the serverFnMeta object structure ({ id, name, filename }) to all seven server function handlers, regardless of their implementation style (async function, arrow function, abstracted function, validators). This demonstrates robust handling of various syntax patterns.

Also applies to: 16-20, 24-28, 32-36, 44-48, 62-66, 74-78

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