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 inspect the eval API schema and route, identify existing pagination-cap conventions, then implement the exported
EVAL_TABLE_MAX_PAGE_SIZEconstant and apply it only to non-export validation. I’ll run focused tests (and relevant type/lint checks if available), review the diff, and submit once verified. - Assistant
rgis unavailable in this environment, so I’ll use the available Unix tools (grep,find, andsed) to trace the implementation and conventions. - Assistant
The endpoint’s query schema currently enforces only positivity, while the UI already offers
1000as its largest option but hardcodes it. I’ll add the requested literal constant, use.max(EVAL_TABLE_MAX_PAGE_SIZE)in the schema, and replace the UI’s hardcoded 1000 option with the shared constant. Export handling remains unchanged: once a valid request includesformat, the route still usesNumber.MAX_SAFE_INTEGER. - Assistant
The environment lacks
python, so the first edit command made no changes. I’ll perform the same exact replacements with a short Node script, then inspect and test the result. - Assistant
The focused test command reached Vitest but used Jest’s unsupported
--runInBandflag; no tests ran and the working tree contains only the intended two source changes. I’ll rerun the same focused files using Vitest’s supported options. - Assistant
On review, the requirement says the cap is specifically for non-export requests, so I’m tightening the implementation to preserve the exemption even when an export supplies an explicit large
limit. The schema will validate positivity for all requests and add the 1000 upper-bound issue only whenformatis absent; the route’s existing unlimited export branch remains untouched. - Assistant
Focused tests pass after the conditional exemption, and Biome plus whitespace checks pass. The OpenAPI check cannot run because this checkout lacks the generated
site/static/openapi.json; it did not modify files. I’ll do a direct schema smoke check for over-cap normal input, capped input, and over-cap export input, then review the final diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.