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

GET /api/v1/admin/capacity answers `{ items, next_cursor: null }` #5161

opened this

Merged 41d 17h ago, live in production

GET /api/v1/admin/capacity now answers { items, nextcursor: null }, like the other lists. The five test files below pass (65 tests), but I didn't get a clean type check. Handler: only the HTTP handler in src/http/api.ts changed.

Notes

opened this

GET /api/v1/admin/capacity now answers { items, next_cursor: null }, like the other lists. The five test files below pass (65 tests), but I didn't get a clean type check.

  • Handler: only the HTTP handler in src/http/api.ts changed. listCapacity still returns what it did, so MCP, the pages and the terminal are untouched. The admin gate and the 404 for a non-admin are unchanged.
  • Shape of items: it is the object listCapacity returns, { settings, changes }, not a bare array. So the old body { settings, changes } is now { items: { settings, changes }, next_cursor: null }. I followed the issue's wording literally; say if you wanted items to be a flat list instead.
  • OpenAPI: the row's summary in src/contract/openapi.ts now describes { items: { settings: [...], changes }, next_cursor }.
  • Tests: test/guard-new-accounts.test.ts now reads items.settings. test/capacity.test.ts has a new assertion on the shape: items.settings is an array, next_cursor is null, and there is no top-level settings. test/admin_refused.test.ts only reads status codes, so it needed no change.
  • Run: test/capacity.test.ts, test/admin_refused.test.ts, test/guard-new-accounts.test.ts, test/mcp.test.ts and test/openapi-oa-adm.test.ts.
  • Not done: bun x tsc --noEmit failed with a missing bun type definition because dependencies weren't installed when I ran it. I didn't re-run it after bun install, so the forge's check is the first real type check.
  • Left out: no change to listCapacity or MCP.

To try it, call GET /api/v1/admin/capacity with an admin token and look for items and next_cursor in the body.

Closes #5145

commented

GET /api/v1/admin/capacity now answers { items, next_cursor: null }, like the other lists. The five test files below pass (65 tests), but I didn't get a clean type check.

  • Handler: only the HTTP handler in src/http/api.ts changed. listCapacity still returns what it did, so MCP, the pages and the terminal are untouched. The admin gate and the 404 for a non-admin are unchanged.
  • Shape of items: it is the object listCapacity returns, { settings, changes }, not a bare array. So the old body { settings, changes } is now { items: { settings, changes }, next_cursor: null }. I followed the issue's wording literally; say if you wanted items to be a flat list instead.
  • OpenAPI: the row's summary in src/contract/openapi.ts now describes { items: { settings: [...], changes }, next_cursor }.
  • Tests: test/guard-new-accounts.test.ts now reads items.settings. test/capacity.test.ts has a new assertion on the shape: items.settings is an array, next_cursor is null, and there is no top-level settings. test/admin_refused.test.ts only reads status codes, so it needed no change.
  • Run: test/capacity.test.ts, test/admin_refused.test.ts, test/guard-new-accounts.test.ts, test/mcp.test.ts and test/openapi-oa-adm.test.ts.
  • Not done: bun x tsc --noEmit failed with a missing bun type definition because dependencies weren't installed when I ran it. I didn't re-run it after bun install, so the forge's check is the first real type check.
  • Left out: no change to listCapacity or MCP.

To try it, call GET /api/v1/admin/capacity with an admin token and look for items and next_cursor in the body.

commented

GET /api/v1/admin/capacity now answers { items: [...], changes: [...], next_cursor: null }, following the egress-grants route. items is the array of settings and changes sits beside it. The five test files pass (65 tests) and bun x tsc --noEmit is clean after bun install.

  • Handler: only the HTTP handler in src/http/api.ts changed; listCapacity is as it was. The admin gate and the 404 for a non-admin are unchanged.
  • OpenAPI: the summary now reads answers { items: [{ key, label, help, value, source, default, env, changed? }], changes, next_cursor }.
  • Tests: test/capacity.test.ts now asserts that body.items and body.changes are arrays, next_cursor is null, and there is no top-level settings. test/guard-new-accounts.test.ts reads items.map(...). test/admin_refused.test.ts only checks status codes, so it is unchanged.
  • Left out: listCapacity, MCP, the pages and the terminal.

To try it, call GET /api/v1/admin/capacity with an admin token.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs