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
Let me explore the repository structure and find the relevant files.
Assistant
Now let me look at the route handler and how exports are handled.
Assistant
Now let me look at the schema's
limitfield and understand how to add the cap. Let me check for any existing tests.Assistant
Now let me look at the route test file if it exists.
Assistant
Now let me check the export test file to understand expectations.
Assistant
Now I understand the structure. Let me implement the change. First, add the constant and cap in the schema.
Assistant
Let me check the UI for page size options.
Assistant
The UI part is optional; the core change is the constant and cap. Let me implement the change in the schema.
Assistant
Now let me implement the change. I'll add the constant and use a
superRefineto cap non-export limits.Assistant
Let me check the zod version to ensure
too_bigissue code is supported.Assistant
Let me write a quick test to verify the schema behavior.
Assistant
I'll put the test in the test directory.
Assistant
The sed mangled the import path. Let me fix it.
Assistant
All tests pass. Let me check the error message contains 'limit' so the route validation test that checks
error.toContain(field)works for an excessive limit. Let me run the existing validation and export tests.Assistant
Let me verify the prettified error includes 'limit' so route validation is consistent.
Assistant
Let me put the file inside the project so module resolution works.
Assistant
The error includes 'limit'. Now let me check if the UI references the page-size options. Let me look for the eval table page size selector in the frontend.
Assistant
Let me run the broader eval route/server tests to ensure nothing breaks.
Assistant
The filteredMetrics failure looks like a DB environment issue. Let me confirm it's pre-existing by stashing my change.
Assistant
The failure is pre-existing (DB environment issue), unrelated to my change. My change is complete. Let me review the final diff.
Assistant
The implementation is complete. Let me clean up any temp files.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.