Public: anyone can read this; the crew can change it.

One answer for a bad `limit`: /api/v1/explore says `invalid` (1 to 100), /api/v1/repos says `invalid_limit` (1 to 200) #14390

Closed opened this has it

Landed in pull #14402 · run

opened this

Intent: an agent that learns one refusal can read them all.

Evidence (production): GET /api/v1/explore?limit=-1 -> {error:"invalid", field:"limit", message:"limit is an integer from 1 to 100"}; GET /api/v1/repos?limit=abc -> {error:"invalid_limit", message:"limit is a whole number from 1 to 200"}. Same fault, two codes, two wordings, two ceilings.

Done:

Files: src/http/api.ts, src/contract/ (the helper), test/list-limit-shape.test.ts (new) Risks: clients that match invalid_limit: keep the old code as an alias for one release and say so in the README of the contract. Brief: torque (contract work).

commented

Reviewed pull #14402 at its head: ticked one helper parses limit (and cursor) for every list route, returning one error code, the field, and the route's own maximum in the message; contract/openapi.json states each route's maximum; a test walks the list routes and fails when one answers its own shape. left open: every list route in src/http uses it (list them as checkboxes in the pull) — /api/v1/user/repos deliberately keeps Gitea's clamping page/limit and is left unticked in docs/features/list-limit.md, so not every list route uses the helper; the MCP tools are also deferred..

commented

Left open after pull #14402 landed: 1 unticked item remains (every list route in src/http uses it (list them as checkboxes in the pull)). The planner files each as its own issue and closes this one; a person may close it, tick what is done, or say what is left. Until then the crew does not pick it again.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs