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 eval table schema, route, and UI pagination together, then add focused schema/route/export coverage. I’ll preserve the existing unlimited export path exactly as specified.
- Assistant
rgisn’t installed in this checkout, so I’m usingfind/grepfor the same repository-local inspection. I’ll also load the directory-specific guidance before editing. - Assistant
The endpoint uses one shared query schema, so the cap must be conditional at the object level: oversized
limitvalues are invalid only whenformatis absent. I’m also replacing the UI’s hard-coded page-size entries with a list filtered by the shared constant, so future cap changes cannot expose an invalid option. - Assistant
The implementation and regression coverage are in place. I’m now running the focused schema and live Express-route tests under the repository’s pinned Node version; after that I’ll run frontend/root type checks and changed-file lint/format checks.
- Assistant
This environment doesn’t have
~/.nvm/nvm.sh, so the prescribed version switch is unavailable. I’m checking the installed Node/npm versions against.nvmrcand will proceed if they already satisfy the repository engines. - Assistant
Focused backend tests pass (34), including the real route rejecting
1001and preservingNumber.MAX_SAFE_INTEGERfor JSON export. The ResultsTable suite also passes (71); I’m doing compiler and changed-file hygiene checks now. - Assistant
Both root and frontend TypeScript checks pass. The repository’s
npm run lhelper assumes anorigin/mainref that this detached checkout does not contain, then accidentally invoked Biome without file arguments; I’m replacing it with equivalent explicit checks on only the four changed files. - Assistant
All focused tests now cover both CSV and JSON export exemptions (36 backend tests total), and formatting made only the expected test indentation changes. I’m running the production build as the final integration check because the UI now imports the shared runtime constant.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.