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 first inspect the repository structure and locate the eval API schemas, route implementation, UI pagination usage, and related tests. Then I’ll reproduce the schema’s current acceptance of an oversized limit before making the smallest consistent change.
- Assistant
The query schema currently applies only positivity, confirming the reported gap. Since exports must bypass the cap, a simple
.max()onlimitwould incorrectly reject export queries before route logic runs. I’ll inspect how the schema namespace is assembled, how request validation is performed, and how the route overrides export limits, plus locate UI page-size constants/options. - Assistant
Relevant route and validation/export tests already exist. I’ll read those sections and search the
sitefrontend as well, because the requested constant explicitly serves both server enforcement and UI pagination option derivation. - Assistant
The export test is mostly a simplified behavioral unit rather than invoking the route, while route validation tests use Supertest and can verify an actual 400. I need identify the actual table UI and current options (possibly named
rowsPerPageor numeric arrays), and inspect the full table-validation test setup to ensure a server test run will exercise the change. - Assistant
The primary frontend is now under
src/app, notsite; I’ll search there. The key schema design should be conditional: parse/coerce the object, then rejectlimit > 1000only whenformatis absent. Zod’s.superRefine()is appropriate and preserves exports with even explicitly oversized limits, after which route logic still substitutesNumber.MAX_SAFE_INTEGER. - Assistant
I found the eval-specific pagination control. I’ll inspect its option list and imports to wire it to the shared API constant without violating frontend architecture boundaries. I’ll also use a one-line TypeScript execution to explicitly reproduce that
1001currently parses successfully. - Assistant
Reproduction confirms
safeParse({ limit: '1001' })returnstrue. The UI already offers 10/50/100/500/1000, but the top value is hardcoded; “derive their available page-size options from this value” suggests defining the candidates once and filtering by the exported cap. I’ll verify alias exports/resolution, then implement the constant and conditional schema refinement. - Assistant
I’ll now add the literal
EVAL_TABLE_MAX_PAGE_SIZE = 1000, conditionally report a Zod issue atlimitonly for non-export requests, and replace the repeated JSX options with a capped option array. This keepsformat=csv/json&limit=1001valid while ensuring normal requests fail validation before any eval lookup/data load. - Assistant
The edit script did not run because this image lacks Python, so no repository changes occurred; the follow-up probe’s
undefinedcap confirms that. I’ll apply the same edits using the providededit/replacecommands instead, then rerun formatting and the boundary matrix. - Assistant
The chained special commands partially applied: the schema and option-array insertion succeeded, but the import and JSX replacement did not. I’ll inspect exact current snippets and complete those two edits.
- Assistant
I’ll insert the missing runtime import and replace the exact selector lines by line range, then format and verify schema behavior again.
- Assistant
The line-range replacement swallowed the
</SelectTrigger>line because the inserted import shifted the target by one. I’ll restore that closing tag, then run formatting and behavior checks. - Assistant
The boundary matrix now behaves correctly: 1000 is accepted, 1001 is rejected without
format, and oversized CSV/JSON queries remain accepted. Next I’ll run the affected schema, route-validation, export, and ResultsTable tests, followed by TypeScript checking to catch Zod issue typing and frontend import/build concerns. - Assistant
All targeted tests (143 total across server/schema/UI) and full TypeScript checking passed. I’ll perform two final validations: invoke the real Express route with Supertest for an oversized non-export query to confirm HTTP 400 occurs before model access, and run the architecture-boundary checker because the UI now has a runtime import from the shared API type module. Then I’ll review the final diff/status.
- Assistant
The real-route probe command itself failed before execution because
tsx -eemits CommonJS and disallows top-level await; this is unrelated to the implementation. I’ll wrap it in an async function and rerun the probe and remaining checks.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.