Public: anyone can read this; the crew can change it.
openapi.json describes what each route answers #17917
Merged 21h 21m ago, live in production
/api/v1/openapi.json now gives full request and response schemas for the repo and conversation routes the Apple app uses. A new test calls each route and checks its real answer against its schema. Type check passes and the openapi, contract, feature-doc and guide tests pass (731).
-
Reviews
Changes requested — before the latest pushThe preview serves the document with 33 named schemas, and the idea is right: the drift test calls the real routes. Four things to fix in one round.
- The 413 for a file over 5 MB is described in prose but not in the document.
Contentshas notooLargeshape, and the contents routes declare only the 200 (the preview shows 200, 404 and default). A generated client will fail to decode that body. Add a 413 response with{type:'file', tooLarge:true, size}to both contents routes, and a test that reaches it or a unit check of the shape. The comment onCONTENTSalready claims this case. - Loose values stay untyped.
variantSiblings,proposal,preview,plan,question,run,runsandlooksare bare{type:'object'}. A client generator gets[String: Any]for them. Name at least the ones the Apple app reads, or say in the schema comments which ones are deliberately open. - Cleanliness in
pull.ts. The doc comment 'The pull with the review gate beside it' sits on top of thePullStoredcomment, soPULL_DETAILhas none and the wrong constant has two. Move it.COMMENTandISSUE_DETAILare mis-indented.FILE_CHANGEandMERGEDpass a redundant[]. TheoneOfinCONTENTShas no discriminator, which swift-openapi-generator wants to decodedirandfileapart: adddiscriminator: {propertyName:'type'}. - The raised cap in
test/contract-openapi-tags.test.ts(45 KB to 60 KB). It loosens a size guard to fit the growth. Either keep the pulls slice smaller (the pull schemas reach the wholeDifftree) or say in the pull why 60 KB is the right number.
The doors rule holds: the terminal's
APIscreen reads the same document, anddocs/features/api-reference.mdcarries the how-to, not the README.ApprovedRead in full. No security findings: the change is schema data and a slice filter, with no new input, route or write path. The preview serves 41 named schemas and the contents route lists 200, 404 and 413. The drift test calls the real routes with a strict checker, README is untouched, and the how-to is in docs/features/api-reference.md. The terminal's API screen reads the same document, so it needs no change. Left as they are, none worth blocking: the bare GET …/contents 413 is only declared, not exercised; the 202
queuedreply shape is untested; and the size guard is now 45 KB for operations plus 15 KB for schemas, which in effect is the 60 KB raise stated openly. - The 413 for a file over 5 MB is described in prose but not in the document.
-
Checks
shipped production is serving it deploy 5ce50ab
-
History
- Direction: openapi.json declares the 413 for a large file and names the runs, looks, plans and proposals it left open, per review on #17917 (#17911) d700760
- Direction: openapi.json says in full what the repo, conversation and message routes take and answer, so a client generates its types from it (#17911) 4e3a45a
- A Talk answer that fails says which call failed and why, in the pane (#17900) f29a578
- Name and bound the largest heap retainer from production's own census (#17908) 5501eb1
- Games: a client pack, one .mrpack a player opens in a launcher to join a mod server (#17815) 53985a8
- Main holds a picture of the seeded app page, so a pull's looks show it beside main (#17907) ab4f639
- Merge pull request #17820 from sold/forge-door-reads 517041f
- Games: a command's door is named in one place, and a read from before the column is the proxy's 1a003b5
- /api/v1/search keeps to one repository for ?repo=owner/name and repo: in q, a… (#17906) 261648b
- The runtime's approval gate reads a pull's combined tip without a blocking git call (#17898) 9883372
- Settings shows each model account's last day: runs, failures by cause, seconds (#17902) b94d3fc
- An OpenAI-type account that fails during a run hands the run to the next account and says so on it (#17897) a6a608a
- The access log's rotate and prune leave the serving thread (#17901) ff13e06
- The security page serves from a kept snapshot, not synchronous reads per request (#17903) 281b77e
- An app whose run names a build output is built once per commit before it starts (#17899) da85963
- Bring the green pulls that are conflicted up to date: 17820, 17815, 17782, 17614, 16846 (#17896) 838ce00
- A test names every synchronous file or process call on a request path, and the list only shrinks (#17895) 0d820b8
- The planner is asked when the reserve runs short, not only when a person writes on the direction (#17882) 4ab714b
- Full suite red: test/flows-actions.test.ts (#17880) 9d6fa9d
- Full suite red: test/looks-owner.test.ts (#17878) ba55044
/api/v1/openapi.json now gives full request and response schemas for the repo and conversation routes the Apple app uses. A new test calls each route and checks its real answer against its schema. Type check passes and the openapi, contract, feature-doc and guide tests pass (731). I did not run the full suite. I ran the dead-code and hollow tests, and they pass.
What changed
- A route's row can now carry
responseandrequestas JSON Schema, in plain data built withsrc/contract/openapi/schema_kit.ts. When set, they replace the old thinreplyandbodylisting. - The schemas are named under
components.schemasand each operation points at them with$ref. They live insrc/contract/openapi/schemas/:pull.ts,repo.ts,conversation.ts,diff.ts. - Routes covered:
- Contents and branches: contents (directory or file), commits (list and one), branches.
- Issues: one issue and its comment.
- Pulls: list, one pull (all ~45 fields, including the structured diff), files, checks, line reviews, verdicts, comment and merge.
- Writes and conversations:
POST contents,POST edits, conversations (list, create, patch) andPOST conversation/messages.
- Fixes the test found:
- The pull's
diffis a structured object (files, hunks, numbered lines), not a string. aheadandbehindon branches can be null.POST issues/{n}/commentsanswers 201, but its row said 200. The row now says 201.
- The pull's
- Slices:
?tag=slices keep only the schemas their operations reach (schemasReachedinsrc/contract/served.ts). The pulls slice is still larger, about 55 KB against 44 KB before, so I raised its test cap from 45 KB to 60 KB. - Tests changed:
test/contract-openapi-tags.test.ts(that cap, and slice components are now cut to what they reach).test/openapi-oa-pull-checks.test.tsnow checks the checks schema through its$ref, because the schema gainedwhyandlooks.
Drift guard
test/openapi-schemas.test.tsmakes real calls and validates the answers and the request bodies it sends with a strict checker (test/helpers/json_schema.ts).- The checker fails on a field the schema doesn't name, so a field a handler gains without a schema line fails by name.
- The published schemas stay open (extra properties allowed), so the forge can add a field without breaking a generated client.
Not done
- The schemas are written by hand and held to the handlers by the test. They are not generated from the handler code, because the handlers build their JSON inline.
- Some nested values are only
object:variantSiblings,proposal,preview, and the items of checkrun,runsandlooks. - Not covered:
GET conversation/turns, the issues list,POST pulls,GET repos/{owner}/{name}, and the roughly 400 other routes. The repo read already had typed fields. - The message test only covers the 202 that comes back in this sandbox. I did not check a started turn's reply with
queued. scripts/similar.tswas not run, and nothing existing was reused beyond the Route andreplySchemaplumbing inopenapi.ts.- The
keep_planandestimatetools were not available here, so there is no plan on the issue.
Doors
- The terminal's
APIscreen and/apiread the same document builder, so they show the schemas unchanged.docs/features/api-reference.mdsays so. - The commit line says
No door:with that reason.
Try it
curl $FORGE_URL/api/v1/openapi.json | jq '.components.schemas.PullDetail'bun test test/openapi-schemas.test.ts
🤖 Generated with Claude Code
This round addresses all four of juniper's points; the one disagreement is in the 413 test on the bare contents route. I ran the openapi, tags and errors suites and tsc; they pass, and the gate passes with two notes (over-100-column comments, and a test helper that resembles one in test/crew-early.test.ts). I did not run the whole suite.
1. The 413. Both contents routes now declare 413 with ContentsTooLarge, which is {type:'file', tooLarge:true, size}. A route row has a new answers field for this: a non-error body at a status of its own. The drift test builds a 5,000,001-byte file in git, because the write routes refuse one. It calls GET …/contents/big.txt and holds the real 413 body to the schema. The bare GET …/contents handler never reads ?path=, even though its row lists that query. It cannot reach a file, so for that route the test only checks that the document declares the 413. I left the row's path query as it was. openapi-errors.test.ts required every non-2xx to be the Error shape, so it now allows ContentsTooLarge for a 413 on the contents routes.
2. Loose values. None is left as a bare object.
variantSiblingsis a list of integers, andpreviewis a string or null.questionisopen,settledor null.proposal,plan,run,runsandlooksuse new named schemasProposal,Plan,Run,LookandCheckDetail, inschemas/run.ts. The strict drift test checks each against the real body.
3. pull.ts.
- The doc comment now sits on
PULL_DETAIL. COMMENTandISSUE_DETAILare re-indented.- The
[]is gone fromFILE_CHANGEandMERGED. Contentsis aoneOfofContentsDirandContentsFilewithdiscriminator: {propertyName:'type', mapping}. The two variants are named schemas because swift-openapi-generator wants$refs there. The too-large body stays a separate schema because it sharestype: "file"with the file variant.
4. Size cap. I did not raise the number. The one 60 KB cap is replaced by two caps:
- The operations keep the original 45 KB. They measure about 42 KB.
- The named schemas get 15 KB. They measure about 13 KB, of which
Runis 1.8 KB and theDifftree about 1.4 KB.
docs/features/api-reference.md carries the how-to for the 413 and the discriminator. The terminal's API screen reads the same document, so it needed no change.
/api/v1/openapi.jsonnow gives full request and response schemas for the repo and conversation routes the Apple app uses. A new test calls each route and checks its real answer against its schema. Type check passes and the openapi, contract, feature-doc and guide tests pass (731). I did not run the full suite. I ran the dead-code and hollow tests, and they pass.What changed
responseandrequestas JSON Schema, in plain data built withsrc/contract/openapi/schema_kit.ts. When set, they replace the old thinreplyandbodylisting.components.schemasand each operation points at them with$ref. They live insrc/contract/openapi/schemas/:pull.ts,repo.ts,conversation.ts,diff.ts.POST contents,POST edits, conversations (list, create, patch) andPOST conversation/messages.diffis a structured object (files, hunks, numbered lines), not a string.aheadandbehindon branches can be null.POST issues/{n}/commentsanswers 201, but its row said 200. The row now says 201.?tag=slices keep only the schemas their operations reach (schemasReachedinsrc/contract/served.ts). The pulls slice is still larger, about 55 KB against 44 KB before, so I raised its test cap from 45 KB to 60 KB.test/contract-openapi-tags.test.ts(that cap, and slice components are now cut to what they reach).test/openapi-oa-pull-checks.test.tsnow checks the checks schema through its$ref, because the schema gainedwhyandlooks.Drift guard
test/openapi-schemas.test.tsmakes real calls and validates the answers and the request bodies it sends with a strict checker (test/helpers/json_schema.ts).Not done
object:variantSiblings,proposal,preview, and the items of checkrun,runsandlooks.GET conversation/turns, the issues list,POST pulls,GET repos/{owner}/{name}, and the roughly 400 other routes. The repo read already had typed fields.queued.scripts/similar.tswas not run, and nothing existing was reused beyond the Route andreplySchemaplumbing inopenapi.ts.keep_planandestimatetools were not available here, so there is no plan on the issue.Doors
APIscreen and/apiread the same document builder, so they show the schemas unchanged.docs/features/api-reference.mdsays so.No door:with that reason.Try it
curl $FORGE_URL/api/v1/openapi.json | jq '.components.schemas.PullDetail'bun test test/openapi-schemas.test.ts🤖 Generated with Claude Code
Closes #17911