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 start by understanding the repository structure and the issue. The issue is about adding a maximum page size limit for non-export eval table requests. Let me explore the codebase.
Assistant
Let me find the relevant files mentioned in the issue.
Assistant
Let me try one command at a time.
Assistant
Now I can see the
EvalTableQuerySchema. Currently thelimitfield is just:limit: z.coerce.number().int().positive().prefault(50),I need to:
- Add a constant
EVAL_TABLE_MAX_PAGE_SIZE = 1000 - Modify the
limitfield to cap at 1000 for non-export requests (i.e., whenformatis not set)
Wait, looking at the issue more carefully: "Add a maximum
limitfor non-exportGET /api/eval/:id/tablerequests." And "Return validation errors for excessive non-export limits."So I need to use Zod's
.max()or.refine()to validate that whenformatis not present,limitshould not exceed 1000. Whenformatis present (export), it should be unlimited.Let me also look at how the route handles this, to understand the full picture.
Let me look at the route handler for the eval table endpoint.
- Add a constant
Assistant
Let me look at the eval route and the eval table utils.
Assistant
Let me see the full route handler context and the tests
Assistant
Now let me look at the existing tests for this endpoint:
Assistant
Let me look at the relevant test files:
Assistant
Now let me check the route validation test:
Assistant
Let me also check the export tests
Assistant
Now I have a clear understanding of the code. Let me check if there are any other places that reference
EvalTableQuerySchemaor the limit:Assistant
Now let me implement the changes. I'll edit `src/types/api/eval.ts
Assistant
The open command doesn't work like that. Let me try with just
open:Assistant
Now let me add the constant. I'll add it right before the
EvalTableQuerySchema:Assistant
Let me use the proper edit syntax with heredoc
Assistant
Good. Now I need to add a
.refine()to theEvalTableQuerySchema. Let me modify the closing of the schema objectAssistant
Now let me verify the changes work correctly by running a quick test:
Assistant
Good, existing tests pass. Let me also run the validation tests and export
Assistant
All tests pass. Now let me write a quick script to verify the schema behaves correctly for my changes:
Assistant
It's TypeScript, so let me use vitest inline instead
Assistant
Let me write a quick focused test to verify the schema:
Assistant
Let me place the test in the test directory
Assistant
The file is not matched because the name doesn't end
.test.tscorrectly? Wait, it does. Let me check the actual file name and path.Assistant
The file exists. Let me check the vitest config include pattern.
Assistant
The issue is that the
_prefix might not be matched. Let me rename to not start with underscore. Or actually, I see the issue: it's probably not matchingtest/_temp_eval_table_limit_test.tsbecause vitest is looking for files matchingtest/**/*.test.ts. The_temp_eval_table_limit_test.tsshould match*test.ts. Let me check the vitest config more carefully.Assistant
Let me try without the underscore prefix.
Assistant
All tests pass. Let me clean up the temp file and run the existing relevant tests.
Assistant
Now let me run the most relevant existing test suites
Assistant
All 44 tests pass. Let me also run the broader eval route test suite.
Assistant
All tests pass. Let me verify the final state of the changed file
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.