# Proving a package works

Each capability has a conformance suite, a set of checks any package
filling it must pass. `jadpo package conform <package> <capability>` runs
it against the provider's sandbox or an emulator. The registry lists a
package for a capability only with a passing run pinned to the package's
digest, and the app's own integrations run the suite in scheduled CI.
Tests use one fake per capability, whatever the provider: `email.sent`
for email, `published` for publishing.

`jadpo package conform <package> <capability>` runs the suite in an app,
in a scratch app of its own holding the package as the app installed it,
so each case goes through the package's mapping, its request, the package
driver's HTTP and its own types, as the app's sending or receiving does.
By default it runs against the package's recordings and a local fake on
this machine's loopback address, and nothing leaves the machine: every
request goes to the fake, so a package with fixed `hosts:` runs the same
as one whose connection gives `host:`. With `--live` it runs against the
provider's API through the app's own connection, and it is refused
(`conform.refused`) when there is no connection or its credential or
address isn't set. A case that fails is `conform.failed`.

- **`ai`** has six cases ([The conformance suite](/docs/the-conformance-suite.md)).
- **`email`** has four. A *message*, its parts sent where `input:` maps
  them and the provider's id read where `receipt:` says; *text only*, a
  message with no HTML sent with the part left out; an *attachment*, one
  file's name and bytes sent; and a *rejection*, each failure `failures:`
  maps answered as the provider refuses it and read as its
  `EmailFailure`. The live run sends through the connection the app's
  `email:` names, to the app's own sender address, so no one else gets
  mail; it is refused when `email:` names another connection. A provider
  can't be made to reject on request, so the live run skips the
  rejection.
- **`receiving`** has three. A batch of two *messages*, each body and
  handle read where the mapping says; an *empty queue*, an answer with no
  messages read as none; and *acknowledge*, a message acknowledged with
  its handle sent. `receiving` has no live run: it would take the app's
  own messages off its queue (`conform.refused`).
- **`publishing`** has three: *message*, its message sent where `input:`
  maps it; *unavailable*, a `503` tried again; and *refusal*, each
  declared failure read as itself. It has no live run, which would put a
  message on the app's own queue.
- **`search`** has four: *keep*, *search* (two ids read, best first),
  *no hits* and *remove*. It has no live run, which would fill the app's
  own index.
- **`documents`** has two: *render*, a document's HTML sent where
  `input:` maps it and the PDF read where `pdf:` says; and
  *unavailable*, a `503` read as `unavailable`, so the subscriber's
  delivery tries again. The live run renders one document through the
  connection the app's `documents:` names, which keeps nothing and sends
  no one anything; it is refused when `documents:` names another
  connection, and skips *unavailable*.

**The run a release shows.** `jadpo package check` and the
[verifier](/docs/the-verifier.md) run the suite of each capability a package fills,
as `jadpo package conform` runs it against its recordings and a local fake,
in the pass that runs the package's code. The release's facts say how each
ran, `conformance  email: conforms, 4 passed`, and the verifier's answer
holds each run with the release's digest, so a run speaks only for the
files it ran against. A suite that fails refuses nothing: the release can
be published, and the registry leaves it out of that capability's listing.

> The suites of `ai`, `email`, `receiving`, `search`, `publishing` and
> `documents` are built, the capabilities whose mappings are read, and so is the run a release shows,
> pinned to its digest; the registry's listing reads it from the
> verifier's answer. So is the app's own integrations' run of the suite
> against the provider, which the contract run takes through `--live`
> ([Tests and fakes](/docs/tests-and-fakes.md)). Another capability's suite comes
> with its mapping.
