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 start by exploring the codebase to find the eval table API schema and route handling for the
limitparameter. - Assistant
Next I'll inspect the eval API types and route handlers for how
limitis validated. - Assistant
Let me look at more of the eval types file and the route handling, as well as similar patterns in the codebase.
- Assistant
rg is not available, let me use grep instead.
- Assistant
Let me look at how other APIs bound page sizes and look at the EvalSchemas structure.
- Assistant
I'll check existing tests and any UI page-size usage tied to this endpoint.
- Assistant
Let me look at how the eval results table pagination works in the UI and existing tests for EvalSchemas.
- Assistant
I'll inspect the existing eval table validation tests and related schema coverage next.
- Assistant
Let me look at how ResultsTable determines page size options and validation tests more carefully.
- Assistant
I'll inspect package exports and how the app imports shared types/constants.
- Assistant
I'll check how openapi schemas are generated and whether architecture constraints block this constant.
- Assistant
Checking how downloads invoke the table export endpoint.
- Assistant
Implementing the constant and applying the non-export
limitcap in the schema. - Assistant
Checking the Zod version and how similar validations construct issue objects.
- Assistant
Using
.max()is simpler and more consistent with other schemas—I'll check Zod 4's max API and simplify. - Assistant
Checking other callers of the table endpoint for large export limits.
- Assistant
I'll verify the superRefine path works, then wire the UI to the shared constant.
- Assistant
Updating the UI page-size options so they derive from the shared max constant.
- Assistant
I'll update the ResultsTable import and page-size selector now.
- Assistant
Need to open the file first for replace command
- Assistant
Now I'll wire the page-size selector options to that constant.
- Assistant
I'll define
EVAL_TABLE_PAGE_SIZE_OPTIONSnext to the other table constants. - Assistant
Need to navigate to line 32 first.
- Assistant
I'll move that constant below the imports so the file stays clean.
- Assistant
Simplifying the UI wiring so only the max page-size option uses the shared constant.
- Assistant
I'll restore the Select options and bind the max choice to
EVAL_TABLE_MAX_PAGE_SIZE. - Assistant
I'm verifying app import resolution and whether we should keep the UI changes.
- Assistant
I'll check OpenAPI generation for the table query schema next and then run the related tests.
- Assistant
Switching to
.max()so the cap is documented in OpenAPI and matches other list APIs. - Assistant
Running the related schema and validation tests under the new limit cap.
- Assistant
I'll manually confirm the schema rejects oversize limits and still accepts export queries.
- Assistant
Checking the full diff and running a few more related eval route tests.
- Assistant
Inspecting the Results table diff and verifying any OpenAPI tests that need to still pass.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.