Repository navigation
docs(api): /turn and /runs are supported aliases on the client surface - #863
Conversation
Change policy decision 3 keeps POST /turn and POST /runs indefinitely as supported, frozen aliases of POST /v1/turn and POST /v1/runs, yet the route table marked them surface: 'internal', so harness-openapi.yaml left them out while the guides and demos tell users to call them. - packages/server/src/routes.ts: both aliases are now 'client', with their own operationIds (OpenAPI requires unique ids); the deprecated /run-leaf paths stay internal. - docs/api/harness-openapi.yaml: describes both aliases; their request body and responses are $refs to the /v1 route's, so the two cannot drift. The info description states that new features appear under /v1 only. - openapi-contract.test.ts: pins unique operationIds, that each supported alias documents its canonical route's security, body and responses, and that the handler answers an alias exactly as its canonical route at the request boundary. - change-policy.md, http-api.md, glossary.md: say the same. Closes rossoctl#507 Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Review at 18ba588
Moves POST /turn and POST /runs to the client surface in routes.ts with unique operationIds, documents them in harness-openapi.yaml via $refs to the /v1 operations, updates the docs, and adds contract tests. Verified at the head: server.ts sends each alias to the same handler block as its /v1 route and worker.ts TURN_PATHS covers them; the alias response codes match the canonical ones and every $ref pointer resolves; nothing else referenced the old operationIds on these paths. The info.version bump question is a maintainer call.
Author: webchang (MEMBER — maintainer)
Areas reviewed: TypeScript, OpenAPI YAML, Docs
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: all checks passing at submit time
- nit: the commit subject has no conventional prefix (the PR title does); since PRs land as merge commits, consider
docs(api): ....
Drafted by an AI reviewer and approved by a human before posting.
Main took 1.27.0 (rossoctl#864, the base URL's page), so this PR's contract version is 1.28.0, the next free one (it was 1.29.0 while rossoctl#874 held 1.28.0; whichever merges second renumbers). Its section goes above 1.27.0, and the change-policy list keeps both entries. rossoctl#863 made /turn a documented alias of POST /v1/turn, response by response, so the alias gets the new 422 too (the alias contract test caught it). Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
Closes #507
What changed and why
Change policy decision 3 keeps
POST /turnandPOST /runsindefinitely as supported, frozen aliases ofPOST /v1/turnandPOST /v1/runs. The route table still marked themsurface: 'internal', soharness-openapi.yamlleft them out, while the Compose README, the first-run guide and the demos tell users tocurl /turn. (The issue namespackages/knative-server/src/routes.ts; the table now lives inpackages/server/src/routes.ts.)packages/server/src/routes.ts:/turnand/runsare nowsurface: 'client'. Each gets its own operationId (createTurnUnversioned,createRunUnversioned) because OpenAPI requires operationIds to be unique in a document.aliasOfstill names the canonical route. The deprecated/run-leafand/run-leaf/statusstay internal.docs/api/harness-openapi.yaml: describes both aliases. TheirrequestBodyand every response are$refs to the/v1operation's (#/paths/~1v1~1turn/post/...), so the documented contract is the/v1route's by construction and cannot drift. Each alias's description and a new paragraph ininfo.descriptionsay that the aliases are supported and frozen, have no removal date, follow the same notice rules as any route, and that new features appear under/v1only (the detachable-turn routes have no unprefixed form). The header comment no longer calls them internal.change-policy.md("What is the contract today") calls them client routes instead of "internal".http-api.mdgains a paragraph on the aliases under the routes table.glossary.mdno longer callsPOST /runs"legacy", a word that is also a maturity label.server.tssends/turnand/v1/turnto the samehandleTurn, and/runsand/v1/runsto the same block (auth, tenant rule,asyncrefusal,handleRunLeafParsed).worker.ts'sTURN_PATHScounts all of them for admission. The aliases have the same auth and the same responses as the/v1routes.Tests
packages/server/test/openapi-contract.test.tsgets three new tests:gives every operation its own operationId: OpenAPI's uniqueness rule.documents each supported alias with the contract of the route it duplicates: each non-deprecatedaliasOfentry isclient, has the sameauthas its canonical route, and its documentedsecurity, resolvedrequestBodyand resolved responses deep-equal the canonical operation's. Deprecated aliases must stayinternal.answers a supported alias exactly as the route it duplicates: drives the real handler with three boundary bodies ({},not json,{"sessionId":""}) and asserts that each alias's status and body equal the canonical route's.Before the fix (new test only, on the base):
(The handler-equivalence test already passed on the base, which shows the aliases really share their handlers.)
After:
openapi-contract.test.ts9 passed. The wholepackages/serversuite: 33 files, 588 tests passed.tsc --noEmitis clean.prettier --checkpasses on the changed files.scripts/check-doc-links.pychecked 212 files and found 0 broken links. A Redocly lint (minimal ruleset) ofharness-openapi.yamlbefore and after gives the same pre-existing findings (2struct, 2 warnings), so the new$refs resolve and add no new problems.Out of scope
info.versionstays at 1.4.0. Nothing changes on the wire: the document now describes two routes it already served. A data-plane version is recorded in the control-plane changelog section that ships it. Bumping the minor would need a changelog entry and is a call for the maintainers.GET /v1/runs/statusis Add GET /v1/runs/status (keep /runs/status as an alias) #508.Every commit is signed off (DCO).
Assisted-By: Claude Code