Cap eval table page size for non-export requests Summary GET /api/eval/:id/table accepts…
- User
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. - Add a maximum
- Assistant
Now let me check who calls this endpoint with
limit, especially export callers that might pass a huge limit in the query string: - Assistant
Let me check the UI pagination page-size options and existing tests:
- Assistant
Check whether the app workspace imports from
src/types: - Assistant
Now I'll implement. First, the schema and constant in
src/types/api/eval.ts: - Assistant
Now update the UI page-size selector in
ResultsTable.tsxto derive its options from the constant. First check the imports section: - Assistant
Now replace the hardcoded SelectItems with options derived from
PAGE_SIZE_OPTIONS: - Assistant
Now update the schema tests. Check imports in the test file:
- Assistant
Now the route validation test:
- Assistant
Now run the tests. First check node version alignment, then run the affected suites:
- Assistant
Now run the frontend ResultsTable tests and typecheck both projects:
- Assistant
Typechecks pass. Let me quickly check
evalTableUtils.ts:375to make sure there isn't another unbounded path affected: - Assistant
Done. The cap is implemented, tested, and verified.
Changes
src/types/api/eval.ts- Added exported constant
EVAL_TABLE_MAX_PAGE_SIZE = 1000(src/types/api/eval.ts:93). - Added a
.refine()toEvalTableQuerySchemathat rejectslimit > 1000. Export requests (/) are exempt because the route already replaces with for exports (src/server/routes/eval.ts:337) — an oversized on an export URL is ignored, not rejected, so existing export clients keep working.
- Added exported constant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.