[PR #928] [MERGED] fix(router): reject invalid app route discovery conflicts #958

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/928
Author: @NathanDrake2406
Created: 4/28/2026
Status: Merged
Merged: 4/28/2026
Merged by: @james-elicx

Base: mainHead: nathan/app-router-validation-parity


📝 Commits (2)

  • 4ca3709 fix(router): reject invalid app route discovery conflicts
  • 40d91fd fix(router): address app route validation review

📊 Changes

2 files changed (+197 additions, -0 deletions)

View changed files

📝 packages/vinext/src/routing/app-router.ts (+91 -0)
📝 tests/routing.test.ts (+106 -0)

📄 Description

Summary

  • Reject App Router interception routes that use ( .. )-style upward markers after the normalized route has no visible segment left to climb.
  • Report an explicit page/route handler conflict when page and route files resolve to the same App Router path.
  • This intentionally groups two scanner-time validation/DX parity issues in one PR, while leaving slot ownership behavior for a separate PR.

Root cause / Why

vinext already resolved interception targets by visible route segments, but it kept resolving at root when ( .. ) or ( .. )( .. ) tried to climb past the normalized intercepting route. Next.js validates the normalized interception route first and throws explicit marker errors instead of silently resolving from root.

vinext also discovered page and route files as separate entries and deferred conflict detection to the generic duplicate route pattern validator. That produced a correct rejection but not the explicit App Router conflict that points at the page and route handler files.

Next.js parity references:

Verification

  • vp test run tests/routing.test.ts
  • vp test run tests/route-sorting.test.ts
  • vp check tests/routing.test.ts packages/vinext/src/routing/app-router.ts

🔄 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/928 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/28/2026 **Status:** ✅ Merged **Merged:** 4/28/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `nathan/app-router-validation-parity` --- ### 📝 Commits (2) - [`4ca3709`](https://github.com/cloudflare/vinext/commit/4ca37099c87584e717567bf2ad4c3dbe02296908) fix(router): reject invalid app route discovery conflicts - [`40d91fd`](https://github.com/cloudflare/vinext/commit/40d91fd42d9ab96ad80a2f0d79e44475f894199a) fix(router): address app route validation review ### 📊 Changes **2 files changed** (+197 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/routing/app-router.ts` (+91 -0) 📝 `tests/routing.test.ts` (+106 -0) </details> ### 📄 Description ## Summary - Reject App Router interception routes that use `( .. )`-style upward markers after the normalized route has no visible segment left to climb. - Report an explicit page/route handler conflict when `page` and `route` files resolve to the same App Router path. - This intentionally groups two scanner-time validation/DX parity issues in one PR, while leaving slot ownership behavior for a separate PR. ## Root cause / Why vinext already resolved interception targets by visible route segments, but it kept resolving at root when `( .. )` or `( .. )( .. )` tried to climb past the normalized intercepting route. Next.js validates the normalized interception route first and throws explicit marker errors instead of silently resolving from root. vinext also discovered `page` and `route` files as separate entries and deferred conflict detection to the generic duplicate route pattern validator. That produced a correct rejection but not the explicit App Router conflict that points at the page and route handler files. Next.js parity references: - [Interception route validation source](https://github.com/vercel/next.js/blob/ae61573e062e900050b8e6b24626e450accc4570/packages/next/src/shared/lib/router/utils/interception-routes.ts#L60-L95) - [Interception route validation tests](https://github.com/vercel/next.js/blob/ae61573e062e900050b8e6b24626e450accc4570/packages/next/src/shared/lib/router/utils/interception-routes.test.ts#L66-L75) - [Route handler docs: page.js and route.js conflict](https://github.com/vercel/next.js/blob/ae61573e062e900050b8e6b24626e450accc4570/docs/01-app/01-getting-started/15-route-handlers.mdx#L150-L163) - [App path normalization source](https://github.com/vercel/next.js/blob/ae61573e062e900050b8e6b24626e450accc4570/packages/next/src/shared/lib/router/utils/app-paths.ts#L23-L51) ## Verification - `vp test run tests/routing.test.ts` - `vp test run tests/route-sorting.test.ts` - `vp check tests/routing.test.ts packages/vinext/src/routing/app-router.ts` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:14 +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#958
No description provided.