Skip to content
Registry StackDocsv0.48.0

Adapter effective operation contract

View as Markdown

If you put a gateway in front of a Registry Adapter, the effective operation contract tells the gateway which read operations one loaded Adapter process can expose. It is generated from the same validated plan that adapter serve uses. It is not an authorization grant, an embedded MCP server, or personal-data delegation. Authored or executable operations that the gateway surface excludes stay listed as unserved with a stable reason code.

Terminal window
adapter effective-contract \
--runtime-config /absolute/path/runtime.yaml \
--project /absolute/path/project-directory \
--profile /absolute/path/profile.yaml \
--pack /absolute/path/pack.yaml

--profile and --pack have the same beside-the-project defaults as adapter serve. The command validates and loads the artifacts and the runtime binding without opening a listener, connecting to the journal database, or probing an upstream source. Secret references that the loader normally resolves, including static upstream credentials, must still resolve.

The JSON envelope is:

apiVersion: id.registrystack.org/formats/adapter/effective-contract/v1alpha1
kind: AdapterEffectiveContract
digest: sha256:<RFC 8785 digest of contract>
contract:
schemaDialect
project: { id, version }
profileVersion
artifactDeploymentDigest
authentication: { scheme, audience, clientAdmission }
authority
operations[]
unserved[]
problemSchema
protocolProblems

Each served operation carries these members:

  • Its stable concrete id and version.
  • Its binding and profile-operation ids.
  • The method and the concrete path.
  • support: served and effect: read.
  • Any request-body byte limit.
  • Closed path, query, and body schemas.
  • The exact derived output schema.
  • The alternative all-of scope sets that admit the call.

Only GET reads and profile-declared read-only POST operations enter the served gateway surface. A runtime-served write stays unserved here with adapter.operation.gateway-write-disabled. Effect classification is explicit, so a future write cannot be mislabeled as a read. Pagination schemas preserve the runtime page-size and cursor bounds, and paginated output arrays preserve the maximum page size. Request-body bounds are applied by the envelope’s actual slots, not by guessing property names.

An unserved entry carries the same identities, its classified effect, support: unserved, and a stable reason code with a value-free operator reason. Its effect is unknown only when the referenced profile operation is itself missing, so no method semantics exist to classify. A consumer must never turn an unserved entry into a tool or an HTTP call.

digest is SHA-256 over RFC 8785 canonical JSON containing a fixed digest domain, apiVersion, kind, and the complete contract member. Runtime readiness and the digest field itself are outside that digest. One whole-contract digest is pinned on every operation request; there is no separate per-operation digest. The artifactDeploymentDigest separately identifies the exact project, profile, and pack bytes that the Adapter loaded.

The export includes the resource audience, the generic allowlist admission mode, and the operation scope requirements, because a machine client needs them to request and present the right bearer token. It deliberately excludes OAuth client ids, secret references and values, database configuration, upstream origins, private network declarations, and source credentials.

The authority block fixes the limit of this contract in machine-readable form. The admitted caller is a trusted machine. Represented-subject and personal delegation are unsupported, target binding is unsupported, and the contract grants no row-level or field-level disclosure authority. Operation and record-type scopes do not become personal disclosure authority.

problemSchema remains the profile’s problem envelope for ordinary operation failures, including the resolved profile code and title with the engine’s fixed facade admission statuses. Profiles that declare typed problem data keep each code, title, allowed status set, and data shape correlated.

protocolProblems separately binds a closed problem envelope and two code and status pairs that this protocol owns:

  • adapter.contract.precondition-failed, HTTP 412.
  • adapter.contract.unavailable, HTTP 503.

The Adapter never changes a profile problem’s declared HTTP status to produce one of these protocol failures.

An Adapter that has completed startup serves:

GET /.well-known/registry-adapter/effective-contract
Authorization: Bearer <admitted machine token>

The endpoint requires the existing OIDC audience and client allowlist. It does not require a data-operation scope, create a new grant, or make contract metadata anonymous. A successful response is the export envelope plus:

{"readiness":{"ready":true,"configuration":"ready","journal":"ready"}}

The endpoint returns adapter.contract.unavailable when it cannot query the journal or when the live migration set differs from the set the binary supports. A gateway pins the expected digest and reads the protected runtime document when it establishes catalogue readiness. A mismatch or unavailable readiness prevents the catalogue from being served. A separate metadata read before every invocation is not required. Readiness does not probe the upstream source, so do not present it as a source-health or end-to-end facade check.

To bind each invocation to the reviewed contract, a gateway sends the pinned digest on every operation request:

x-registry-adapter-contract: sha256:<effective contract digest>

After the Adapter authenticates the machine client, it requires an exact, single header match before it creates an exchange, reads a body, or calls the source. A mismatch or a repeated header receives adapter.contract.precondition-failed with HTTP 412. The refusal is durably audit-journaled before the response, but no body is read, no exchange is created, and no source I/O occurs. If the journal cannot record the refusal, the Adapter returns adapter.contract.unavailable with HTTP 503 instead of claiming a durable 412. Omitting the header preserves existing clients; a gateway that uses effective discovery must always send it.

Every facade success and problem carries x-registry-request-id, minted by the Adapter. The protocol problems carry the same request id in their closed body. When the profile’s problem envelope exposes its request-id slot, that body value and the header are identical. The Adapter accepts no caller-supplied correlation header and records no reversible digest of caller correlation data.

Native write replays retain the original Adapter-minted response id in both body and header, so the cached response stays byte-identical. Their physical retry attempts have distinct journal ids. Native writes stay unserved in the external gateway contract.