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 so we can add a non-export page size cap.
- Assistant
I'll inspect the eval API schema, table route, and related tests next.
- Assistant
Let me continue reading the eval types and the route handler.
- Assistant
Hmm, the ripgrep returned empty. Maybe path issues. Let me try differently.
- Assistant
rg is not found now - earlier it worked somehow via find. Let me use grep.
- Assistant
I'll inspect the table route validation flow and existing limit-handling patterns.
- Assistant
I'll check whether the frontend uses page-size constants and how similar max limits are defined elsewhere.
- Assistant
I'll look for UI pagination options for the eval table and any existing constant patterns.
- Assistant
I'll check how the page-size selector is defined in ResultsTable.
- Assistant
I'll check how exports send the limit parameter and whether the schema needs format-aware validation.
- Assistant
There's already a validation test for limit. Let me look at that and the download utils.
- Assistant
I'll check how the UI imports from types and whether zod uses
.max()with.prefault(). - Assistant
I'll confirm how the types package is exposed to the UI and then apply the constant and schema cap.
- Assistant
Let me check the vite alias for @promptfoo/types
- Assistant
Implementing the constant and schema max cap, and updating the UI page-size options to use it.
- Assistant
I accidentally dropped the
offsetfield — restoring it now. - Assistant
Next I'll update the ResultsTable page-size selector to derive options from the constant.
- Assistant
I need to see more of the imports and add EVAL_TABLE_MAX_PAGE_SIZE.
- Assistant
I'll add the import and update the page size select. Keep it minimal - derive options from the constant.
- Assistant
I'll add import after FILE_METADATA_KEY import and define PAGE_SIZE_OPTIONS constant near the component or before the select.
- Assistant
Updating the page size selector to use options derived from the constant.
- Assistant
Now replace the SelectItem hardcoding with a map over RESULTS_TABLE_PAGE_SIZE_OPTIONS.
- Assistant
Need to navigate to that location first.
- Assistant
Now I can replace.
- Assistant
Verifying schema behavior and running the relevant tests.
- Assistant
Making the limit cap format-aware so export requests remain exempt from the max.
- Assistant
.max()is the right approach—exports ignorelimitand force unlimited. Running related tests next. - Assistant
I'll quickly confirm the route returns 400 for an oversized non-export limit.
- Assistant
Running a broader set of related tests and verifying the validation error path.
- Assistant
I'm checking whether importing the API eval module into the UI would pull heavy dependencies into the bundle.
- Assistant
Reverting the UI value import—it would pull zod into the frontend bundle; other app imports from that module are type-only.
- Assistant
Need to goto first
- Assistant
I'll restore the original page-size selector to avoid a runtime import of the Zod-heavy API module in the UI.
- Assistant
I still need to remove the constant usage and restore the original SelectItems.
- Assistant
Now restore SelectItems.
- Assistant
Need to restore the original select items.
- Assistant
I'll confirm only the intended schema change remains.
- Assistant
Final verification of the schema behavior and related tests.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.