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 repository structure and finding the relevant files mentioned in the issue.
Assistant
Let me start by exploring the relevant files.
Assistant
Now let me find the route handler for the eval table endpoint.
Assistant
Let me look at the existing tests to understand what's expected.
Assistant
Let me look at the export test to understand how format exports are tested.
Assistant
Let me check the zod version and how prettifyError works.
Assistant
Let me check how prettifyError formats errors in zod v4.
Assistant
Let me check how superRefine/addIssue is used elsewhere in the repo.
Assistant
Now I have a clear pattern. Let me implement the changes in
src/types/api/eval.ts.Assistant
Now let me apply the edit:
Assistant
I'll use the edit command instead.
Assistant
Let me check if the UI references page size options for the eval table, and whether the constant should be exported.
Assistant
The UI uses pageSize options. Let me check the page-size selector around ResultsTable.tsx:2459 to see what options are offered. The issue says "UI pagination controls derive their available page-size options from this value." This is descriptive in the interface section but it's not strictly required to change the UI. The issue's main proposed change is the server-side cap. Let me focus on the core requirement but check the page-size selector options to ensure they don't exceed 1000.
Assistant
The UI already caps at 1000, matching my constant. Now let me write a quick reproduction script to verify the schema behavior.
Assistant
The test files are filtered to
test/**/*.test.ts. Let me put the test inside the test directory.Assistant
All pass. Now let me run the existing eval validation and export tests to ensure nothing broke.
Assistant
Now let me also verify the route-level behavior with a route test, and run the broader eval test suite. Let me first check the route validation test setup to write a temporary route-level test.
Assistant
The route returns 400 for excessive non-export limits. Now let me clean up the temporary test files and run the broader server test suite.
Assistant
The
eval.filteredMetrics.test.tsfailure is a DB migration/environment issue (better-sqlite3), unrelated to my change. Let me verify it fails the same way without my change.Assistant
Confirmed — that test fails identically without my change (pre-existing DB environment issue). Now let me run the broader eval route tests and the schema test.
Assistant
Let me check whether the serverApiSchemas test references the eval table limit, to ensure consistency.
Assistant
Let me review the final diff.
Assistant
Let me check if any consumer relies on
EvalTableQuerySchemabeing a plainz.object(e.g., uses.extend,.pick,.shape).Assistant
No problematic consumers. Let me run a TypeScript typecheck to be safe.
Assistant
Let me run the full typecheck to ensure no errors anywhere.
Assistant
TypeScript passes cleanly. Let me clean up the temp repro file (already removed) and confirm git status.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.