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 conventions and tests, then implement the exported
EVAL_TABLE_MAX_PAGE_SIZE = 1000constant and apply it only to non-export validation. I’ll run focused tests and review the diff before submitting. - Assistant
The relevant code is in
src/types/api/eval.tsandsrc/server/routes/eval.ts. I’ll now inspect the query schema, route’s export/page branching, and nearby schema tests to ensure the cap is represented as the requested public constant and validation produces the standard 400 response. - Assistant
The schema must be conditional rather than a plain
.max(1000), because a plain max would incorrectly reject exports before the route can applyNumber.MAX_SAFE_INTEGER. I’ll add a refinement that requireslimit <= EVAL_TABLE_MAX_PAGE_SIZEonly whenformatis absent, and update the UI’s 1000 option to use the shared constant. - Assistant
The first edit command could not run because this environment lacks
python; no files were changed. I’ll apply the same targeted replacements using Node, which is available in the repository toolchain. - Assistant
The implementation is now in place. The route already validates the query before fetching the eval and already switches to
Number.MAX_SAFE_INTEGERwheneverformatis present, so no route logic change is needed; the conditional schema preserves that export behavior while rejecting oversized page requests with a limit validation error. I’ll run the type check and focused schema/route/export tests. - Assistant
The initial verification command exposed two tooling invocation issues rather than code failures: Vitest does not support Jest’s
--runInBand, and TypeScript rejects explicitly disabling incremental compilation for this composite project. I’ll rerun Vitest correctly and use the repository’s normalnpm run tsccommand. - Assistant
Focused tests all pass (44 tests), the normal root TypeScript check passes, and the diff has no whitespace errors. The repository-wide lint reports pre-existing complexity violations in unrelated files; I’ll run the app TypeScript check and lint only the two modified files, then inspect the final diff.
- Assistant
The app TypeScript check passes. Biome found only a formatting difference in the new refinement; I’ll apply that formatter-required layout and rerun the focused checks.
- Assistant
All focused tests pass again (44/44), both root and app TypeScript checks pass, and modified files satisfy Biome. I’ll do one final direct boundary check (
1000accepted,1001rejected, and export with1001accepted), review status, then submit. - Assistant
The boundary-check command was blocked by Bash history expansion on
!at.success; this is only a shell quoting issue and did not affect the repository. I’ll rerun it with a quoted script.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.