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
I’ll trace the shared eval schema, table route, and UI pagination usage, then add the constant and focused regression tests while preserving export behavior.
- Assistant
rgisn’t installed in this workspace, so I’m using targetedfind/grepsearches instead. I’m also checking the directory-specific guidance before editing. - Assistant
The UI already offers page sizes through 1000, so I’ll make those options data-driven from the new shared constant. The query schema will conditionally enforce the cap only when
formatis absent; CSV/JSON requests will still parse and the route will continue replacing their limit withNumber.MAX_SAFE_INTEGER. - Assistant
The initial test command hit an environment mismatch because this container has no NVM installation. I’ll verify the installed Node/npm versions directly and continue with the focused tests and compilers under the available runtime.
- Assistant
The changed-file formatter assumes an
origin/mainref that is absent in this checkout and failed before useful validation. I’m formatting the four touched TypeScript files explicitly, then rerunning schema, route, and OpenAPI tests. - Assistant
The focused backend and OpenAPI suites pass, including the oversized export case using
Number.MAX_SAFE_INTEGER. I’m doing the final root and frontend type checks now, since the shared constant is imported into the app workspace at runtime.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.