test: evals per-case QA tests and inlined suites#16424
Merged
Conversation
Move the duplicated beforeAll API key guard from 10 spec files into globalSetup.ts setup(). Remove redundant dotenv import from systemPrompts.ts and use node: prefixed imports.
Each QA dataset case now registers as its own vitest it() block instead of being batched into a single accuracy assertion. This surfaces per-question pass/fail in vitest output and enables targeted re-runs via -t filtering. - Extract runQACase from runDataset for per-case invocation - Extract registerQACases / registerCodegenCases helpers - Inline 10 suite files into the spec files that consume them - Switch assert() to expect() for native vitest reporter integration - Enrich failureMessage and caseFailureMessage with answer + reasoning - Add fixtures/ambient.d.ts for @/* and ~/* path aliases in codegen
The suite-level accuracy gate was removed when QA tests were split into per-question cases. SCORE_THRESHOLD remains for per-case pass/fail.
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
Member
Author
|
Failures are flakes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Refactors the eval suite to surface per-question pass/fail in vitest output and reduces boilerplate by inlining suite registration into the spec files.
Key Changes
Per-question test reporting
it()that asserted on aggregate accuracy. Each question now registers as its ownit()block insidedescribe.concurrent, so vitest reports pass/fail per question and-tfiltering targets individual cases.runQACasefromrunDatasetfor per-case invocation.runDatasetstill exists as a wrapper that maps over cases and aggregates accuracy for the snapshot output.Inlined suite registration
register*Suite()functions insuites/were thin wrappers around two patterns. Replaced withregisterQACasesandregisterCodegenCaseshelpers insuites/helpers.ts; each spec file calls these directly with its dataset and label.suites/directory now contains onlyhelpers.tsandtypes.ts.describe('Collections')/describe('CRUD')).API key check in globalSetup
beforeAllAPI key guard from 10 spec files moved intoglobalSetup.setup(). Spec files no longer importbeforeAllor repeat the check.Richer failure output
failureMessageandcaseFailureMessagenow include the model answer and scorer reasoning inline in the vitest assertion message.assert(condition, message)calls in suites toexpect(value, message).toBe(...)for native vitest reporter integration.Path alias support in fixture type-checking
fixtures/ambient.d.tswith wildcard module declarations for@/*and~/*. The per-invocation tsconfig invalidate.tsincludes this file so LLM-generated configs that import from common path aliases type-check structurally without requiring real stub files per fixture.Removed unused ACCURACY_THRESHOLD
SCORE_THRESHOLD(per-case pass criterion for the LLM judge) remains.Cleanup
dotenv.config()fromrunner/systemPrompts.ts(vitest setup already loads.env).fs/pathimports tonode:prefixed.Design Decisions
Per-case over batched assertions: The batched
it()masked individual failures behind aggregate accuracy. With 30+ questions per dataset, the visibility tradeoff favored splitting. Each case now asserts independently and aggregate metrics are computed at snapshot/reporting time rather than in test code.Inlining over indirection: With variant selection moved to a runtime env var (
EVAL_VARIANTviaresolveVariantOptions()), each spec calls register once. Theregister*Suite()function abstraction added a layer with no remaining purpose. Inlining puts the suite definition (name, datasets, structure) in one file the reader can scan top to bottom.expectoverassert: Both work, butexpectintegrates with vitest's reporter so the custom failure message is rendered alongside the standard test output rather than as a rawAssertionError.Ambient module declarations over per-fixture stub files: LLMs commonly generate imports from
@/components/...paths. Maintaining real stub files per import path would not scale. Wildcard module declarations let any@/*import resolve toany, which is sufficient for structural type-checking.Overall Flow
flowchart TB subgraph Before A1[spec file] A1 --> A2[register Suite function] A2 --> A3[runDataset] A3 --> A4[Promise.all over cases] A4 --> A5[Single it asserts aggregate accuracy] end subgraph After B1[spec file] B1 --> B2[registerQACases helper] B2 --> B3[describe.concurrent] B3 --> B4[it per case] B4 --> B5[runQACase] B5 --> B6[expect with rich message] end