Skip to content

API launch gate: enforce compatibility against the deployed public contract #658

Done
1 of 1 issue completed

Description

@athvin

API launch prerequisite · roadmap #1008 · depends on #861

Outcome

The first external production API consumer receives a contract protected against accidental breaking changes. This is an explicit launch prerequisite for #1013 and key issuance, not work to begin only after a customer already depends on the API.

Existing foundation and division of work

er-openapi-check currently runs advisory comparisons against origin/main. #861 owns internal/public document generation and CI comparison over those documents. This ticket owns the deployed-baseline publication and release preflight that CI against main cannot prove. Do not claim enforcement is already active.

  • Publish the effective public contract after successful deployment with immutable release identity and a durable pointer to what is serving.
  • Compare a candidate with that deployed baseline and enforce the supported breaking-change checks before exposing it to external consumers.
  • Document the detector's actual coverage; exercise removal/type changes and relevant operations/auth/request/response compatibility that customers rely on, without claiming unimplemented detection.
  • Handle first deployment, missing/unreadable baselines, rollback and intentional version changes explicitly; an unreadable baseline cannot silently approve a customer-facing deployment.
  • Prove the gate failing on an incompatible fixture and passing an additive change before the first production external key is issued.
  • Keep baseline access independent of PR-time cluster reachability where feasible; Terraform owns any storage/IAM changes.

Depends on #861. Select and document baseline storage/permissions during implementation. Existing 2-week estimate is provisional and must be revisited; no production configuration change is authorized by this planning edit alone.

Historical planning — superseded scope, ordering and estimates

Do not build this yet. It is deferred on a condition the repo states in three places, and the condition has not fired. Recorded here so the analysis is not re-derived and so the trigger is findable.

The trigger

The openapi gate stays advisory until the first external org API key exists:

  • docs/entity-framework-design.md rule 2 — "Until a third party holds an org API key, the gate warns; the day the first external key is issued it blocks."
  • the er-openapi-check binary's own header
  • the api-contract skill

No external key has been issued. Enforcing now would be building ahead of a stated condition — the opposite of PR10 (init container → pre-upgrade hook), where the stated condition (replicas > 1) had actually been met.

What it would do

Today the check is PR-only and advisory, diffed against origin/main (rust.yml). The target state: the deploy publishes frontend/src/lib/api/openapi.json after a successful cutover, and the preflight gates on --strict against that object. Additive paths and fields pass; a removed or retyped /v1 field fails. This is the "new routes just work" half of blue/green.

Why the plumbing is the expensive part

The gate needs a durable record of what is deployed, and every route costs something:

Route Cost
S3 cross-stack IAM. er-ci-sccache-read (which rust.yml already assumes) lives in envs/core, the lake bucket lives in envs/dev, and the bucket is SSE-KMS — so both sides need KMS grants as well as S3.
git tag contents: write on the deploy job, which no hand-written workflow here has (the four are contents: read + id-token: write).
ECR tells you what was built, not what is running.
read the cluster makes a PR gate depend on cluster reachability.

The recommendation, when the trigger fires

Prefer the S3 route, with the gate failing OPEN to origin/main and logging loudly which baseline it used. A missing grant then degrades to today's behaviour instead of silently gating nothing — which is the semgrep-reports-zero-findings-on-a-parse-error failure mode, and this repo has been bitten by it.

Priority is deliberately empty: absence of a priority is the backlog, and this is trigger-gated rather than scheduled.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    ci-backlog
    on Nov 6, 2026
  2. changed the title [-]DEFERRED (trigger: first external org API key) — er-openapi-check --strict against the deployed document[/-] [+]API launch gate: enforce compatibility against the deployed public contract[/+] on Nov 9, 2026
  3. added
    mvp
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ci-backlogmvp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions