Skip to content

fix(api): align maintained CodeAPI contracts - #21

Draft
rschlaefli wants to merge 8 commits into
mainfrom
rs/codeapi-public-contract
Draft

fix(api): align maintained CodeAPI contracts#21
rschlaefli wants to merge 8 commits into
mainfrom
rs/codeapi-public-contract

Conversation

@rschlaefli

@rschlaefli rschlaefli commented Aug 31, 2026

Copy link
Copy Markdown
Member

What This Maintains

This optional PR aligns CodeAPI's maintained OpenAPI documents and TypeScript
names with behavior that already exists:

  1. Documents the supported public /v1 execution and file-management routes
    and their current wire shapes.
  2. Documents the internal /api/v2/execute request, response, error, and
    status contract separately.
  3. Preserves the established exported ExecuteResponse type and introduces
    PublicExecuteResponse for the existing flat public execution result.
  4. Adds focused contract tests for route inventories, local references, schema
    boundaries, response codes, and TypeScript relationships.

This package is runtime-neutral and independent. No UZH feature, source gate,
image publication, or deployment depends on it. PR #19 owns issuer trust and
PR #20 owns values-free logging plus generic public download failures.

How It Works

  • service/openapi.yml describes the seven stable public routes mounted at
    /v1.
  • api/openapi.yaml is explicitly internal and describes only
    /api/v2/execute.
  • PublicExecuteResponse aliases the existing flat ExecuteResult; only
    proven internal type sites that consume that shape use the clearer name.
  • The legacy ExecuteResponse export remains unchanged for the sandbox
    adapter and any unindexed downstream source consumer.
  • Overlapping generic/specific error alternatives use anyOf; disjoint wire
    alternatives retain oneOf.

Important Details

  • Root, API, and service manifests expose no package exports or
    publishConfig surface.
  • Prior GitHub fork-network, GitLab deployment, and local consumer searches
    found no external ExecuteResponse or direct source-import consumer. The
    existing export is preserved regardless.
  • Unknown public request properties remain runtime-tolerated; the OpenAPI
    document describes supported fields only.
  • This branch contains no download-response change and no dependency,
    lockfile, authentication, logging-policy, database, deployment, image, or
    telemetry change.
  • Rollback is an ordinary source revert.

Branch Coverage

  • Base: main@83c4f7b105b6b3e69eda12701ad4ec437acba08f
  • Head: 8e20bd97a921d79ae6574561fc13db295b1442ad
  • Reviewed range: 83c4f7b..8e20bd9
  • Changed: 8 files, +1030/-202 lines; no dependency, lockfile, generated-output,
    runtime, or deployment delta.
  • Covered: public and internal OpenAPI contracts, exported type boundary,
    internal flat-result type sites, focused contract tests, and fork ledger.

Review Focus

  • Confirm the public schemas match existing /v1 handlers and middleware.
  • Confirm the internal schema matches /api/v2/execute without presenting it
    as a public client surface.
  • Confirm ExecuteResponse remains unchanged and the new alias changes no
    runtime or persisted-data behavior.
  • Confirm schema unions correctly represent overlapping and disjoint response
    shapes.

Verification

At the exact head:

  • bun test ./src/openapi-contract.test.ts from service/ -> 6 pass, 0 fail,
    172 assertions.
  • Full service/ test suite -> exit 0.
  • Full api/ test suite -> 369 pass, 0 fail; API source is unchanged by the
    final correction.
  • bun run build from service/ -> exit 0.
  • Isolated API entrypoint and proxy builds -> exit 0.
  • git diff --check origin/main...HEAD -> pass.
  • GLM simplifier -> passed after removing five redundant assertions and
    correcting three overlapping response unions.
  • Integrated GLM final review -> passed after documenting 403 responses and
    session-scope query parameters and correcting the file-list response union.
  • CI run 33444536235
    -> all five required jobs passed at 8e20bd9.

The service build retains existing Rollup/TypeScript warnings outside this
package. No image, deployment, cluster, live API, or consumer rollout proof was
performed.

Security / Privacy

  • Contract fixtures contain no credentials, personal data, production
    payloads, tokens, or raw logs.
  • This package creates no new data flow, trust boundary, secret, or runtime
    exposure.

Blocking Before Merge

  • Integrated GLM final review passes at the exact head.
  • All five required CI jobs pass at the exact updated head.
  • Human review and explicit merge approval remain required.

Independence From Rollout

@rschlaefli rschlaefli changed the title fix(api): align the public CodeAPI contract fix(api): align maintained CodeAPI contracts Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant