Skip to content

test(tanstack-react-start): add patchRequest regression tests#8399

Open
nikosdouvlis wants to merge 4 commits intomainfrom
nikos/tanstack-patch-request-test
Open

test(tanstack-react-start): add patchRequest regression tests#8399
nikosdouvlis wants to merge 4 commits intomainfrom
nikos/tanstack-patch-request-test

Conversation

@nikosdouvlis
Copy link
Copy Markdown
Member

@nikosdouvlis nikosdouvlis commented Apr 24, 2026

No description provided.

patchRequest clones the incoming Request on every server middleware
invocation before it is handed to @clerk/backend, and had no direct
test coverage. This came up while investigating a reported query
string drop in the TanStack handshake flow. The query is preserved
today, but nothing would catch a regression.

Covers URL preservation (query + path), x-forwarded headers, method,
and new-instance identity.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

🦋 Changeset detected

Latest commit: 2f94f70

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
clerk-js-sandbox Skipped Skipped Apr 24, 2026 9:22pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 12262069-53e7-4ffd-89f3-b9c8f10cd7a3

📥 Commits

Reviewing files that changed from the base of the PR and between eaf65f0 and 2f94f70.

📒 Files selected for processing (1)
  • packages/tanstack-react-start/src/__tests__/patchRequest.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/tanstack-react-start/src/tests/patchRequest.test.ts

📝 Walkthrough

Walkthrough

Adds three test files and no production code changes: a Vitest unit test for patchRequest that asserts the cloned Request preserves the exact URL (path, query, and a nested percent‑encoded redirect_url with its own query and port), retains x-forwarded-host and x-forwarded-proto headers, keeps the HTTP method, preserves redirect and cache properties, wires abort behavior from the original to the clone, and ensures POST clones do not carry the original body; a Playwright integration test that verifies a 307 handshake redirect preserves the original request’s query string in the redirect_url parameter; and a new, empty .changeset entry. No exported/public API declarations were modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate content relevance. Add a brief description explaining the purpose of these regression tests and what scenarios they cover.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding regression tests for the patchRequest function in tanstack-react-start.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.


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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 24, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8399

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8399

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8399

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8399

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8399

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8399

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8399

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8399

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8399

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8399

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8399

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8399

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8399

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8399

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8399

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8399

@clerk/tanstack-react-start

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

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8399

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8399

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8399

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8399

commit: 2f94f70

…eservation

Extends the proxy integration test to assert that the FAPI handshake
redirect_url keeps the original query string when the app is behind a
reverse proxy. Sibling to the existing assertion that the redirect
uses the forwarded host. Also adds an empty changeset since this is
test-only and does not ship.
- Replace the generic URL case with the exact shape from the Slack
  report: an encoded nested redirect_url with its own query and port,
  asserted via URL parsing.
- Add coverage for redirect, cache, and signal init options that
  patchRequest forwards (previously unasserted).
- Replace the weak "returns a new Request" check with a signal-abort
  forwarding assertion that actually proves cloning behavior.
- Assert the cloned URL equals original.url (semantic) instead of
  comparing against a raw literal.
- Add a POST-with-body case that locks in the intentional body drop
  from #7020. Guards against accidentally forwarding body through the
  clone, which would reintroduce the undici duplex issues.
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