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

The OpenAPI document describes feed interactions and sharing: POST /api/v1/feed/interactions and POST /api/v1/share #5468

opened this

Merged 41d 5h ago, live in production

POST /api/v1/feed/interactions and POST /api/v1/share now have rows in the OpenAPI document. I ran bun test test/openapi, which passes (48 tests). I didn't get a type check: bun x tsc --noEmit couldn't find the bun type definitions, and I didn't chase that.

Notes

opened this

POST /api/v1/feed/interactions and POST /api/v1/share now have rows in the OpenAPI document. I ran bun test test/openapi, which passes (48 tests). I didn't get a type check: bun x tsc --noEmit couldn't find the bun type definitions, and I didn't chase that.

  • Rows: Both sit together in a separate block in src/contract/openapi.ts, just before /mcp, so #5156 can land before or after.
  • Interactions: The row has the item, kind and app body fields and answers 201 with { id }. Its refusals are invalid_item (422), invalid_kind (422) and not_found (404).
  • Share: The row has item and to (up to 10 usernames) and answers 201 with { sent: [{ to, outcome }] }. Its refusals are invalid_item (422), invalid_target (422) and not_found (404).
  • Coverage list: Both routes are removed from NOT_YET_DESCRIBED in test/openapi-coverage.test.ts.
  • Tests: The new test/openapi-oa-feed.test.ts checks the rows and refusal codes in the document. It also calls both routes and checks each refusal status and code.
  • Router test: test/openapi.test.ts ("every described route is registered in the router") didn't read src/http/feed.ts, so any feed row failed it. I added that file to its source list, which is a one-line change. #5156 will probably need the same line, so a trivial merge conflict is possible.

I didn't describe the outcome values in sent beyond the field name.

Closes #5313

3 earlier comments
commented

POST /api/v1/feed/interactions and POST /api/v1/share now have rows in the OpenAPI document. I ran bun test test/openapi, which passes (48 tests). I didn't get a type check: bun x tsc --noEmit couldn't find the bun type definitions, and I didn't chase that.

  • Rows: Both sit together in a separate block in src/contract/openapi.ts, just before /mcp, so #5156 can land before or after.
  • Interactions: The row has the item, kind and app body fields and answers 201 with { id }. Its refusals are invalid_item (422), invalid_kind (422) and not_found (404).
  • Share: The row has item and to (up to 10 usernames) and answers 201 with { sent: [{ to, outcome }] }. Its refusals are invalid_item (422), invalid_target (422) and not_found (404).
  • Coverage list: Both routes are removed from NOT_YET_DESCRIBED in test/openapi-coverage.test.ts.
  • Tests: The new test/openapi-oa-feed.test.ts checks the rows and refusal codes in the document. It also calls both routes and checks each refusal status and code.
  • Router test: test/openapi.test.ts ("every described route is registered in the router") didn't read src/http/feed.ts, so any feed row failed it. I added that file to its source list, which is a one-line change. #5156 will probably need the same line, so a trivial merge conflict is possible.

I didn't describe the outcome values in sent beyond the field name.

commented

I merged main into the branch and pushed it. The one conflict, in test/openapi-coverage.test.ts, is resolved. bun test test/openapi passes (50 tests); I didn't run the full suite.

  • The conflict: both sides had edited the same spot in the NOT_YET_DESCRIBED list. This branch had dropped POST /api/v1/share. main had dropped POST /api/v1/user/email/verify. I removed both lines, so neither route is listed as undescribed.
  • Rows: /api/v1/feed/interactions, /api/v1/share and /api/v1/user/email/verify each have a single row in src/contract/openapi.ts, with no duplicates.
commented

Steward: this pull is approved but no longer merges into main. #5932 split src/http/mcp.ts into one file per tool, and several other shared files moved. Bring it up to date with main: merge main and resolve keeping this pull's intent. If it adds or changes an MCP tool, move that into its own file in the new layout and regenerate the docs. Then let the check run. If the change is already on main, say so and close the pull.

commented

The OpenAPI document now describes POST /api/v1/feed/interactions and POST /api/v1/share. This branch is merged with current main.

  • Merge: main moved the document's rows into one file per route under src/contract/openapi/routes/. I resolved the conflicts by taking main's layout. The two rows are now postApiV1FeedInteractions.ts and postApiV1Share.ts, and I regenerated the route index with bun scripts/openapi-routes.ts.
  • Review notes: the share row now says to is one username or a list, with or without a leading @. It says that leaving to out sends the item to the app's crew and owners, or its followers. It also lists the outcome values (delivered, queued, steered, told, duplicate, skipped, unreachable). unreachable means no such person, or someone who cannot see the item.
  • Tests: both routes are removed from NOT_YET_DESCRIBED, and test/openapi-oa-feed.test.ts still exercises both live routes and their refusals. The OpenAPI tests pass (270). tsc is clean. I did not run the full suite.
  • Left out:
    • I did not re-type to as string-or-array in the schema, because the generator only knows plain types. The summary carries it.
    • The coverage test prints "15 NOT_YET_DESCRIBED entries could be removed". Those entries are not mine, so I left them.

This is document-only, with no new surface for the page or the terminal.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs