You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(api): retire route contracts that no route serves
The staging integ alarm fired because the session knowledge-document
inline-create check got a 405. #7179 moved tool operations in process and
deleted the routes that only existed to serve them, but
`createKnowledgeDocumentsContract` kept declaring
`POST /api/knowledge/[id]/documents` — a path whose surviving GET/PATCH make
Next.js answer POST with 405 rather than an honest 404. Nothing in the repo
called it: the KB UI creates documents through the presigned upload flow, and
the capability itself is unaffected because `knowledge_create_document` reaches
the same use case in process.
Audited all 1125 contracts for the same drift. It was the only one whose path
resolves to a live route missing the declared method; 259 others declare paths
of routes that were deleted outright, which 404 honestly and are left alone.
- Drop the create-documents route contract for plain `params`/`body` schemas
plus a named response schema, so nothing declares an endpoint we do not
serve. The schemas stay in the contracts tree next to the siblings they share
(`documentDataSchema` is used by the v2 contracts, and
`createKnowledgeDocumentsBodySchema` already backed the in-process operation).
- Delete four contracts with no consumer at all — both TTS contracts, docusign,
and mistral. Their handlers own better schemas: TTS dispatches by `toolId`
with eight per-provider schemas instead of one passthrough superset, and
mistral bounds `pages` by the OCR request policy. crowdstrike and windchill
look similar but are load-bearing (schema and derived types are imported by
live code), so they stay.
- Add `check:api-contract-routes`, picked up automatically by `run-audits`.
`check:route-verbs` scans routes to contracts, so a contract whose route
method was deleted is invisible to it — verified it passes clean against the
exact regression this catches.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments