This document states what Runway's extension API (`runway-spi`) guarantees to the code that compiles against
it — plugins and any first-party extension — and the rules by which it may evolve. It is the promise a plugin
author relies on when they build against a released `runway-spi` and expect their jar to keep loading on a
later Runway.
> **Status: in force from SPI `1.0.0` (Runway `1.0.0`).** The surface below — 56 types in three packages — is
> **frozen**: from here it changes only additively, within the `1.x` line, by the rules in this document. It includes
> the service tier (SPI `0.4.0`–`0.6.0`) through which a plugin reaches the host instead of importing host-internal
> classes. From `1.0.0` the kernel **enforces** the contract at load time: a plugin built for the pre-1.0 contract,
> one that links a kernel class, and one that breaks the Spring-context rules are each **blocked** with a reason on
> the plugins screen (see "How the kernel enforces it" below).
## What the SPI is
`runway-spi` is a **dependency-free** module: the extension interfaces (`mx.quest.runway.spi`), the immutable
boundary model they exchange (`mx.quest.runway.spi.model`) and the host services a plugin receives by injection
(`mx.quest.runway.spi.service`). It depends on **nothing** in the host — a plugin compiles against this thin, stable
artifact (and `runway-spi-testkit` for its tests), never against `runway-app`. `RunwaySpi.VERSION` is the contract
version an extension was built against — a compile-time constant, so the compiler copies it into the plugin;
`RunwaySpi.runtimeVersion()` reports the version of the kernel actually running.
**The 1.0 contract is the SPI alone.** Everything a plugin needs from the host — its settings, its per-site files,
the site's content and URLs, change events, the current request's site, permission checks, messages, starter pages,
console screens — is in the tables below. A plugin that needs something else has found a gap in the SPI; it is
added (additively) in a 1.x MINOR, never reached around.
## The surface (SPI `1.0.0`)
"Since" is the SPI version that introduced the type; every type is part of the `1.0.0` contract regardless.
### Extension axes — interfaces a plugin implements, collected by type
| Type | Since | Lifecycle method | Purpose |
|---|---|---|---|
| `HeadContributor` | 0.1 | `render(HeadContext) → String`, `headInputs(path)` | edge `<head>` markup injected on every page |
| `ContentWidget` | 0.1 | `render(WidgetView) → RenderFragment` | body content at a `data-widget` anchor |
| `PageQualityCheck` | 0.1 | `inspect(PageView) → List<Finding>` | content/SEO checks — advisory by default; an `ERROR` gates publishing on a site set to Enforced/Reviewed |
| `EndpointContributor` | 0.1 | `routes()`, `handle(RouteRequest) → RouteResponse` | servlet-free HTTP routes on the tenant realm |
| `ContentSource` | 0.3.0 | `enumerate` / `resolve` / `body` / `indexableText` | routable plugin content (virtual pages) fed to routing, the catalog, sitemap/llms.txt and search |
| `BackupParticipant` | 0.1 | `export` / `importInto` | per-site data kept **outside** the site folder (no first-party plugin has any; the plugin's own subtree already travels in the backup) |
| `CaptchaService` | 0.2.1 | `widget` / `verify` | the configured CAPTCHA (implemented by the essential plugin, consumed by any plugin with a public form) |
| `SiteLoginProtectionControl` | 0.2.1 | per-site login-protection toggles | implemented by the essential plugin |
`FilterBand` (enum, 0.1) remains in the SPI as an **identity** only: it names the request-pipeline band of a filter
contribution, a host-coupled seam that is not part of the 1.0 contract (see "What is NOT part of this contract").
### Service tier — interfaces the kernel implements, received by ordinary Spring injection
| `service.PluginSettings` (+ `model.SettingsView`) | 0.4.0 | plugin-scoped | its per-site settings, defaults applied, and its declared secrets decrypted (app-level settings bind through `@ConfigurationProperties("runway.plugin.<id>")`; an app-level `secret` setting in clear through `appSecret(key)`, since 1.1.0) |
| `model.PluginInfo` | 0.4.0 | plugin-scoped | its own id, version and install facts |
| `service.PluginLifecycle` | 0.4.0 | callback | `started(PluginInfo)` / `stopping()`, in load order and reverse |
| `service.PluginSiteFiles` (+ `model.FileEntry`) | 0.5.0 | plugin-scoped | its own per-site subtree `sites/<id>/plugins/<pluginId>/`: atomic text writes, capped reads, listing, deletes; confined against crafted paths **and** symbolic links |
| `service.Sites` | 0.5.0 | kernel singleton | a site's `SiteView` by id, off-request |
| `service.RequestContext` | 0.5.0 | kernel singleton | the tenancy the current request is bound to; empty on the application realm and off a request |
| `service.AccessCheck` | 0.5.0 | kernel singleton (bean `authz`) | `may(permissionKey)` for the current principal, fail-closed |
| `service.Messages` | 0.5.0 | kernel singleton | public text by an explicit site id; console text in the operator's UI language |
| `service.SitePages` (+ `model.StarterPage`, `model.InstallResult`) | 0.5.0 | kernel singleton | install a starter page through the site's editorial level |
| `service.ContentCatalogView` (+ `model.CatalogEntry`, `model.LocalizedUrl`) | 0.6.0 | kernel singleton | the site's published content surface with the URLs the host computed (the same addresses the `<head>`, the sitemap and llms.txt use) |
| `service.ContentChanges` | 0.6.0 | plugin-scoped | announce that its own content changed (evicts routing, listings, sitemap and search on every node; notifies listeners) |
| `service.SiteEventListener` (+ `model.SiteLifecycleEvent`, `model.SettingsChange`, `model.CatalogChange`) | 0.6.0 | callback | site lifecycle, its **own** settings saves, every change that may reshape the content surface — phased, after the kernel's caches, outside every host lock, with the item's URLs before and after |
| `service.ConsoleScreen` | 0.6.0 | annotation | a plugin `@Controller` that renders inside the console shell, with no host class |
A plugin-scoped service is bound to the plugin **whose own jar the injecting class came from**, never to an id the
plugin passes, so a plugin can only reach its own data. Rules every service keeps: no method returns `null`; an unsafe
site id (or slug, or path) throws `IllegalArgumentException` before any I/O; every service is thread-safe; off a request
thread the request-bound services answer empty, `false` or the fallback and never throw. A plugin consumes these
interfaces; it does not implement them — an alternative host or a `runway-spi-testkit` fake does, which is why the
additive rules below apply to them unchanged.
### Boundary model — immutable records the host builds (and plugin tests construct)
`"content.arbitrary-paths"` — capability flags the host branches on). Renaming the template, the attribute, the
bean or the key in a `1.x` would break every plugin that uses it, silently and at run time. (`RunwaySpi.VERSION`
is inlined too, on purpose — it records what the plugin was built against.) A new constant follows the same rule
from the release that adds it.
## How the kernel enforces it (from `1.0.0`)
Every rule here **blocks** the plugin — it is not wired, the reason is logged and printed in its row on the
**Plugins** screen, plugins that `requires:` it are blocked in cascade, and the platform starts with everything else.
None of them is a boot failure.
| Rule | Refused | Reason shown |
|---|---|---|
| **Mandatory floor** | a plugin with a `mainClass` that declares no `requiresSpi`, or a floor below `0.4.0` (library-only plugins are exempt) | "was built for the pre-1.0 plugin contract …" |
| **Floor** | a floor above the running SPI | "needs Runway SPI X or later …" |
| **MAJOR ceiling** | `kernel MAJOR > max(floor MAJOR, 1)` — a floor of `0.4.0`–`0.6.0` counts as 1.x (the service tier those versions introduced *is* the 1.0 contract); a 1.x floor is refused by a 2.x kernel | "was built for Runway SPI 1.x …" |
| **Host linkage** | a class in the plugin's own jars that references a kernel class outside `mx.quest.runway.spi` (read from the constant pool, without loading the class), or a plugin class living under `mx.quest.runway` | "uses Runway's internal classes …", naming them |
| **Missing SPI types** | an SPI type the running kernel does not have (a missing or wrong floor) | "needs SPI types this Runway does not have …" |
| **Spring-context rules** (before wiring) | a `@Bean` name not starting with the plugin id in lowerCamelCase; a `SecurityFilterChain`, servlet `Filter`, `FilterRegistrationBean`, `BeanPostProcessor` or `BeanFactoryPostProcessor`; a `@Controller` mapping outside `/__admin/<id>` and `/__app/<id>`; an unrestricted `@ControllerAdvice` | "breaks the plugin rules for Runway's shared Spring context …" |
| **Spring-context rules** (after wiring) | the same, found on a component-scanned bean the first check cannot see | the plugin is **quarantined**: the boot ends with the relaunch code (`42`) and the next boot blocks it with that reason |
| **Wiring failure** | a plugin bean that breaks the context refresh | quarantined the same way |
| **Essential dependency** | a `requires:` on the essential plugin | "requires the essential plugin …" |
A plugin's calls that fail at run time are contained instead (next section). The kernel also refuses individual
**contributions** without blocking the plugin: a colliding key, a route that is not exact or not on the tenant realm.
## The purity & isolation guarantees
Every model type is **immutable and host-built**, with collection/array components defensively copied and
null-normalized in the compact constructor — so a view handed to an implementation cannot be mutated by it or by
whoever built it. An extension-axis implementation is therefore a **pure function of its inputs**: it never sees
drafts, other versions, other tenants or other requests, and returns plain values. That keeps it trivially
unit-testable (no Spring, no I/O — `runway-spi-testkit` fakes the services), keeps tenant isolation outside the
extension, and lets the host evolve storage without touching an implementation.
- **`PageQualityCheck.inspect` must return non-null.** An empty list means "nothing to report".
- **`RouteRequest` / `RouteResponse` carry a `byte[] body`**, so their record-generated `equals`/`hashCode` compare it
by reference; do not rely on record equality for such instances. `body()` returns a fresh copy.
- **A `ContentSource` reads only its own per-tenant subtree and settings**, returns only published content with safe
paths, and keeps `enumerate()` metadata-only (it runs on anonymous requests — the sitemap). The kernel re-checks the
first two fail-closed.
## Failure containment (the host's side of the contract)
Every call the host makes into plugin code on a request, dispatch or scheduler path is contained: a
`RuntimeException` or `LinkageError` from `HeadContributor.render`/`headInputs`, `ContentWidget.render`,
`PageQualityCheck.inspect`, `EndpointContributor.handle`, a `ContentSource` method, `PluginLifecycle`,
`SiteEventListener`, `BackupParticipant.importInto` or a plugin's **`@Scheduled` method** (from `1.0.0`) is caught and
replaced — an empty head fragment or widget (that page is then served `Cache-Control: no-store` without validators),
one `WARNING` finding `check.failed` (which never blocks a publish), an endpoint `500` with `no-store`, a skipped
callback or scheduled run (the next run happens on schedule). A `null` where the axis forbids it counts as a failure.
Any other `Error` propagates. `BackupParticipant.export` is deliberately not contained: its failure fails the backup.
The first failure per plugin, axis and key is logged with its stack, then at most once a minute with a count; each is
counted in `runway.plugin.contribution.failures{plugin,axis,key}` and shown on the plugins screen. There is no circuit
breaker: a throwing contributor costs a stack unwind, not a timeout.
## What is NOT part of this contract
- **Kernel classes** (`mx.quest.runway.*` outside `.spi`): storage, sites, pages, the catalog, the host's Spring
events, the console model, the security seams. A plugin that links one is blocked.
- **Servlet filters and Spring Security chains** (`FilterContribution`, `SecurityFilterChain`): servlet- and
Spring-shaped, and able to reach every request; a non-essential plugin may not contribute them. A separate
`runway-spi-servlet` module may be added in a 1.x if a real consumer appears.