---
title: "Conformance suite"
description: "The fixtures an adapter registers, running the suite, and proposing an adapter."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.rsc-kit.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Conformance suite

An adapter is ready when it passes rsc-kit's conformance suite - all of it.
Serve the fixtures below from your backend, then run:

```sh
npx -y -p @rsc-kit/core rsc-kit-conformance \
  --endpoint http://127.0.0.1:8123/__rsc/host-call --secret test \
  --previous-secret old --manifest rsc-host.json --purge-port 8790
```

Every bug found at this boundary so far was a difference between how a
backend and the engine read the wire: a nil list sent as `null` where the type
said a list, a timestamp typed `unknown`, a refusal that did not arrive as the
error a page checks for. Each is now a case in the suite. The Laravel and Go
adapters run it in CI on every change, against rsc-kit's main.

## Registering the fixtures

Register these functions in your backend, written with your adapter's ordinary
API, the way an app would write them:

| Function | Must |
| --- | --- |
| `Conformance.echo` | return its one argument unchanged |
| `Conformance.emptyList` | return an empty list, the way your language says "no rows" |
| `Conformance.time` | return 2026-01-02T03:04:05Z as your language's time value |
| `Conformance.noTime` | return an absent time |
| `Conformance.unauthenticated` | refuse as not signed in |
| `Conformance.unauthorized` | refuse as not allowed |
| `Conformance.notFound` | refuse as not found (404) |
| `Conformance.refuse` | refuse with 429 and "Slow down." |
| `Conformance.invalid` | refuse the input, on the field `name` |
| `Conformance.invalidNested` | refuse the input, on `address.city` and on the form itself, under `""` |
| `Conformance.redirect` | send the visitor to `/login` |
| `Conformance.revalidate` | mark `orders` stale and return `"ok"` |
| `Conformance.fail` | fail with an ordinary error |
| `Conformance.double` | take one integer and return it doubled; anything else fails it |
| `Conformance.authorization` | return the forwarded `Authorization` header |
| `Conformance.cookie` | return the forwarded `Cookie` header |
| `Conformance.login` | set a cookie named `conformance_login` on the response, and return `"ok"` |
| `Conformance.flash` | leave the one-time message `"Saved."` (`"success"`) for the next page, after any the visitor's `rsc-flash` cookie still carries, and return `"ok"`. Optional: if your framework has a flash of its own, leave it out of your manifest and let apps use that |
| `Conformance.change` | say `conformance:changed` changed, as your webhook would, and return `"ok"` |
| `Conformance.onPage` | return `"ok"` only when the page its action was posted from (the `x-rsc-page` header) is `/conformance/orders/7` with `{order}` bound to `"7"`; refuse otherwise, and from no page |

Then `Conformance.ip`, returning the visitor's address as your request reports
it.

And four guards:

| Guard | Must |
| --- | --- |
| `conformance-allow` | pass |
| `conformance-deny` | refuse |
| `conformance-redirect` | send the visitor to `/conformance-login` |
| `conformance-page` | pass only when the page it is asked about is `/conformance/orders/7` with `{order}` bound to `"7"` |

The Go adapter's `cmd/conformance` and Laravel's `tests/Conformance` are
working fixtures to copy.

## Running the suite

Start your backend with `CDN_PURGE_URL=http://127.0.0.1:8790/`, where the
suite listens for its purges, and `RSC_HOST_CALL_SECRET_PREVIOUS=old`. Then:

```sh
npx -y -p @rsc-kit/core rsc-kit-conformance \
  --endpoint http://127.0.0.1:8123/__rsc/host-call --secret test \
  --previous-secret old --manifest rsc-host.json --purge-port 8790
```

If your manifest has [`calls`](/hosts/your-own-backend/calls/#during-a-build),
add the whole command a build would run: `--calls "bin/rails rsc:manifest --calls"`.

It exits non-zero on any failure, so it can gate your CI. Add `--debug` for an
adapter started with its debug on.

## What it checks

It checks the whole contract in these pages:

- **values** - every JSON shape unchanged, `[]` for no rows, ISO 8601 times,
  arguments decoded to their types, and every value against the type your
  manifest declares;
- **outcomes** - each refusal as the engine's own error, field errors with
  dotted paths and the form's under `""`, redirects, revalidation staying
  with its call, a crash staying a failure, and arguments that do not fit
  failing rather than refusing;
- **forms** - a function taking one object, its fields in order with the hints
  a browser can check, and a refusal landing on its field;
- **the request** - `Cookie` and `Authorization` forwarded, the visitor's
  address in place of the renderer's, a cookie set by a call reaching the
  page, no secret or the wrong one refused with 403, the previous one answered
  while `RSC_HOST_CALL_SECRET_PREVIOUS` names it (so a rotation fails no call;
  without `--previous-secret` this fails), an unknown function 404, a
  malformed body 400;
- **batches** - every call answered, a refusal only its own, and more than 50
  refused with 413 before any runs;
- **guards** - in the order named, stopping at the first that does not pass,
  a redirect from one, a name nobody registered refusing, and a guard reading
  the page it is asked about rather than the call;
- **live data** - a name never changed at 0, a change moving it to a time in
  milliseconds that never comes round again, only the names that differ
  answered, and a held call bounded by `wait`;
- **purges** - a change posted to `CDN_PURGE_URL` as its tag, as JSON, only
  once the version has moved. Without `--purge-port` these fail: every
  adapter purges.
- **a build's calls** - with `--calls`: what is the same for everyone answered,
  every function that reads or sets something of the visitor's said to need one,
  refusals and failures keeping their shape, and a process that outlives a
  malformed line and ends with its input. A manifest with `calls` and no
  `--calls` fails.
- **debug** - with `--debug`, for an adapter started with its debug on, a
  failure carrying `debug` with a type, a message and at least one frame.
  Without the flag it is not checked: a backend sends a trace only in
  development.

## Testing it without the renderer

```sh
curl -s http://127.0.0.1:8123/__rsc/host-call \
  -H 'Content-Type: application/json' -H 'X-Rsc-Host-Secret: test' \
  -d '{ "function": "Conformance.echo", "args": [{ "a": 1 }] }'
# {"result":{"a":1}}
```

The contract is plain HTTP, so a backend's own test suite can cover it without
a JavaScript process: POST the request shape, assert the reply shape.
Laravel's Pest suite does this, and the Go adapter's `go test` does the same.
The end-to-end proof — a real page rendered with data from your process —
lives with the engine, which is where a rendering regression can be caught.

## Proposing an adapter

rsc-kit standardises on adapters: a backend in a language rsc-kit has none for
gets one, rather than a second way to reach it. To propose one, open a
discussion or a pull request on
[rsc-kit/rsc-kit](https://github.com/rsc-kit/rsc-kit). To be adopted, an
adapter:

- passes the whole conformance suite, in its own CI, against rsc-kit's main on
  every change - not a subset, and not with cases skipped;
- registers the fixtures with its ordinary API, the way an app would;
- covers everything in these pages, live data included - `__rsc.changed`, a
  way to say a name changed, a store every instance shares, and the purge.

## The imports for adapter authors

An app never imports these. An adapter written in JavaScript, or a host that
embeds the engine, does:

- `@rsc-kit/core/adapter/host-calls`: `httpHostCalls`, the renderer's side of
  this protocol, and the `HostCallReply` and batch types it reads.
- `@rsc-kit/core/adapter/conformance`: `runConformance` and `report`, the
  suite above as a function, for a test runner that drives it itself.
- `@rsc-kit/core/adapter/manifest`: `RouteManifest`, the type of the
  `routes.json` the build writes, for a backend that registers the app's urls
  as routes of its own.

Source: https://docs.rsc-kit.dev/hosts/your-own-backend/conformance/index.mdx
