mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #578] test: expand Next.js compat coverage and fix parity bugs #685
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#685
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/578
Author: @dmmulroy
Created: 3/17/2026
Status: 🔄 Open
Base:
main← Head:autoresearch/nextjs-compat-audit-2026-03-17📝 Commits (10+)
5fdfb94autoresearch: setup compat test audit loop5b5b084Baseline: 233 passing compat tests, 21 files, 13 dirs covered. Fixed autoresearch.sh ANSI stripping.\n\nResult: {"status":"keep","passing_compat_tests":233,"test_files":21,"dirs_covered":13,"skipped_tests":2}129b6edPort app-fetch-deduping-errors: 3 tests for page rendering despite fetch errors in generateMetadata and page component\n\nResult: {"status":"keep","passing_compat_tests":236,"test_files":22,"dirs_covered":14,"skipped_tests":2}9342d34Port forbidden: 5 tests for forbidden() boundary, 403 status, scoped + root escalation. Also triaged 6 P1 dirs as skip (Playwright/CLI/build-specific).\n\nResult: {"status":"keep","passing_compat_tests":241,"test_files":23,"dirs_covered":15,"skipped_tests":2}17473c7Port unauthorized: 5 tests for unauthorized() boundary, 401 status, scoped + root escalation. Skip proxy-missing-export (covered by PR #203).\n\nResult: {"status":"keep","passing_compat_tests":246,"test_files":24,"dirs_covered":16,"skipped_tests":2}59bd8bcPort catch-all-optional: 3 tests for optional catch-all routing. Batch-triage 14 more P1+P2 dirs as skip. 249 total tests.\n\nResult: {"status":"keep","passing_compat_tests":249,"test_files":25,"dirs_covered":17,"skipped_tests":2}5a03d6dPort simple-routes + FIX BUG: route handlers received plain Request instead of NextRequest (.nextUrl undefined). Wrapped in NextRequest in app-rsc-entry.ts.\n\nResult: {"status":"keep","passing_compat_tests":251,"test_files":26,"dirs_covered":18,"skipped_tests":2}3979dbePort rsc-redirect: 3 tests for redirect() from server component. Found RSC redirect behavioral difference (307 vs 200+stream). Triage 4 more dirs.\n\nResult: {"status":"keep","passing_compat_tests":254,"test_files":27,"dirs_covered":19,"skipped_tests":2}bff4433Port static-generation-status: 5 tests for notFound/redirect/permanentRedirect status codes + client component redirect SSR. Triage 5 more dirs.\n\nResult: {"status":"keep","passing_compat_tests":259,"test_files":28,"dirs_covered":20,"skipped_tests":2}baf1790Port layout-params: 6 tests. BUG FOUND+FIXED: layouts received ALL params instead of scoped per-segment params. Fixed 4 rendering loops in app-rsc-entry.ts + buildPageElement. Added cheerio + fetchDom helper.\n\nResult: {"status":"keep","passing_compat_tests":265,"test_files":29,"dirs_covered":21,"skipped_tests":2}📊 Changes
124 files changed (+3675 additions, -111 deletions)
View changed files
📝
package.json(+1 -0)📝
packages/vinext/src/entries/app-rsc-entry.ts(+99 -15)📝
packages/vinext/src/entries/pages-server-entry.ts(+26 -2)📝
packages/vinext/src/server/middleware.ts(+33 -2)📝
packages/vinext/src/shims/headers.ts(+1 -1)📝
pnpm-lock.yaml(+365 -5)📝
tests/__snapshots__/entry-templates.test.ts.snap(+504 -86)➕
tests/fixtures/app-basic/app/nextjs-compat/api/edge.json/route.ts(+13 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/api/node.json/route.ts(+11 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/catch-all-optional/[lang]/[flags]/[[...rest]]/page.tsx(+21 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/conflicting-params/api/[id]/route.ts(+11 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/conflicting-params/render/[id]/page.tsx(+34 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/dynamic-data/client-page/page.tsx(+28 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/dynamic-data/force-dynamic/page.tsx(+42 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/dynamic-data/force-static/page.tsx(+42 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/dynamic-data/getSentinelValue.tsx(+11 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/dynamic-data/layout.tsx(+17 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/dynamic-data/top-level/page.tsx(+40 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/fetch-deduping-errors/[id]/page.tsx(+39 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/forbidden-basic/dynamic-no-boundary/[id]/page.tsx(+18 -0)...and 80 more files
📄 Description
Summary
This PR ports a large batch of HTTP-testable Next.js App Router compatibility coverage into
tests/nextjs-compat/and fixes several real runtime parity bugs uncovered along the way.Highlights:
Included coverage
Notable compat additions in this branch include:
fetch-deduping-errorsforbiddenunauthorizedsearchParamsstatic bailout coverageuseParamsuse cachetrailingSlashnot-foundbehaviorRuntime fixes uncovered by the compat ports
NextRequestsoreq.nextUrlexistsforce-staticpages from receiving livesearchParamsnot-found.tsxexistsnext/headerscontext and capture draft-mode cookies before the ALS scope unwindsValidation
Primary validation for this branch came from the compat benchmark loop plus the automatic backpressure checks required by autoresearch mode.
Latest kept result before removing autoresearch assets from the branch:
Autoresearch findings summary
Bugs found and fixed
Requestinstead ofNextRequest, soreq.nextUrlwas undefined.force-staticpages still saw livesearchParams.not-found.tsxexisted.next/headersrequest context, and middleware draft-mode cookies could be lost after the ALS scope unwound.Behavioral differences documented
Process/tooling improvements from the loop
fetchDom/Cheerio-based assertions for more DOM-structured compat testsAutoresearch metric progression
Autoresearch notes intentionally left out of the diff
This PR intentionally excludes files such as:
autoresearch.mdautoresearch.shautoresearch.checks.shautoresearch.manifest.jsonautoresearch.jsonlautoresearch.ideas.mdThose assets were useful during the audit loop but are not needed to review or merge the runtime/test changes.
Reviewer notes
This branch is best reviewed commit-by-commit or by file grouping:
packages/vinext/src/**🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.