ISSUE DESCRIPTION Cap eval table page size for non-export requests Summary GET…
- User
ISSUE DESCRIPTION
Cap eval table page size for non-export requests
Summary
GET /api/eval/:id/tableaccepts any positive integer forlimiton normal table requests. The route already intentionally treats export requests differently by usingNumber.MAX_SAFE_INTEGERwhenformatis set, but non-export page requests currently do not have an upper bound.Why this matters
A very large
limitcan make a normal table request ask the server to load and serialize a large amount of eval result data in one response. Other list-style APIs in the server already bound their page sizes, so the eval table endpoint should follow the same resource-control pattern.Proposed change
- Add a maximum
limitfor non-exportGET /api/eval/:id/tablerequests. - Keep
format=csv/format=jsonexports unchanged so full-table exports still work as intended. - Return validation errors for excessive non-export limits, consistent with nearby API schema validation.
A cap of
500or1000would likely cover normal UI usage while preventing accidental oversized page requests.Validation
Suggested tests:
- schema test rejects
EvalSchemas.Table.Query.safeParse({ limit: '<cap + 1>' }) - route validation test returns
400for excessive non-exportlimit - export route tests continue to use
Number.MAX_SAFE_INTEGERwhenformatis present
Interface
Type: Constant Name: EVAL_TABLE_MAX_PAGE_SIZE Path: src/types/api/eval.ts Value/Type: constant literal value 1000 (number) Description: Server-enforced upper bound for the
limitparameter on non-export eval table page requests. Exports usingformat(csv/json) are exempt from this cap; UI pagination controls derive their available page-size options from this value.ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Add a maximum
- Assistant
I'll explore the repository structure and locate the eval table API schema and route handling to add a page-size cap for non-export requests.
- Assistant
I'll inspect the eval API types, route handler, and related tests next.
- Assistant
Let me look at how the route handles limit and format, and how other APIs bound their page sizes. Also the tests and namespace structure (EvalSchemas.Table.Query).
- Assistant
Looking into the route handler and how EvalSchemas is structured.
- Assistant
rg is not available, let me use grep instead.
- Assistant
I'll check how query validation works in the route and whether the UI uses a page-size constant.
- Assistant
Checking the UI for page-size options and any recent related commits.
- Assistant
Let me look at ResultsTable pagination options - where page sizes are defined.
- Assistant
Checking how the app imports shared types and constants.
- Assistant
Let me check if types/api/eval is exported via @promptfoo/types
- Assistant
Checking how the UI handles CSV/JSON export and whether it receives a large limit.
- Assistant
Implementing the constant and schema cap. Checking OpenAPI generation for impact.
- Assistant
Implementing the constant and schema change, then wiring the UI to use it.
- Assistant
Restoring the accidentally removed
offsetfield. - Assistant
Restoring the missing
searchfield as well. - Assistant
Updating UI pagination to use the shared max page-size constant.
- Assistant
I'll update ResultsTable to import EVAL_TABLE_MAX_PAGE_SIZE and use it. Create a page sizes array derived from the constant.
- Assistant
Fixing the duplicated import statement.
- Assistant
Adding page-size options derived from the constant and wiring them into the Select.
- Assistant
Now update the SelectItems to use EVAL_TABLE_PAGE_SIZE_OPTIONS
- Assistant
Let me see lines around the SelectContent
- Assistant
Need to use comma not colon for sed ranges
- Assistant
I'll replace hardcoded SelectItems with a map over EVAL_TABLE_PAGE_SIZE_OPTIONS
- Assistant
Verifying schema behavior and running the relevant tests.
- Assistant
Schema looks good. Running the related tests next.
- Assistant
Confirming the route returns 400 for oversized limits, and checking whether OpenAPI needs regenerating.
- Assistant
Checking architecture boundaries and git diff for completeness.
- Assistant
Running ResultsTable tests and a quick route-level check for the oversized-limit case.
- Assistant
The app tests timed out. Let me try running just the ResultsTable app test separately with a longer approach or skip if too heavy.
- Assistant
There's an
invariant is not definederror — checking whether the import was removed by mistake. - Assistant
Restoring the accidentally removed
invariantimport. - Assistant
I may have introduced a double
import {again. Checking that now. - Assistant
Imports look correct. Re-running the pagination tests.
- Assistant
Verifying the full route returns 400 for oversized non-export limits.
- Assistant
Let me put the script in the repo root instead.
- Assistant
Final review of the complete diff, then submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.