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

/explore.json and /api/v1/explore are described in the OpenAPI document with their fields #16011

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

/explore.json and /api/v1/explore now carry response schemas for every field they send, and each one's description says it is the same answer as the other. The OpenAPI, contract and explore tests pass (661 tests, 44 files) and tsc and gate.ts --fix are clean. I did not run the whole suite.

Notes

shipped production is serving it deploy b03b44b

opened this

/explore.json and /api/v1/explore now carry response schemas for every field they send, and each one's description says it is the same answer as the other. The OpenAPI, contract and explore tests pass (661 tests, 44 files) and tsc and gate.ts --fix are clean. I did not run the whole suite. scripts/fast.ts named 2271 files, which is too broad. The forge's check runs everything on this push.

  • What the document says. The top level has query, note, suggest, items and next_cursor. /explore.json adds filters. Each row is one of three shapes: app, person or forge. /explore.json apps also carry score_parts.
  • Where it lives. The field lists are in one new file, src/contract/openapi/explore_reply.ts, and both route files read from it so they can't drift apart.
  • Change to the generator. In src/contract/openapi.ts a route can now declare both flat reply fields and a cursor list's replyShapes. Before, reply silently replaced replyShapes. A new replySchema merges them; no other route declares both, so their output is unchanged.
  • The test. In test/explore-json.test.ts it fetches /contract/openapi.json, then calls each route and checks the answer against that route's published schema. The check is a small validator in the test, with no new dependency. A field the answer sends but the document doesn't describe fails it. It also checks that each description names the other path.
  • Size budget. The existing slice-size test in test/contract-openapi-tags.test.ts still passes.

I didn't add required lists or per-field descriptions, because the document's field vocabulary is only a type per field. Nested objects (numbers, repo, score_parts, lately, action) are published as plain object.

Closes #15991

2 earlier comments
commented

/explore.json and /api/v1/explore now carry response schemas for every field they send, and each one's description says it is the same answer as the other. The OpenAPI, contract and explore tests pass (661 tests, 44 files) and tsc and gate.ts --fix are clean. I did not run the whole suite. scripts/fast.ts named 2271 files, which is too broad. The forge's check runs everything on this push.

  • What the document says. The top level has query, note, suggest, items and next_cursor. /explore.json adds filters. Each row is one of three shapes: app, person or forge. /explore.json apps also carry score_parts.
  • Where it lives. The field lists are in one new file, src/contract/openapi/explore_reply.ts, and both route files read from it so they can't drift apart.
  • Change to the generator. In src/contract/openapi.ts a route can now declare both flat reply fields and a cursor list's replyShapes. Before, reply silently replaced replyShapes. A new replySchema merges them; no other route declares both, so their output is unchanged.
  • The test. In test/explore-json.test.ts it fetches /contract/openapi.json, then calls each route and checks the answer against that route's published schema. The check is a small validator in the test, with no new dependency. A field the answer sends but the document doesn't describe fails it. It also checks that each description names the other path.
  • Size budget. The existing slice-size test in test/contract-openapi-tags.test.ts still passes.

I didn't add required lists or per-field descriptions, because the document's field vocabulary is only a type per field. Nested objects (numbers, repo, score_parts, lately, action) are published as plain object.

commented

The gate failed because none of the Direction lines on this pull named a pipeline item. I added an empty commit whose Direction line does: "Direction: a contract fix to published routes, assigned by the owner as #15991, ahead of #6534". I didn't rewrite the earlier commit, because force pushes are refused here. The gate looks at every commit message in the range, so the new line is enough.

bun scripts/gate.ts now passes with no output, and the push went through. I didn't re-run tsc or any tests, because only a commit message changed. The forge will re-run the check on this push.

This pull describes /explore.json and /api/v1/explore in the OpenAPI document, with their fields, as one answer (commit 59a178ec9). It changes no behaviour and adds no dependency.

commented

I merged main into the branch and pushed it. The two conflicts, in getApiV1Explore.ts and getExploreJson.ts, are resolved.

This pull adds descriptions of /explore.json and /api/v1/explore to the OpenAPI document. Each route keeps the reply, replyShapes and exploreSame cross-reference it got here. Both now take their query parameters from EXPLORE_QUERY, the shared definition main added. That replaces the inline parameter lists in each file.

bun scripts/gate.ts --fix and bun x tsc --noEmit ran with no output. I ran 44 test files, including the contract, OpenAPI and explore suites, and all 663 tests passed. I did not run the full suite; the forge's check does that on this push.

Approved

Both routes now publish response schemas in /contract/openapi.json (checked on the preview: query, note, suggest, items, next_cursor, plus filters and score_parts on /explore.json), and each description names the other as the same answer. The test validates live answers against the published schema and fails on any undescribed field. No dependency, no behaviour change, and the generator merge of reply and replyShapes leaves other routes alone. Next: (1) add required lists so a dropped field fails the test, since today a missing field passes; (2) describe the nested objects (numbers, repo, action, score_parts) instead of plain object.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs