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 exploring the repository structure to understand the codebase and then find the relevant files mentioned in the issue description.
The issue is about:
- Adding a maximum page size (
EVAL_TABLE_MAX_PAGE_SIZE = 1000) for non-exportGET /api/eval/:id/tablerequests - Keeping export requests (with
format=csvorformat=json) unchanged - Adding validation to the schema
Let me explore the repository structure first.
- Adding a maximum page size (
Assistant
Let me find the key files mentioned in the issue.
Assistant
Let me look at the key files. First, the type definitions for eval API
Assistant
The open command requires a different syntax. Let me use the correct format.
Assistant
Now let me look at the route handler and the validation test files.
Assistant
Let me find the table route specifically and the relevant test files.
Assistant
Let me see the full table route handler.
Assistant
Now let me find where
UNLIMITED_RESULTSis defined and look at the remaining importsAssistant
Let me look at the existing test files to understand the expected
Assistant
Now let me look at the validation tests and the export test
Assistant
Now let me look at the export test file and the store.ts for UI:
Assistant
Now let me check the store.ts for the frontend page size options
Assistant
Let me check if
EVAL_TABLE_MAX_PAGE_SIZEis already referenced anywhere and check the frontend page size optionsAssistant
Let me check the frontend for available page size options
Assistant
Now I have a full understanding. Let me implement the changes. I need to:
- Add
EVAL_TABLE_MAX_PAGE_SIZE = 1000constant tosrc/types/api/eval.ts - Modify
EvalTableQuerySchemato reject limits > 1000 whenformatis not set
Let me first define the constant, then modify the schema.
- Add
Assistant
The open command doesn't work that way. Let me use the
editcommand or just work withcatandreplace.Actually, looking at my special commands,
opentakes[FILE] [LINE_NUMBER]. But I need to use it from the terminal command. Let me try:open src/types/api/eval.ts 1Assistant
Now I can see the file. Let me implement the changes step by step.
First, add the constant
EVAL_TABLE_MAX_PAGE_SIZEbefore theEvalTableQuerySchema:Assistant
Let me try a different approach using the
replacecommand.Assistant
Now I need to modify the
EvalTableQuerySchemato add validation. I'll add a.superRefine()to reject excessive limits for non-exportAssistant
The changes look correct. Now let me verify the changes work by running some quick tests. First, let me create a small script to test the schema validation:
Assistant
Hmm, Test 2 should have failed. There might be a caching issue. Let me write a proper test script to verify:
Assistant
Let me fix the test script path and try again
Assistant
All tests pass correctly:
- Test 1:
limit=1000without format → allowed ✓ - Test 2:
limit=1001without format → rejected with error ✓ - Test 3:
limit=1001withformat=csv→ allowed (export) ✓ - Test 4:
limit=1001withformat=json→ allowed (export) ✓ - Test 5:
limit=500without format → allowed ✓
Let me clean up the temp file and run the existing test suite to make sure nothing is broken.
- Test 1:
Assistant
Now let me run the existing tests related to the eval table and schema validation:
Assistant
Existing schema tests pass. Let me run the route validation test and the export test:
Assistant
All validation tests pass. Let me run the export tests too:
Assistant
All export tests pass. Let me also run the full eval route tests:
Assistant
All tests pass. Let me also run the smoke tests to be thorough:
Assistant
All 68 smoke tests pass. Let me verify the final state of my changes:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.