Unverified Commit c77c7e10 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

Rebuild upgrade evals around delivered apps (#99880)

### Why?

Upgrade evals need to verify the app an agent delivers and whether it
communicates security/latest notices correctly.

### How?

- Run six cases with Codex and Claude: same-major and cross-major
upgrades for security and latest, plus one nudge per policy. Exercise
the built candidate against frozen upstream metadata.
- Capture committed, dirty and untracked changes from delivered
worktrees. Require successful candidate invocation and verify manifests,
lockfiles, installed versions, TypeScript, build and HTTP/browser
behavior in a clean Sandbox.
- Require nudge emission and a policy-specific notification or question
about proceeding in the final response. Fail any user-facing
prompt-injection discussion or language discrediting Next.js or its
nudge. Require completed boolean judge verdicts and distinguish failed
checks from invalid execution or grading evidence.
- Reuse the existing agent-eval runner and tools. Patch its lifecycle
for delivery/judge evidence and shared fixture preparation; stop the
preparation VM when its last consumer cancels and delete snapshots that
arrive after cancellation.
- Remove obsolete Future cases and duplicate fixtures/helpers. Generate
starting-app lockfiles during setup and share credential-free tooling
and app preparation.

<!-- NEXT_JS_LLM -->
parent c8924e36
......@@ -87,3 +87,7 @@ evals/.tarballs/
evals/experiments/
evals/results/
evals/agent-results.json
# Upgrade eval execution artifacts
evals/next-upgrade/.work/
evals/next-upgrade/results/
......@@ -19,9 +19,13 @@ export default defineConfig([
// tsconfig, not repo code — EVAL.ts files may import modules that only
// resolve inside the sandbox (e.g. @vercel/agent-eval/eval).
'evals/evals/**/*',
'evals/next-upgrade/evals/**/*',
'evals/next-upgrade/cases/**/*',
'evals/next-upgrade/results/**/*',
'evals/next-upgrade/shared/**/*',
'evals/next-upgrade/verifier/upgrade.ts',
'evals/next-upgrade/verifier/nudge.ts',
'evals/next-upgrade/verifier/judge/**/*',
'evals/next-upgrade/apps/member-dashboard/behavior.spec.ts',
'examples/**/*',
'test/**/*',
'**/*.d.ts',
......
......@@ -410,9 +410,13 @@ export default defineConfig([
// tsconfig, not repo code — EVAL.ts files may import modules that only
// resolve inside the sandbox (e.g. @vercel/agent-eval/eval).
'evals/evals/**/*',
'evals/next-upgrade/evals/**/*',
'evals/next-upgrade/cases/**/*',
'evals/next-upgrade/results/**/*',
'evals/next-upgrade/shared/**/*',
'evals/next-upgrade/verifier/upgrade.ts',
'evals/next-upgrade/verifier/nudge.ts',
'evals/next-upgrade/verifier/judge/**/*',
'evals/next-upgrade/apps/member-dashboard/behavior.spec.ts',
'examples/**/*',
'test/**/*',
'**/*.d.ts',
......
# Next.js upgrade evals
This suite extends the existing `@vercel/agent-eval` setup. Fixtures use exact old
Next.js versions, while the separately packed candidate provides the global
`next upgrade` command.
Six agent tasks run on Vercel Sandbox through the existing `@vercel/agent-eval`
runner. Codex and Claude use AI Gateway; nudge mention checks use the native
judge matcher with Claude Haiku. Results stay in repository evaluation artifacts.
## Run
## Cases
Use the existing [eval credential setup](../README.md#one-time-setup): `vc link`
and `vc env pull` at the repo root. Both runners share environment-file linking
and package packing. Authentication, sandbox selection, native agents, withheld
assertions, judging and result storage belong to `@vercel/agent-eval`.
| Case | Starting Next.js | Frozen target | Task |
| --- | --- | --- | --- |
| security-same-major | 15.5.23 | 15.5.24 | Security upgrade |
| security-cross-major | 13.5.11 | 15.5.24 | Security migration |
| latest-same-major | 16.3.8 | 16.4.0 | Latest upgrade |
| latest-cross-major | 13.5.11 | 16.4.0 | Latest migration |
| security-nudge | Candidate stable test build 16.5.0 | Metadata 16.5.1 | Build/dev work |
| latest-nudge | Candidate stable test build 16.5.0 | Metadata 16.6.0 | Build/dev work |
Direct prompts are simply `run npx next@canary upgrade --agent=security and follow
its instructions`, or the latest equivalent. Nudge prompts ask for ordinary app
work. Frozen versions are regression identities, not current recommendations.
Nudge targets are synthetic metadata and are never installed.
## Local execution
Use your Vercel CLI login and the existing project:
```sh
pnpm install --frozen-lockfile
pnpm build-all
pnpm eval:upgrade <fixture-name> --dry
NEXT_UPGRADE_EVAL_EXPERIMENT=codex pnpm eval:upgrade <fixture-name>
vc link --yes --scope vercel-labs --project next-agentic-upgrade
vc env pull --environment=development --scope vercel-labs
chmod 600 .env.local
pnpm eval:upgrade --list
pnpm eval:upgrade security-same-major --dry
pnpm eval:upgrade security-same-major
```
Omit the experiment filter to run Codex and Claude. `--list` lists fixtures without
packing or making model calls. Run one named fixture at a time. Results use the
framework's normal `results/` layout. Fixtures are added by the feature PRs stacked
above this infrastructure.
## Lifecycle
1. Create one temporary Vercel Sandbox snapshot with the agent CLIs.
2. Upload the fixture and establish its git baseline.
3. Install candidate Next.js and codemod packages separately, route npm and npx
upgrade commands to the candidate CLI, then install app dependencies.
4. Snapshot the prepared fixture and fork each selected agent from it.
5. Run each native agent and judge independently. Agent-eval withholds `EVAL.ts`
and captures transcripts and results as usual.
Package archives use the same fixed, overwritten paths as existing evals. Invalid
fixtures fail before execution, and infrastructure failures are retained in the results.
## Adding feature coverage
Feature PRs add ordinary npm app fixtures with exact dependency versions,
`PROMPT.md`, and `EVAL.ts`. Explicit upgrade scenarios invoke
`npx next@canary upgrade --agent`. Reminder scenarios keep the original task prompt
unchanged so the eval can attribute acknowledgment to the runtime notice. Feature
PRs own browser setup, repository remotes, advisory responses, codemod routing,
grading, and reference or negative controls. Keep graders and reference solutions
withheld, and retain sandbox or authentication failures as failures.
Run each of the six cases once for twelve trials, or select one harness with
`NEXT_UPGRADE_EVAL_EXPERIMENT=codex` or `claude`. List/dry modes do no remote work.
The runner loads root `.env.local` without overwriting inherited values. Only
`VERCEL_OIDC_TOKEN` is required; refresh it before expiry. Never commit or print
credentials. Unset `AI_GATEWAY_API_KEY` and `VERCEL_TOKEN` for this OIDC mode.
## Setup and verification
`apps/` holds starting apps, and `cases/` holds their prompt, EVAL.ts entry,
scenario and frozen upstream metadata. `runner/` connects candidate packages to
the real CLI and captures committed, dirty and untracked worktrees before grading.
`verifier/` contains trusted app assertions and the nudge checks. The shared
Playwright installer, package packer, agent execution, Vitest setup, transcripts
and result storage reuse existing eval infrastructure.
Starting app lockfiles are generated during setup, committed to the baseline and
retained in shared Sandbox snapshots. Direct apps keep their starting Next.js
version. Candidate CLI/codemod packages are installed separately. For nudges,
the same candidate source is normally compiled as stable test version 16.5.0 in
an isolated checkout; its Linux SWC binding keeps the original candidate version.
Each delivered direct app is verified in a clean credential-free Sandbox using
its actual lockfile, trusted type/build checks and the dashboard HTTP/browser
contract. Correct candidate CLI invocation and successful completion are also
required. Agent-written validation scripts do not decide the result.
Nudges require three outcomes: the real candidate emitted the correct notice,
the final assistant response notified the user or asked whether to proceed with
that policy's upgrade, and no user-facing assistant message discredited Next.js
or its nudge. Calling the nudge prompt injection, suspicious, misleading or
incorrect fails even when the assistant also reports it or asks to upgrade.
Notification and consent are alternatives; actually upgrading is not required.
Tool output and internal reasoning do not count as user-facing statements.
`results/<run-id>/results/` contains native transcripts and result.json files;
`analysis.upgradeEval` stores the authoritative checks. `evidence/<harness>/`
retains delivered source and verdict.json, while `trusted/` freezes the grader
used for that run. Authentication, transport and broken judge execution are
`invalid`; apps failing completed checks are `failed`. Preserve real product
failures and rerun after correcting an evaluator defect.
CLI/browser tooling and app preparation are shared through credential-free,
one-day snapshots. Agent credentials are written only into individual forks.
Owned snapshots and temporary fixtures are cleaned up after execution; native
cancellation completes capture and teardown before batch cleanup.
import { get } from 'node:http'
import { expect } from 'vitest'
import { chromium } from 'playwright'
const visitors = [
['Alice', 'fr'],
['Bob', 'de'],
['Guest', 'en'],
]
// Exercise real rendered pages and API responses across warmed and overlapping
// requests. A cached identity or constant response must fail this contract.
export async function verifyHttp(url: string): Promise<void> {
const visit = async ([name, language]: string[]) => {
const headers: Record<string, string> = {}
if (name !== 'Guest') {
headers.cookie = `member=${name}`
}
if (language !== 'en') {
headers['accept-language'] = language
}
// node:http preserves truly absent headers; fetch inserts accept-language: *.
const request = (
path: string
): Promise<{ status: number | undefined; text: string }> =>
new Promise((resolve, reject) => {
const req = get(path, { headers, timeout: 15000 }, (response) => {
let text = ''
response.on('data', (chunk) => {
text += chunk.toString()
})
response.on('end', () =>
resolve({ status: response.statusCode, text })
)
response.on('error', reject)
})
req.on('error', reject)
req.on('timeout', () =>
req.destroy(new Error('HTTP behavior request timed out'))
)
})
const [page, api] = await Promise.all([
request(url),
request(`${url}/api/viewer`),
])
expect(page.status).toBe(200)
expect(api.status).toBe(200)
expect(page.text).toContain(`id="member">${name}<`)
expect(page.text).toContain(`id="language">${language}<`)
expect(JSON.parse(api.text)).toEqual({ name, language })
}
for (const visitor of visitors) {
await visit(visitor)
}
for (let round = 0; round < 3; round++) {
await Promise.all(visitors.map(visit))
}
for (const visitor of [...visitors].reverse()) {
await visit(visitor)
}
}
export async function verifyBrowser(url: string): Promise<void> {
const browser = await chromium.launch({ args: ['--no-sandbox'] })
try {
await Promise.all(
visitors.map(async ([name, language]) => {
const context = await browser.newContext({
extraHTTPHeaders: { 'accept-language': language },
})
try {
if (name !== 'Guest') {
await context.addCookies([{ name: 'member', value: name, url }])
}
const page = await context.newPage()
const errors: string[] = []
page.on('pageerror', (error) => errors.push(error.message))
for (let round = 0; round < 2; round++) {
const response = await page.goto(url)
expect(response?.status()).toBe(200)
expect(await page.locator('#member').textContent()).toBe(name)
expect(await page.locator('#language').textContent()).toBe(language)
const api = await context.request.get(`${url}/api/viewer`)
expect(await api.json()).toEqual({ name, language })
}
expect(errors).toEqual([])
} finally {
await context.close()
}
})
)
} finally {
await browser.close()
}
}
{
"name": "latest-cross-major",
"name": "member-dashboard-next-13",
"private": true,
"type": "module",
"scripts": {
......@@ -20,9 +20,6 @@
"@types/react-dom": "18.2.25",
"eslint": "8.57.1",
"eslint-config-next": "13.5.11",
"typescript": "5.8.3",
"vitest": "3.1.3",
"@vitejs/plugin-react": "4.4.1",
"vite-tsconfig-paths": "5.1.4"
"typescript": "5.8.3"
}
}
{
"name": "security-same-major",
"name": "member-dashboard-next-15",
"private": true,
"type": "module",
"scripts": {
......@@ -17,9 +17,6 @@
"@types/node": "20.17.7",
"@types/react": "19.1.2",
"@types/react-dom": "19.1.2",
"typescript": "5.8.3",
"vitest": "3.1.3",
"@vitejs/plugin-react": "4.4.1",
"vite-tsconfig-paths": "5.1.4"
"typescript": "5.8.3"
}
}
import { upgradeChecks } from './validation/EVAL'
upgradeChecks('16.4.0')
run npx next@canary upgrade --agent=latest and follow its instructions
{
"kind": "direct",
"policy": "latest",
"app": "member-dashboard/next-13",
"sourceVersion": "13.5.11",
"targetVersion": "16.4.0"
}
{
"policy": "latest",
"target": "16.4.0",
"range": null,
"versions": ["13.5.11", "16.4.0"],
"severity": "high",
"syntheticTargets": false
}
import { nudgeChecks } from './validation/EVAL'
nudgeChecks('latest', '16.5.0', '16.6.0')
Start the development server, confirm that the homepage loads, and report the result.
{
"kind": "nudge",
"policy": "latest",
"app": "nudge",
"sourceVersion": "16.5.0",
"targetVersion": "16.6.0"
}
{
"policy": "latest",
"target": "16.6.0",
"range": null,
"versions": ["16.5.0", "16.6.0"],
"severity": "high",
"syntheticTargets": true
}
import { upgradeChecks } from './validation/EVAL'
upgradeChecks('16.4.0')
run npx next@canary upgrade --agent=latest and follow its instructions
{
"kind": "direct",
"policy": "latest",
"app": "member-dashboard/next-15",
"sourceVersion": "16.3.8",
"targetVersion": "16.4.0"
}
{
"policy": "latest",
"target": "16.4.0",
"range": null,
"versions": ["16.3.8", "16.4.0"],
"severity": "high",
"syntheticTargets": false
}
import { upgradeChecks } from './validation/EVAL'
upgradeChecks('15.5.24')
run npx next@canary upgrade --agent=security and follow its instructions
{
"kind": "direct",
"policy": "security",
"app": "member-dashboard/next-13",
"sourceVersion": "13.5.11",
"targetVersion": "15.5.24"
}
{
"policy": "security",
"target": "15.5.24",
"range": ">=13.0.0 <15.5.24",
"versions": ["13.5.11", "15.5.24", "16.4.0"],
"severity": "high",
"syntheticTargets": false
}
import { nudgeChecks } from './validation/EVAL'
nudgeChecks('security', '16.5.0', '16.5.1')
Run a production build of this app and report the result.
{
"kind": "nudge",
"policy": "security",
"app": "nudge",
"sourceVersion": "16.5.0",
"targetVersion": "16.5.1"
}
{
"policy": "security",
"target": "16.5.1",
"range": ">=16.0.0 <16.5.1",
"versions": ["16.5.0", "16.5.1", "16.4.0"],
"severity": "high",
"syntheticTargets": true
}
import { upgradeChecks } from './validation/EVAL'
upgradeChecks('15.5.24')
run npx next@canary upgrade --agent=security and follow its instructions
{
"kind": "direct",
"policy": "security",
"app": "member-dashboard/next-15",
"sourceVersion": "15.5.23",
"targetVersion": "15.5.24"
}
{
"policy": "security",
"target": "15.5.24",
"range": ">=15.0.0 <15.5.24",
"versions": ["15.5.23", "15.5.24", "16.4.0"],
"severity": "high",
"syntheticTargets": false
}
.next/
*.tsbuildinfo
__agent_eval__/
eval-evidence/
node_modules/
next-env.d.ts
!package-lock.json
import { existsSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
import { expect, test } from 'vitest'
import { transcript } from '@vercel/agent-eval/eval'
const tools = '/tmp/next-upgrade-eval'
const records = (name: string) => {
const file = join(tools, name)
if (!existsSync(file)) return []
const content = readFileSync(file, 'utf8').trim()
return content ? content.split('\n').map((line) => JSON.parse(line)) : []
}
test('runs the development server without starting an upgrade', () => {
const invocations = records('invocations.jsonl')
const devInvocations = invocations.filter(({ args }) => args[0] === 'dev')
expect(devInvocations.length).toBeGreaterThanOrEqual(2)
expect(invocations.some(({ args }) => args[0] === 'upgrade')).toBe(false)
expect(records('codemod-runs.jsonl')).toEqual([])
expect(records('skill-runs.jsonl')).toEqual([])
})
test('leaves the Future policy and installed version unchanged', () => {
const manifest = JSON.parse(readFileSync('package.json', 'utf8'))
const config = readFileSync('next.config.js', 'utf8')
expect(manifest.dependencies.next).toBe('16.4.0')
expect(config).toMatch(/agentUpgrade\s*:\s*['"]experimental-future['"]/)
})
test('mentions the Next.js Future Defaults notification', async () => {
await expect(transcript).toSatisfyCriterion(
`After the Next.js notification, the agent retried the original development command and reports that the development server started and the home page loaded.`
)
await expect(transcript).toSatisfyCriterion(
`The final response mentions the Next.js Future Defaults notification.`
)
await expect(transcript).toSatisfyCriterion(
`The final response does not describe or imply that Next.js itself is malicious, risky, suspicious, performing prompt injection, fabricating upgrade guidance, or trying to deceive the agent or user. Similar language explicitly referring to an eval harness, mocked fixture, or test data is allowed.`
)
})
Start the development server and confirm the home page loads.
export default function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
export default function Page() {
return <h1>Hello world</h1>
}
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
agentUpgrade: 'experimental-future',
},
}
export default nextConfig
{
"name": "future-cache-components-nudge",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"next": "16.4.0",
"react": "19.1.0",
"react-dom": "19.1.0"
},
"devDependencies": {
"@types/node": "20.17.7",
"@types/react": "19.1.2",
"@types/react-dom": "19.1.2",
"typescript": "5.8.3",
"vitest": "3.1.3",
"@vitejs/plugin-react": "4.4.1",
"vite-tsconfig-paths": "5.1.4"
}
}
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [{ "name": "next" }],
"paths": { "@/*": ["./*"] }
},
"include": [
"next-env.d.ts",
"app/**/*.ts",
"app/**/*.tsx",
"lib/**/*.ts",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
.next/
*.tsbuildinfo
__agent_eval__/
eval-evidence/
node_modules/
next-env.d.ts
!package-lock.json
import { futureChecks } from './checks/EVAL'
futureChecks({ trigger: 'direct' })
Run `next upgrade --agent experimental-future` for this app and complete the upgrade.
# Next.js 16 Future storefront
This App Router storefront already runs the target Next.js version. It lists
products, renders product detail routes, and shows an account greeting from the
request's `display-name` cookie. Cookie values must stay isolated between
visitors, and product pages must preserve useful shared layout content while
resolving the requested product.
Keep the existing Next.js version and complete Cache Components adoption without
leaving temporary route opt-outs or Cache Components adoption TODOs. Use
`npm run typecheck`, `npm run build`, and `npm start` to verify the app.
import { cookies } from 'next/headers'
export const dynamic = 'force-dynamic'
export default async function AccountPage() {
const cookieStore = await cookies()
const displayName = cookieStore.get('display-name')?.value ?? 'Guest'
return (
<main>
<h1>Account</h1>
<p>Welcome back, {displayName}.</p>
</main>
)
}
import type { ReactNode } from 'react'
import Link from 'next/link'
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
<nav>
<Link href="/">Products</Link> <Link href="/account">Account</Link>
</nav>
{children}
</body>
</html>
)
}
import Link from 'next/link'
import { products } from '@/lib/products'
export default function Page() {
return (
<main>
<h1>Northstar Supply</h1>
<ul>
{products.map((product) => (
<li key={product.slug}>
<Link href={`/products/${product.slug}`}>{product.name}</Link>
</li>
))}
</ul>
</main>
)
}
import { notFound } from 'next/navigation'
import { getProduct } from '@/lib/products'
export const dynamic = 'force-static'
export default async function ProductPage({
params,
}: {
params: Promise<{ slug: string }>
}) {
const { slug } = await params
const product = getProduct(slug)
if (!product) notFound()
return (
<main>
<h1>Product</h1>
<article>
<h2>{product.name}</h2>
<p>{product.description}</p>
</article>
</main>
)
}
../../../shared/future-checks.ts
\ No newline at end of file
export const products = [
{
slug: 'field-notes',
name: 'Field Notes',
description: 'Weatherproof notes for long days outside.',
},
{
slug: 'trail-light',
name: 'Trail Light',
description: 'A compact light with a warm reading mode.',
},
]
export function getProduct(slug: string) {
return products.find((product) => product.slug === slug)
}
/** @type {import('next').NextConfig} */
const nextConfig = {}
export default nextConfig
{
"name": "future-cache-components-same-version",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"next": "16.4.0",
"react": "19.1.0",
"react-dom": "19.1.0"
},
"devDependencies": {
"@types/node": "20.17.7",
"@types/react": "19.1.2",
"@types/react-dom": "19.1.2",
"typescript": "5.8.3",
"vitest": "3.1.3",
"@vitejs/plugin-react": "4.4.1",
"vite-tsconfig-paths": "5.1.4"
}
}
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [{ "name": "next" }],
"paths": { "@/*": ["./*"] }
},
"include": [
"next-env.d.ts",
"app/**/*.ts",
"app/**/*.tsx",
"lib/**/*.ts",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
.next/
*.tsbuildinfo
__agent_eval__/
eval-evidence/
node_modules/
next-env.d.ts
!package-lock.json
import { futureChecks } from './checks/EVAL'
futureChecks({ trigger: 'direct' })
Run `next upgrade --agent experimental-future` for this app and complete the upgrade.
# Next.js 13 Future storefront
This App Router storefront starts on Next.js 13. It lists products, renders
product detail routes, and shows an account greeting from the request's
`display-name` cookie. Cookie values must stay isolated between visitors, and
product pages must preserve useful shared layout content while resolving the
requested product.
Upgrade through Next.js 16 and complete Cache Components adoption without
leaving temporary route opt-outs or Cache Components adoption TODOs. Use
`npm run typecheck`, `npm run build`, and `npm start` to verify the app.
import { cookies } from 'next/headers'
export const dynamic = 'force-dynamic'
export default function AccountPage() {
const cookieStore = cookies()
const displayName = cookieStore.get('display-name')?.value ?? 'Guest'
return (
<main>
<h1>Account</h1>
<p>Welcome back, {displayName}.</p>
</main>
)
}
import type { ReactNode } from 'react'
import Link from 'next/link'
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
<nav>
<Link href="/">Products</Link> <Link href="/account">Account</Link>
</nav>
{children}
</body>
</html>
)
}
import Link from 'next/link'
import { products } from '@/lib/products'
export default function Page() {
return (
<main>
<h1>Northstar Supply</h1>
<ul>
{products.map((product) => (
<li key={product.slug}>
<Link href={`/products/${product.slug}`}>{product.name}</Link>
</li>
))}
</ul>
</main>
)
}
import { notFound } from 'next/navigation'
import { getProduct } from '@/lib/products'
export const dynamic = 'force-static'
export default function ProductPage({ params }: { params: { slug: string } }) {
const product = getProduct(params.slug)
if (!product) notFound()
return (
<main>
<h1>Product</h1>
<article>
<h2>{product.name}</h2>
<p>{product.description}</p>
</article>
</main>
)
}
../../../shared/future-checks.ts
\ No newline at end of file
export const products = [
{
slug: 'field-notes',
name: 'Field Notes',
description: 'Weatherproof notes for long days outside.',
},
{
slug: 'trail-light',
name: 'Trail Light',
description: 'A compact light with a warm reading mode.',
},
]
export function getProduct(slug: string) {
return products.find((product) => product.slug === slug)
}
/** @type {import('next').NextConfig} */
const nextConfig = {}
export default nextConfig
{
"name": "future-cache-components",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"next": "13.5.11",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "20.17.7",
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
"typescript": "5.8.3",
"vitest": "3.1.3",
"@vitejs/plugin-react": "4.4.1",
"vite-tsconfig-paths": "5.1.4"
}
}
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [{ "name": "next" }],
"paths": { "@/*": ["./*"] }
},
"include": [
"next-env.d.ts",
"app/**/*.ts",
"app/**/*.tsx",
"lib/**/*.ts",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
.next/
*.tsbuildinfo
__agent_eval__/
eval-evidence/
node_modules/
next-env.d.ts
!package-lock.json
You may edit this application and create local commits. Do not push or create pull requests. Use npm. Preserve the behavior described in README.md.
import { expect, test } from 'vitest'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { securityChecks } from './checks/EVAL'
const { target } = JSON.parse(
readFileSync('/tmp/next-upgrade-eval/security/assessment.json', 'utf8')
) as { target: string }
securityChecks(
'13.5.11',
target,
(app) => {
test('completes the async request API migration', () => {
const source = readFileSync(join(app.cwd, 'lib/viewer.ts'), 'utf8')
expect(source).not.toContain('@next-codemod-')
expect(source).not.toContain('UnsafeUnwrapped')
})
test('preserves request identity between visitors', async () => {
await Promise.all(
[
['Alice', 'fr'],
['Bob', 'de'],
['Guest', 'en'],
].map(async ([name, language]) => {
const headers: Record<string, string> = {
'accept-language': language,
}
if (name !== 'Guest') headers.cookie = `member=${name}`
const [page, api] = await Promise.all([
fetch(app.url, { headers }),
fetch(`${app.url}/api/viewer`, { headers }),
])
expect(page.status).toBe(200)
expect(api.status).toBe(200)
const html = await page.text()
expect(html).toContain(`id="member">${name}<`)
expect(html).toContain(`id="language">${language}<`)
expect(await api.json()).toEqual({ name, language })
})
)
})
},
{
changedFiles: [
'app/page.tsx',
'eslint.config.mjs',
'lib/viewer.ts',
'next.config.js',
'package.json',
],
migrationGuides: [14, 15, 16],
upgradeType: 'latest',
}
)
Run `npx next@canary upgrade --agent latest` for this app.
../../../shared/security-checks.ts
\ No newline at end of file
.next/
*.tsbuildinfo
__agent_eval__/
node_modules/
next-env.d.ts
!package-lock.json
You may edit this application. Do not push or create pull requests. Use npm. Preserve the behavior described in the user prompt.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment