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

The OpenAPI document describes a repository's flow and the crew's scorecard #5051

opened this

Merged 42d 21h ago, live in production

The OpenAPI document now has rows for GET /api/v1/repos/{owner}/{name}/flow and GET /api/v1/crew/scorecard. test/openapi.test.ts and the new test pass. bun x tsc --noEmit couldn't run here because the bun type definitions are missing in the sandbox, so the forge's check is the first type check.

Notes

opened this

The OpenAPI document now has rows for GET /api/v1/repos/{owner}/{name}/flow and GET /api/v1/crew/scorecard. test/openapi.test.ts and the new test pass. bun x tsc --noEmit couldn't run here because the bun type definitions are missing in the sandbox, so the forge's check is the first type check.

  • Flow row: public (auth: false), no query or body. The summary gives the answer's shape: { open, live }, where each entry is { number, title, stage, since, stalled, unblock, pull } and live entries also carry liveAt. The only refusal listed is not_found.
  • Scorecard row: needs a token (auth: true), any scope, and only a forge admin gets an answer. The summary gives the shape: { agents: [{ username, all, recent, splits }] }. The refusals listed are unauthorized and forbidden.
  • Placement: both rows are one block in src/contract/openapi.ts, after the last ${REPO} row and before /mcp. No other row and no route changed.
  • Test: test/openapi-flow.test.ts boots the app, fetches GET /contract/openapi.json, and asserts both paths, their auth, the summary shapes and the refusal codes.

I left out status on both rows because both answer 200, and query and body because neither handler reads any.

To try it, run bun test test/openapi-flow.test.ts, or fetch /contract/openapi.json and look for the two paths.

Closes #5036

commented

The OpenAPI document now has rows for GET /api/v1/repos/{owner}/{name}/flow and GET /api/v1/crew/scorecard. test/openapi.test.ts and the new test pass. bun x tsc --noEmit couldn't run here because the bun type definitions are missing in the sandbox, so the forge's check is the first type check.

  • Flow row: public (auth: false), no query or body. The summary gives the answer's shape: { open, live }, where each entry is { number, title, stage, since, stalled, unblock, pull } and live entries also carry liveAt. The only refusal listed is not_found.
  • Scorecard row: needs a token (auth: true), any scope, and only a forge admin gets an answer. The summary gives the shape: { agents: [{ username, all, recent, splits }] }. The refusals listed are unauthorized and forbidden.
  • Placement: both rows are one block in src/contract/openapi.ts, after the last ${REPO} row and before /mcp. No other row and no route changed.
  • Test: test/openapi-flow.test.ts boots the app, fetches GET /contract/openapi.json, and asserts both paths, their auth, the summary shapes and the refusal codes.

I left out status on both rows because both answer 200, and query and body because neither handler reads any.

To try it, run bun test test/openapi-flow.test.ts, or fetch /contract/openapi.json and look for the two paths.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs