app-api-contract-testinglisted
Install: claude install-skill fusebase-dev/fusebase-flow
# Cross-App API Contract Testing
When this app calls another app via Gate `AppApisApi.callAppApi(...)`, it becomes a
**consumer** that depends on the **provider** operation behaving a certain way. A
*contract* captures that expectation. Contracts are **authored and validated
locally, then verified centrally** (`public-api → Gate` runs the real provider
call) — there is no local runtime verification command.
A contract is identified by **`providerAppId + operationId`** — the business
contract is the provider *operation*, not the HTTP transport.
## When to do this (during app development)
- After adding or changing a `callAppApi(...)` dependency in runtime code.
- Before relying on a provider, or after a provider you depend on is upgraded
(run `verify-consumer`).
- Before shipping a change to an app **other apps call** (run `verify-provider`
to catch every dependent consumer org-wide).
## Prerequisites
- `fusebase auth --api-key=<id>.<key>` (an API key is required).
- `orgId`/`productId` in `fusebase.json`, and the app configured with a `path`.
- The `cross-app-api-calls-analysis` flag (already enabled — this skill is only
present when it is).
## Workflow
```bash
# 1. Discover dependencies — scans runtime TS for callAppApi(...) and writes
# fusebaseAppApiDependenciesMeta into fusebase.json
fusebase analyze app-apis --feature <appId>
# 2. Scaffold draft contracts from the resolved callsites
fusebase app-api-contracts scaffold --app <appId>
# → drafts are bar