Skip to content

feat(api): split internal and tenant-public OpenAPI contracts (#861) - #1064

Merged
athvin merged 3 commits into
mainfrom
issue/861-api-audiences
Nov 9, 2026
Merged

athvin merged 3 commits into
mainfrom
issue/861-api-audiences

Conversation

@athvin

@athvin athvin commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #861

🚧 Claimed by an agent session — 2026-11-09T21:37:30Z, session Codex:01a1be1b-0c92-7703-a4c2-25cb2c999baa on Mac-46.
The claim is this open draft PR: closing it releases the ticket.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

Generate internal and tenant-public OpenAPI documents from the same source derivation. The public contract excludes operator and internal attempt routes; compatibility checks cover both audiences.

Why

Tenant consumers need a contract scoped to their credentials, while frontend TypeScript retains the complete internal surface. Component-only compatibility checks missed operation and request-input breaks.

Proof

make check, make frontend, and make skills-check passed locally. CI is green on d415cb75; three independent house reviewers found no candidates. Both leak guards and strict route-removal checks were observed failing before restoration.

Risk & rollback

Contract tooling and generated artifacts only. CI remains advisory; arbitrary schema compositions and query compatibility are still outside its coverage. Revert the squash commit to roll back.

Post-merge ledger

Closed by: Codex · session Codex:01a1be1b-0c92-7703-a4c2-25cb2c999baa on Mac-46 · 2026-11-09T23:04:51Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  • Derive all operations, including the attempt-token channel; filter the public audience from role and namespace metadata.
  • Add audience CLI selection, both snapshots, and compatibility detection for removed operations, added path parameters and newly required request properties.
  • Compare both audiences in advisory CI, preserve internal TypeScript generation, and include the public snapshot in Rust classification/pass-key inputs.
  • Run failing-first probes, restore sources, run local gates and independent house review.
  • Land on exact-head green CI.
  • Complete the post-merge watch and ledger.

Decisions and limits

Internal has 97 paths / 113 operations; public has 84 paths / 98 operations. The four attempt operations use a distinct attemptAuth scheme describing projected ServiceAccount or per-attempt fallback tokens. The shared response classifier follows returned map_or_else closures while excluding unrelated callbacks/background blocks.

Request compatibility follows local references, nested objects/arrays and the emitter's nullable shape. It is bounded detection, not a complete schema-language compatibility engine. No handler behavior, branch protection or strict-mode policy changed. A missing public baseline is explicitly reported as initial publication; later PRs compare it against its own snapshot. TypeScript remains generated from internal.

Validation

  • make check passed after rebasing onto 80c674ec and building its new native DuckDB profile. make skills-check passed.
  • make frontend: 75 files / 922 unit-component tests; production build; 662 browser passes / 133 expected skips. Mac visual baseline comparison was skipped. Frontend content is byte-identical across the subsequent rebases.
  • Focused restoration checks: 21 OpenAPI tests and 13 library tests passed. Deliberately exposing an operator route and an internal route each failed the public subset test. Removing GET /healthz caused strict exit 2 for both audience checkers; original sources restored.
  • CI classifier/pass-key tests: 59 / 38 passed. Restoring the old path regex made the public-artifact test fail, then the correct regex was restored.
  • Final CI: Rust 42710490492, frontend 42710490540, infra 42710490457, devcontainer 42710490513. Both audience labels are visible in the entities job; internal has no breaks and public reports initial publication.
  • One combined CI fix iteration: use diagnostic equality assertions and reduce the CLI logging allowance from five calls to four after Clap replaced usage output. All integration legs passed.
  • House review at BASE 80c674ec, HEAD d415cb75: instrumentation, tier and reuse each found no candidates, with separate derivation/adapter passes. No SQL changes; no verifiers needed. Review excluded gate-owned failures and general compatibility completeness.

Files

Shared derivation in er-api-spec; audience generation, compatibility and CLIs in er-server; both OpenAPI snapshots and internal TypeScript; advisory CI/classification helpers; the API-contract skill. The logging guard allowance is tightened to the actual CLI call count.

@athvin
athvin marked this pull request as ready for review November 9, 2026 22:17
@athvin
athvin force-pushed the issue/861-api-audiences branch from 4cc9d27 to d415cb7 Compare November 9, 2026 22:17
@athvin
athvin merged commit d3ed9cc into main Nov 9, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two OpenAPI audiences (internal + tenant-public) and the CI breaking gate over both

2 participants