fix(api): keep public and sandbox wire contracts distinct - #28
Merged
Merged
Conversation
Re-derive the public-contract package from PR #21 on the current fork main (`929ec4d`, upstream v1.2.0). The original branch predates the hosted-apps routes and the public `timeout` field, so it no longer merges cleanly; this reapplies its intent on top of the current sources instead of rebasing it. Contract-only change: it adds `PublicExecuteResponse` as a named alias of the existing `ExecuteResult` and types the flat `/v1/exec` producers and consumers with it, leaving the exported `ExecuteResponse` sandbox transport unchanged. The two OpenAPI documents now describe the public service routes and the internal `/api/v2/execute` contract separately, and a new test asserts the schemas, the route set, and the sandbox/internal boundary. Verified: `bun test` in `api/` (481 pass) and `service/` (1091 pass, 12 redis skips), `bun run build` in `service/`.
rschlaefli
marked this pull request as ready for review
September 18, 2026 19:07
3 tasks
rschlaefli
pushed a commit
that referenced
this pull request
Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This Maintains
Re-derivation of the contract-maintenance package from #21 on the current
main(929ec4d, upstream v1.2.0 retained). It keeps CodeAPI's OpenAPIdocuments and TypeScript names aligned with behavior that already exists:
/v1execution and file-management routes and theircurrent wire shapes in
service/openapi.yml.api/openapi.yamlexplicitly internal to/api/v2/execute.ExecuteResponsesandbox transport and introducesPublicExecuteResponsefor the existing flat public execution result.schema boundaries, response codes, and TypeScript relationships.
This package is runtime-neutral. No UZH feature, source gate, image, or
deployment depends on it, and rollback is an ordinary source revert.
Why a Re-Derivation
#21 branched from
83c4f7band no longer applies tomain. Since then thefork merged upstream v1.1.0 and v1.2.0, which added the hosted-apps routes, a
public
timeoutrequest field, and four more ledger rows. Rebasing the oldbranch would desynchronize the documents from current sources, so this branch
reapplies the same intent over the current tree instead.
How It Works
service/openapi.ymldescribes the nine stable public routes mounted at/v1, including the newer/hosted-appsand/hosted-apps/{app_id}paths.api/openapi.yamlis explicitly internal (x-internal: true) and describesonly
/api/v2/execute.PublicExecuteResponsealiases the existing flatExecuteResult; onlyproven internal type sites that consume that shape use the clearer name.
ExecuteResponseexport remains unchanged for the sandboxadapter and any unindexed downstream source consumer.
service/src/openapi-contract.test.tsasserts local$refresolution, thepublic route set, the public/internal schema split, the flat result type
relationship, and the rate-limit and timeout response surfaces.
Important Details
429, so the rate-limitassertion is an explicit rate-limited route list rather than a blanket
check over every path.
describe supported fields only.
authentication, logging-policy, database, deployment, image, or telemetry
change. It is contract maintenance only.
main's newer ledger rows (JWT trust, values-free logs, telemetrypreservation, no-fork-release policy) alongside the new public-contract row.
Branch Coverage
main@929ec4d8220f969a3f049e3a134259befeed15d743ed62cruntime, or deployment delta.
Verification
bun testinapi/: 481 pass, 0 fail.bun testinservice/: 1091 pass, 12 redis-dependent skips, 0 fail.bun run buildinservice/: success.service/src/openapi-contract.test.ts: 6 pass, 181 assertions.Supersedes #21, which stays open for reference until a disposition is approved.