[PR #618] [MERGED] refactor: extract app route handler request runtime #717

Closed
opened 2026-05-06 13:09:46 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/618
Author: @southpolesteve
Created: 3/21/2026
Status: Merged
Merged: 3/21/2026
Merged by: @southpolesteve

Base: mainHead: codex/app-route-handler-runtime


📝 Commits (1)

  • 5ff52b8 refactor: extract app route handler request runtime

📊 Changes

7 files changed (+615 additions, -161 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+42 -29)
packages/vinext/src/server/app-route-handler-runtime.ts (+187 -0)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+234 -132)
tests/app-route-handler-runtime.test.ts (+112 -0)
📝 tests/app-router.test.ts (+24 -0)
tests/fixtures/app-basic/app/api/dynamic-request-headers/route.ts (+7 -0)
tests/fixtures/app-basic/app/api/dynamic-request-url/route.ts (+9 -0)

📄 Description

Summary

  • written by Codex
  • extract App Router route-handler request tracking into a real typed runtime module instead of keeping it inside the generated RSC entry
  • teach route-handler ISR to remember handlers that access request-specific data and skip future cache reads for those patterns
  • add focused regression coverage for direct request.headers and request.url access under route-handler ISR

Details

  • move route-handler method collection / Allow header helpers into packages/vinext/src/server/app-route-handler-runtime.ts
  • move tracked NextRequest / NextURL proxy creation into the same module, following the dynamic request reads Next.js tracks in proxyNextRequest()
  • keep packages/vinext/src/entries/app-rsc-entry.ts as thinner glue that imports those helpers instead of embedding them in template-string runtime code
  • add unit coverage for the new runtime helper and integration fixtures for direct request-header and request-url reads

Verification

  • vp check packages/vinext/src/server/app-route-handler-runtime.ts packages/vinext/src/entries/app-rsc-entry.ts tests/app-route-handler-runtime.test.ts tests/app-router.test.ts tests/fixtures/app-basic/app/api/dynamic-request-headers/route.ts tests/fixtures/app-basic/app/api/dynamic-request-url/route.ts
  • vp test run tests/app-route-handler-runtime.test.ts tests/entry-templates.test.ts
  • vp test run tests/app-router.test.ts -t "route handler ISR"
  • vp test run tests/nextjs-compat/app-routes.test.ts
  • vp run vinext#build

Notes

  • I did not find an obvious direct Next.js test for the exact request.headers / request.url ISR cases, so the new integration tests are vinext-specific regression coverage grounded in Next.js's current proxyNextRequest() behavior.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/618 **Author:** [@southpolesteve](https://github.com/southpolesteve) **Created:** 3/21/2026 **Status:** ✅ Merged **Merged:** 3/21/2026 **Merged by:** [@southpolesteve](https://github.com/southpolesteve) **Base:** `main` ← **Head:** `codex/app-route-handler-runtime` --- ### 📝 Commits (1) - [`5ff52b8`](https://github.com/cloudflare/vinext/commit/5ff52b814be2c6b31e834343eba845f074e8f93d) refactor: extract app route handler request runtime ### 📊 Changes **7 files changed** (+615 additions, -161 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+42 -29) ➕ `packages/vinext/src/server/app-route-handler-runtime.ts` (+187 -0) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+234 -132) ➕ `tests/app-route-handler-runtime.test.ts` (+112 -0) 📝 `tests/app-router.test.ts` (+24 -0) ➕ `tests/fixtures/app-basic/app/api/dynamic-request-headers/route.ts` (+7 -0) ➕ `tests/fixtures/app-basic/app/api/dynamic-request-url/route.ts` (+9 -0) </details> ### 📄 Description ## Summary - written by Codex - extract App Router route-handler request tracking into a real typed runtime module instead of keeping it inside the generated RSC entry - teach route-handler ISR to remember handlers that access request-specific data and skip future cache reads for those patterns - add focused regression coverage for direct `request.headers` and `request.url` access under route-handler ISR ## Details - move route-handler method collection / Allow header helpers into `packages/vinext/src/server/app-route-handler-runtime.ts` - move tracked `NextRequest` / `NextURL` proxy creation into the same module, following the dynamic request reads Next.js tracks in `proxyNextRequest()` - keep `packages/vinext/src/entries/app-rsc-entry.ts` as thinner glue that imports those helpers instead of embedding them in template-string runtime code - add unit coverage for the new runtime helper and integration fixtures for direct request-header and request-url reads ## Verification - `vp check packages/vinext/src/server/app-route-handler-runtime.ts packages/vinext/src/entries/app-rsc-entry.ts tests/app-route-handler-runtime.test.ts tests/app-router.test.ts tests/fixtures/app-basic/app/api/dynamic-request-headers/route.ts tests/fixtures/app-basic/app/api/dynamic-request-url/route.ts` - `vp test run tests/app-route-handler-runtime.test.ts tests/entry-templates.test.ts` - `vp test run tests/app-router.test.ts -t "route handler ISR"` - `vp test run tests/nextjs-compat/app-routes.test.ts` - `vp run vinext#build` ## Notes - I did not find an obvious direct Next.js test for the exact `request.headers` / `request.url` ISR cases, so the new integration tests are vinext-specific regression coverage grounded in Next.js's current `proxyNextRequest()` behavior. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:46 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#717
No description provided.