Skip to content
Source
Sign inSign up
TanStack/router

fix(start): reject non-ok JSON server function responses #8283

Opendvd233(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8283/headopened

Written by an AI agent on behalf of @dvd233, who has reviewed this pull request.

🎯 Changes

Reject non-OK JSON server-function responses that were not serialized by TanStack Start, instead of returning the parsed error body as a successful result.

Redirect and not-found handling remain unchanged, and successful plain JSON responses still resolve normally. Focused regression coverage exercises both the failing 500 response and the successful control case.

Fixes #8280.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Review Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Team

      Run ID: 6a782757-cec9-4ed5-ba6f-9f700b993035

      📥 Commits

      Reviewing files that changed from the base of the PR and between aee42c6b641d8e919bfed9e0f04bb1b72092f3a6 and bfaf6ab9af9cb7e1d8f4c2f2e3c8c52f1c955d8d.

      📒 Files selected for processing (3)
      • .changeset/quiet-rivers-reject.md
      • packages/start-client-core/src/client-rpc/serverFnFetcher.ts
      • packages/start-client-core/tests/serverFnFetcher.test.ts

      Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


      📝 Walkthrough

      Walkthrough

      The server-function fetcher now rejects non-OK JSON responses with the serialized response body. Tests cover rejection for status 500 and successful parsing for OK responses. A patch changeset documents the behavior.

      Changes

      Server-function response handling

      Layer / File(s)Summary
      Non-OK JSON rejection and validation
      packages/start-client-core/src/client-rpc/serverFnFetcher.ts, packages/start-client-core/tests/serverFnFetcher.test.ts, .changeset/quiet-rivers-reject.md
      The fetcher throws an error containing the serialized JSON payload when a JSON response is not OK. Tests cover non-OK rejection and OK response parsing. The changeset records the patch release.
      Estimated code review effort: 2 (Simple)~10 minutes

      Merge Risk: ⚪ Minimal · up to bfaf6

      Non-OK un-serialized JSON server-function responses now reject rather than resolve with an error body, while successful JSON responses and redirect/not-found behavior remain preserved. No current merge-blocking risk remains.

      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Linked Issues check✅ PassedThe implementation addresses issue #8280 by rejecting non-OK, non-serialized JSON responses with the response payload while preserving successful JSON handling. Regression tests cover both the failing…
      Out of Scope Changes check✅ PassedThe changes are limited to the server-function response fix, focused regression tests, and the required changeset. No unrelated code changes are identified.
      Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 …
      Title check✅ PassedThe title clearly and concisely describes the main change: rejecting non-OK JSON server-function responses.
      Description check✅ PassedThe description explains the change, motivation, preserved behavior, regression coverage, linked issue, checklist completion, and changeset impact.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.

Sign in to join this conversation.