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 callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /promptfoo, current file: none) bash-$
- Add a maximum
- Assistant
I’ll first inspect the eval API schema, route implementation, UI pagination usage, and relevant tests/package scripts. Then I’ll reproduce the unbounded validation behavior, implement the shared constant and conditional cap while preserving exports, and run focused tests plus type/lint checks as appropriate.
- Assistant
The schema confirms
limitis only positive, with no upper bound. My initial broad search was suppressed by nonexistent paths, so I’ll locate the exact route and all consumers of the schema, including frontend page-size option definitions and focused test files. - Assistant
rgis unavailable in this environment, so I’ll use recursivegrepand inspect the identified schema, route-validation, export, and UI files directly. - Assistant
The requirement implies conditional validation: limits above 1000 must fail when
formatis absent, but remain valid whenformat=csv/jsonso route parsing reaches the existing export override. I’ll inspect the full route flow, schema export structure, and eval UI pagination controls to wire the shared constant into both server validation and UI options. - Assistant
The eval UI has a concrete page-size selector, and the interface explicitly says its options should derive from the new constant. I’ll inspect imports and selector markup, then use a Zod object-level refinement because a field-level
.max()cannot exempt exports based on siblingformat. - Assistant
The UI currently hardcodes
1000, matching the requested cap but not deriving it from a shared source. Before editing, I’ll reproduce the schema defect explicitly for1001, while also confirming that an export query with the same limit currently parses; this establishes the behavior to preserve for exports. - Assistant
Reproduction succeeded: a normal
limit=1001is currently accepted, as is the export equivalent. I’ll now add the literal shared constant, enforce it through a conditional query-schema refinement, and replace the UI’s hardcoded options with a generated list capped by that constant while preserving the selector’s existing enable/disable thresholds. - Assistant
Python is not installed, so no files were changed. I’ll apply the same deterministic replacements using Node (available in the repository), then run Biome on only the modified files and inspect the diff.
- Assistant
The diff now has the conditional cap and shared UI constant. I’ll verify key boundary cases (
1000,1001, malformed values, andNumber.MAX_SAFE_INTEGERexports), then run the focused schema, route-validation, export, and ResultsTable test suites. This also checks that the runtime constant import is compatible with the app test build. - Assistant
All focused tests pass (72 server/schema tests and 71 ResultsTable tests), and boundary checks confirm the cap and export exemption. I’ll additionally exercise the real Express route with
limit=1001to confirm a 400 occurs before model access, then run TypeScript checks for both root and app and inspect OpenAPI generation compatibility, since the query schema now has an object-level refinement. - Assistant
The real route returns
400with alimit-scoped validation error before database/model access. Root TypeScript and the full app production build pass.openapi:checkcould not run because the repository checkout lacks the expected generatedsite/static/openapi.json, not because of a schema-generation error.Before finalizing, I’ll review the remaining route logic for any secondary use of the requested page limit (especially comparison tables), inspect the final diff for accidental build artifacts, and run Biome’s non-mutating check.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →