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, UI pagination, and existing tests, then implement the 1000-row cap while preserving export behavior.
- Assistant
rgisn’t installed in this checkout, so I’m using the repository’s available search tools. The working tree is clean. - Assistant
The route already overrides pagination with
Number.MAX_SAFE_INTEGERwheneverformatis present. I’ll enforce the cap conditionally in the shared Zod query schema, then use the same exported constant to generate the UI’s page-size choices so the client and server cannot drift. - Assistant
The cap is now conditional:
limit=1001fails withoutformat, while export queries remain valid and the route still replaces their limit withNumber.MAX_SAFE_INTEGER. I’ve also replaced the UI’s hardcoded menu markup with options filtered by the shared cap. Next I’m running focused schema, route, export, and frontend checks. - Assistant
This environment does not have
nvminstalled, so I can’t perform the requested version switch. I’ll verify the active Node/npm versions against the repository requirement and continue with the local toolchain if compatible. - Assistant
The backend/schema/export suite passes (46 tests). The repository’s changed-file formatter assumes an
origin/mainref, which is absent in this local checkout, so I’m formatting the four touched files directly with the same formatter and then checking both TypeScript projects. - Assistant
Core type-checking is clean. I’m doing the final frontend-specific type check and the focused ResultsTable test now; this validates that importing the shared runtime constant works in the Vite workspace and that pagination behavior remains intact.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.