-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add server fn meta #6213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add server fn meta #6213
Conversation
📝 WalkthroughWalkthroughThis pull request refactors server function metadata handling by replacing scattered Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (34)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{js,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (6)📚 Learning: 2025-12-16T02:59:11.506ZApplied to files:
📚 Learning: 2025-10-01T18:31:35.420ZApplied to files:
📚 Learning: 2025-12-17T02:17:55.086ZApplied to files:
📚 Learning: 2025-10-08T08:11:47.088ZApplied to files:
📚 Learning: 2025-09-28T21:41:45.233ZApplied to files:
📚 Learning: 2025-11-02T16:16:24.898ZApplied to files:
🧬 Code graph analysis (23)e2e/react-start/server-functions/src/routes/middleware/index.tsx (2)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsx (1)
packages/start-server-core/src/createServerRpc.ts (2)
packages/start-server-core/src/createSsrRpc.ts (5)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsx (3)
packages/start-client-core/src/client-rpc/createClientRpc.ts (3)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsx (2)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsx (2)
packages/start-client-core/src/createMiddleware.ts (2)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsx (6)
e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx (2)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsx (1)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsx (2)
packages/start-client-core/src/createServerFn.ts (1)
packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts (2)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsx (1)
packages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsx (2)
packages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsx (2)
packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts (2)
packages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsx (2)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsx (2)
packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsx (1)
packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsx (1)
⏰ 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)
🔇 Additional comments (56)
Comment |
|
| 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
There was a problem hiding this 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 theas nevertype assertion and provide explicit typing for the returned function.The
as nevercast 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 thannever.Consider either:
- Properly type the
fnfunction with a specific interface/type that matches what callers expect (e.g.,ServerFunction<any, any>)- Use a more specific type assertion that reflects the actual callable signature instead of
neverAlso verify: Was the
createServerRpc(functionId, fn)wrapper intentionally removed from this location? If it previously added properties likeurl,serverFnMeta, or aTSS_SERVER_FUNCTIONsymbol that downstream consumers depend on, its removal may break those expectations.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (34)
e2e/react-start/server-functions/src/routeTree.gen.tse2e/react-start/server-functions/src/routes/middleware/function-metadata.tsxe2e/react-start/server-functions/src/routes/middleware/index.tsxe2e/react-start/server-functions/tests/server-functions.spec.tspackages/start-client-core/src/client-rpc/createClientRpc.tspackages/start-client-core/src/client/ServerFunctionSerializationAdapter.tspackages/start-client-core/src/constants.tspackages/start-client-core/src/createMiddleware.tspackages/start-client-core/src/createServerFn.tspackages/start-client-core/src/index.tsxpackages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.tspackages/start-plugin-core/tests/createServerFn/createServerFn.test.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructured.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsxpackages/start-server-core/src/createServerRpc.tspackages/start-server-core/src/createSsrRpc.tspackages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.tspackages/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.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsxe2e/react-start/server-functions/src/routes/middleware/index.tsxpackages/start-static-server-functions/src/staticFunctionMiddleware.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsxe2e/react-start/server-functions/src/routeTree.gen.tse2e/react-start/server-functions/tests/server-functions.spec.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsxpackages/start-server-core/src/createServerRpc.tspackages/start-server-core/src/createSsrRpc.tspackages/start-client-core/src/index.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsxpackages/start-client-core/src/client-rpc/createClientRpc.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsxpackages/start-client-core/src/createMiddleware.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsxe2e/react-start/server-functions/src/routes/middleware/function-metadata.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsxpackages/start-client-core/src/createServerFn.tspackages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsxpackages/start-client-core/src/client/ServerFunctionSerializationAdapter.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsxpackages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.tspackages/start-plugin-core/tests/createServerFn/createServerFn.test.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsxpackages/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.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnValidator.tsxe2e/react-start/server-functions/src/routes/middleware/index.tsxpackages/start-static-server-functions/src/staticFunctionMiddleware.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructured.tsxe2e/react-start/server-functions/src/routeTree.gen.tse2e/react-start/server-functions/tests/server-functions.spec.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsxpackages/start-server-core/src/createServerRpc.tspackages/start-server-core/src/createSsrRpc.tspackages/start-client-core/src/index.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsxpackages/start-client-core/src/client-rpc/createClientRpc.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsxpackages/start-client-core/src/createMiddleware.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnValidator.tsxe2e/react-start/server-functions/src/routes/middleware/function-metadata.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsxpackages/start-client-core/src/createServerFn.tspackages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnValidator.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/factory.tsxpackages/start-client-core/src/client/ServerFunctionSerializationAdapter.tspackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsxpackages/start-plugin-core/src/start-compiler-plugin/handleCreateServerFn.tspackages/start-plugin-core/tests/createServerFn/createServerFn.test.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsxpackages/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.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsxpackages/start-plugin-core/tests/createServerFn/createServerFn.test.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createServerFnStarImport.tsxpackages/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.tspackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/factory.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/createServerFnDestructuredRename.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsxpackages/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.tsxpackages/start-client-core/src/index.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnDestructured.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createServerFnStarImport.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-provider/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/client/isomorphic-fns.tsxpackages/start-plugin-core/tests/createServerFn/snapshots/server-caller/factory.tsxpackages/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
serverFnMetaobject format withid,name, andfilenameproperties. 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.functionIdtoctx.serverFnMeta.idis consistent across both client and server middleware paths. Type definitions confirm thatServerFnMetaandClientFnMetaproperly expose theidproperty in the middleware context, and no remainingctx.functionIdusage 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
createClientRpcwith encoded ID- Server-caller: uses
createSsrRpcwith encoded ID and dynamic import- Server-provider: uses
createServerRpcwith the new object structureThe 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 thecompilehelper function.Also applies to: 301-301
316-320: Test expectations correctly updated for absolute paths.The
resolveIdmock expectations are properly updated to use the absolute path/test/src/test.tsas 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
filenamefield 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
ClientFnMetaandServerFnMetainterfaces 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
createClientRpccalls 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
createSsrRpccalls receive the function ID string and an importer function, which aligns with the SSR RPC signature that usesClientFnMetainternally (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 typeis 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
serverFnMetastructure. Thetesttype guard properly identifies server functions by theirserverFnMeta.idproperty, andtoSerializablecorrectly 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
FunctionMiddlewareServerFnOptionsinterface is correctly updated to use the structuredserverFnMeta: ServerFnMetatype. Server middleware now has access to the full metadata (id, name, filename) through a single cohesive property.
601-612: LGTM!The
FunctionMiddlewareClientFnOptionsinterface correctly usesserverFnMeta: 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
serverFnMetaobject) and caller files (which only receive thefunctionIdstring). The comments clearly explain the purpose of each template.
120-134: LGTM!The
buildServerFnMetaObjecthelper is well-implemented. It creates a clean AST representation of the metadata object withid,name, andfilenameproperties.
140-148: LGTM!The
generateProviderRpcStubfunction signature is correctly updated to accept the fullserverFnMetaobject expression for provider files.
150-185: LGTM!The
generateCallerRpcStubcorrectly continues to use only thefunctionIdstring 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
serverFnMetaobject 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
createServerRpccall now receives a structured metadata object withid,name, andfilenameproperties, matching theServerFnMetainterface. 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
createClientRpcaligns 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-testidfor 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
functionIdparameter to a structuredServerFnMetaobject improves type safety and enables richer metadata propagation (id, name, filename). The implementation correctly derives the URL fromserverFnMeta.idand attaches the full metadata object for downstream consumers. All call sites have been properly updated to pass the structuredServerFnMetaobject—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
createSsrRpccalls 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
ClientFnMetaandServerFnMetatypes 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 partialClientFnMeta(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
CompiledFetcherFntype now requiresserverFnMeta: 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
ServerFnMiddlewareOptionscorrectly usesClientFnMeta(containing only the id) rather than the fullServerFnMeta. 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
createClientRpccalls 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
createServerRpccall now accepts a structured object with{ id, name, filename }instead of a positional string parameter. This aligns with the newServerFnMetatype and provides richer metadata for server-side execution and middleware.The metadata structure correctly includes:
id: Base64-encoded identifiername: Original function variable name ("myAuthedFn")filename: Source file path ("src/test.ts")
35-39: LGTM! Consistent metadata structure for admin function.The
deleteUserFnhandler 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 oldfunctionId: 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
idfromserverFnMetafor 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
createClientRpccalls formyAuthedFnanddeleteUserFnhave 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
ClientFnMetais 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
ClientFnMetaobject with just theidis appropriate for SSR RPCs, which are instantiated from encoded identifiers without access to the fullServerFnMeta(name and filename) available on the provider side.
23-23: LGTM! API updated to expose structured metadata.The returned object now exposes
serverFnMetainstead of a barefunctionId, 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
ClientFnMetais 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
ClientFnMetaobject with the functionidis 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
serverFnMetainstead offunctionId, maintaining API consistency withcreateSsrRpcand 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 accessnameandfilenameproperties 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
createServerRpccalls to use the structured object form withid,name, andfilenamefields, 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 theircreateServerRpccalls.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

Summary by CodeRabbit
Release Notes
New Features
Tests
Documentation
ClientFnMeta,ServerFnMeta) for developer use.✏️ Tip: You can customize this high-level summary in your review settings.