Skip to content

strict: false for server functions#7277

Merged
schiller-manuel merged 2 commits intomainfrom
serverfn-strict-false
Apr 30, 2026
Merged

strict: false for server functions#7277
schiller-manuel merged 2 commits intomainfrom
serverfn-strict-false

Conversation

@schiller-manuel
Copy link
Copy Markdown
Contributor

@schiller-manuel schiller-manuel commented Apr 27, 2026

Add a strict: false server function handler option to opt out of type-level serialization checks for server function return values.

Summary by CodeRabbit

  • New Features
    • Added a new strict option for server functions to control serialization validation. Set strict: false to disable checks for both inputs and outputs, or configure strict: { output: false } to disable only output validation, enabling handling of non-serializable values.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea1a1f76-318a-4c43-b116-fa421ed63dd2

📥 Commits

Reviewing files that changed from the base of the PR and between 62538cc and 64eeb08.

📒 Files selected for processing (4)
  • .changeset/strict-server-functions.md
  • packages/start-client-core/src/createServerFn.ts
  • packages/start-client-core/src/index.tsx
  • packages/start-client-core/src/tests/createServerFn.test-d.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/start-client-core/src/tests/createServerFn.test-d.ts
  • packages/start-client-core/src/createServerFn.ts

📝 Walkthrough

Walkthrough

This PR introduces a new strict option to createServerFn that controls type-level serialization validation. The feature allows disabling serializability checks globally (strict: false) or selectively for inputs/outputs via an options object, propagating a new TStrict generic parameter through the entire type system.

Changes

Cohort / File(s) Summary
Type System Enhancement
packages/start-client-core/src/createServerFn.ts
Introduces TStrict generic parameter (default true) threaded through CreateServerFn, ServerFnOptions, ServerFnReturnType, ServerFnBaseOptions, ValidateValidatorInput, ConstrainValidator, middleware/validator/handler/builder/types interfaces. Conditionally bypasses serializability validation for inputs/outputs based on strict configuration, while preserving POST/FormData special-case handling when strict is enabled.
Type Assertions & Tests
packages/start-client-core/src/tests/createServerFn.test-d.ts
Adds comprehensive type-level test coverage verifying that disabled strict modes (strict: false, strict.output: false, strict.input: false) preserve non-serializable types (functions, Promises) and bypass validation checks as expected.
Public Type Exports
packages/start-client-core/src/index.tsx
Exports new public types: ServerFnOptions, ServerFnStrict, ServerFnStrictInput, ServerFnStrictOutput.
Feature Documentation
.changeset/strict-server-functions.md
Changeset documenting the new strict option for createServerFn with examples of both factory-level (strict: false) and targeted (strict: { output: false }) disabling of serialization checks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A rabbit hops through types so true,
With strict controls now shiny new,
Functions flow where checks once stood,
Serialization, good and good!
Options dance in gentle ways,
Validation blooms in strictest days! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: introducing a strict: false option for server functions to disable type-level serialization checks.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch serverfn-strict-false

Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

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

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 27, 2026

View your CI Pipeline Execution ↗ for commit 64eeb08

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

☁️ Nx Cloud last updated this comment at 2026-04-30 21:25:12 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

🚀 Changeset Version Preview

1 package(s) bumped directly, 13 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/start-client-core 1.167.22 → 1.168.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/react-start 1.167.55 → 1.167.56 Dependent
@tanstack/react-start-client 1.166.45 → 1.166.46 Dependent
@tanstack/react-start-rsc 0.0.34 → 0.0.35 Dependent
@tanstack/react-start-server 1.166.46 → 1.166.47 Dependent
@tanstack/solid-start 1.167.52 → 1.167.53 Dependent
@tanstack/solid-start-client 1.166.44 → 1.166.45 Dependent
@tanstack/solid-start-server 1.166.45 → 1.166.46 Dependent
@tanstack/start-plugin-core 1.169.10 → 1.169.11 Dependent
@tanstack/start-server-core 1.167.24 → 1.167.25 Dependent
@tanstack/start-static-server-functions 1.166.38 → 1.166.39 Dependent
@tanstack/vue-start 1.167.48 → 1.167.49 Dependent
@tanstack/vue-start-client 1.166.40 → 1.166.41 Dependent
@tanstack/vue-start-server 1.166.41 → 1.166.42 Dependent

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

Bundle Size Benchmarks

  • Commit: cf5eb2f16816
  • Measured at: 2026-04-30T21:20:51.472Z
  • Baseline source: history:c4256c2c857f
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 87.15 KiB 0 B (0.00%) 273.94 KiB 75.70 KiB ███▇▇▇▇▇▁▁▁
react-router.full 90.68 KiB 0 B (0.00%) 285.45 KiB 78.71 KiB ▇▇▇█████▁▁▁
solid-router.minimal 35.38 KiB 0 B (0.00%) 106.25 KiB 31.81 KiB ███▇▇▇▇▇▁▁▁
solid-router.full 40.10 KiB 0 B (0.00%) 120.46 KiB 36.04 KiB ███▇▇▇▇▇▁▁▁
vue-router.minimal 53.15 KiB 0 B (0.00%) 151.39 KiB 47.73 KiB ████████▁▁▁
vue-router.full 58.28 KiB 0 B (0.00%) 167.56 KiB 52.18 KiB ████████▁▁▁
react-start.minimal 101.76 KiB 0 B (0.00%) 322.10 KiB 87.97 KiB ████████▁▁▁
react-start.full 105.19 KiB 0 B (0.00%) 332.43 KiB 90.96 KiB ████████▁▁▁
react-start.rsbuild.minimal 99.33 KiB 0 B (0.00%) 316.47 KiB 85.46 KiB ██████▂▂▁▁▁
react-start.rsbuild.full 102.63 KiB 0 B (0.00%) 326.90 KiB 88.28 KiB ██████▂▂▁▁▁
solid-start.minimal 49.40 KiB 0 B (0.00%) 152.08 KiB 43.60 KiB ███▇▇▇▇▇▁▁▁
solid-start.full 55.20 KiB 0 B (0.00%) 168.98 KiB 48.51 KiB ███▇▇▇▇▇▁▁▁

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 27, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7277

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7277

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7277

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7277

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7277

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7277

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7277

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7277

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7277

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7277

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7277

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7277

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7277

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7277

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7277

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7277

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7277

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7277

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7277

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7277

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7277

commit: 3161042

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 27, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing serverfn-strict-false (3161042) with main (c4256c2)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

  2. No successful run was found on main (cf5eb2f) during the generation of this report, so c4256c2 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Add a `strict` option to `createServerFn` for type-level server function serialization checks
Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

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

Nx Cloud has identified a flaky task in your failed CI:

🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.

Nx Cloud View detailed reasoning in Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

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.

1 participant