mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
0240fd39a5
Fixes false-negative regex assertions — observed rejecting correct solutions in recent eval runs — by grading those specific checks with `@vercel/agent-eval`'s agentic LLM judge instead. Only the assertions with demonstrated false negatives change; every deterministic check stays. - `agent-034-async-cookies`: `/await\s+cookies\s*\(\s*\)/` only matched the naive `await cookies()` and rejected the correct (arguably better) `await Promise.all([cookies(), headers()])` — observed failing most runs of a strong model — and the no-sync-call lookbehind wrongly flagged the bare `cookies()` inside the array. The four await-mechanics tests collapse into one judge criterion: the promises must actually be awaited before use, in any correct form. The theme-cookie and Accept-Language content checks stay regex. - `agent-030-app-router-migration-hard`: the home-page test rejected solutions that didn't match one exact shape (e.g. data fetching extracted to a helper means no literal `fetch(` in `page.tsx`). Its body becomes one judge criterion (async Server Component, fetches during server render, no `getServerSideProps`); the file-existence check and the other seven tests stay deterministic. The judge is pinned to **`claude-haiku-4-5`** in the generated experiment configs — a cheap fixed grader, identical for every run regardless of the model under test. Each criterion states the requirement semantically, includes one reference solution to ground the small grader, and fixes the standard of judgment (runtime correctness, not style) — no enumerated failure modes, so the judge stays flexible about equivalent forms. Supporting changes: bumps `@vercel/agent-eval` `0.9.5` → `1.3.0` (ships the judge runtime) and adapts `run-evals.js` to the 1.3 CLI (`run baseline agents-md --force`; `--dry` maps to `status`); generated experiments now run through the Vercel AI Gateway so `vc env pull` is the only credential setup; converted fixtures exclude `EVAL.ts` from tsconfig (the `@vercel/agent-eval/eval` import has no type declarations — vercel-labs/agent-eval#166 — and `next build` type-checks the fixture, so experiments running `scripts: ['build']` would otherwise fail on it, same reason `EVAL.tsx` was already excluded). Not converted: `agent-040` (already redesigned upstream in #94578) and `agent-041` (no diagnosed false negative in the report). Verified end-to-end from this repo: converted `agent-034` with codegen `claude-sonnet-4-5` via the AI Gateway in a Vercel sandbox, judge pinned to `claude-haiku-4-5` — passes, with the judge clause executing in-sandbox. **Running it:** ```bash pnpm install # picks up @vercel/agent-eval 1.3.0 pnpm --filter=next build # pnpm eval packs the locally built next vc env pull .env.local # the only credential: sandbox + AI Gateway (codegen and judge) pnpm eval agent-034-async-cookies # baseline + AGENTS.md variants pnpm eval agent-034-async-cookies --dry # preview only ``` <!-- NEXT_JS_LLM_PR -->
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
import { defineConfig } from 'eslint/config'
|
|
import baseConfig from './eslint.config.mjs'
|
|
|
|
export default defineConfig([
|
|
{
|
|
extends: [baseConfig],
|
|
},
|
|
{
|
|
files: ['**/*.ts', '**/*.tsx'],
|
|
// This override adds type-checked rules.
|
|
// Linting with type-checked rules is very slow and needs a lot of memory,
|
|
// so we exclude non-essential files.
|
|
// NOTE: eslint.config.mjs has a config block that mirrors these
|
|
// `files`/`ignores` to override non-type-checked rules for the same set of
|
|
// files. Keep both in sync if you change the globs.
|
|
ignores: [
|
|
'bench/**/*',
|
|
// Eval fixtures are sandbox workspaces with their own package.json and
|
|
// tsconfig, not repo code — EVAL.ts files may import modules that only
|
|
// resolve inside the sandbox (e.g. @vercel/agent-eval/eval).
|
|
'evals/evals/**/*',
|
|
'examples/**/*',
|
|
'test/**/*',
|
|
'**/*.d.ts',
|
|
'turbopack/**/*',
|
|
],
|
|
languageOptions: {
|
|
parserOptions: {
|
|
project: true,
|
|
},
|
|
},
|
|
// These rules are added on top of the rules that are declared in
|
|
// the base config for the matching files.
|
|
rules: {
|
|
// TODO: enable in follow-up PR
|
|
'@typescript-eslint/no-floating-promises': 'off',
|
|
'@typescript-eslint/switch-exhaustiveness-check': [
|
|
'error',
|
|
{ requireDefaultForNonUnion: true },
|
|
],
|
|
},
|
|
},
|
|
])
|