feat(api)!: rename POST /api/chat/workflow → POST /api/chat (breaking)

Merged
SW
5mo ago
+35-4

Step 2 of the /api/chat/workflow → /api/chat rename (chat#1767), implementing the merged docs contract (docs#235).

Per maintainer decision, this is a hard rename, not an additive alias: it adds POST /api/chat and deletes app/api/chat/workflow/route.ts.

⚠️ BREAKING — deploy coordination required

Prod consumers still POST /api/chat/workflow:

  • chat — useChatTransport.ts:49
  • open-agents — chat-api-client.ts:21 (CHAT_API_POST_PATH)
  • any external API-key callers

This must NOT be promoted to main/prod until the chat (step 3) and open-agents (step 4) repoints are merged and deployed — otherwise those consumers 404. Recommend holding the test→main promotion until the consumer PRs are ready to ship together.

Changes

  • add app/api/chat/route.ts (POST + OPTIONS) delegating to handleChatWorkflowStream
  • delete app/api/chat/workflow/route.ts
  • fix docstrings that named the removed path

TDD (red → green → refactor)

  • app/api/chat/__tests__/route.test.ts written first → red (missing route) → green after adding route.ts.
  • No refactor needed.

Verification

  • 2 route tests + 20 handleChatWorkflowStream handler tests pass; lint clean.
  • (The only tsc blip is a stale .next/types reference to the deleted route — regenerates on a fresh build.)
  • Preview after deploy: POST /api/chat streams; POST /api/chat/workflow → 404 (intentionally removed).

Follow-ups (must ship before this hits prod)

  1. chat — repoint useChatTransport → /api/chat
  2. open-agents — repoint CHAT_API_POST_PATH → /api/chat

Summary by CodeRabbit

  • Documentation
    • Updated API documentation for the chat endpoint. /api/chat is now the primary endpoint, while /api/chat/workflow is documented as a backward-compatible alias. No functional changes.