Expand description
The versioned plugin API stability contract (issue #1601).
Autumn’s plugin system is a compile-time Rust surface: a plugin depends on
autumn-web, implements Plugin, and is mounted
with AppBuilder::plugin. That makes most
breakage a compiler error rather than a production incident — but only if
plugin authors know which APIs they may build on, and get told when the
framework they are mounted into is not the one they were written for.
This module is the machine-readable half of that contract. It carries three things:
PLUGIN_SURFACES— every plugin-facing API, declaredStableorExperimental.docs/plugins.mdrenders the same list, andscripts/check-plugin-surface.shfails when the two disagree.PluginContract— what a plugin declares about itself: theautumn-webrange it supports and any experimental surface it knowingly leans on. A plugin returns one fromPlugin::contract.evaluate— the compatibility verdict, and the diagnostic an incompatible pairing produces.
§The SemVer policy, by tier
| Tier | Promise | What a break costs |
|---|---|---|
SurfaceTier::Stable | Covered by STABILITY.md. Below 1.0 a break needs a minor bump, a migration guide, and a filled Plugin authors section in that guide; from 1.0 on it needs a major. | A build failure with an upgrade path. |
SurfaceTier::Experimental | May change in any release, including a patch. Declare it with PluginContract::uses_experimental so autumn plugin-check can report it. | A build failure you opted into. |
§Declaring a contract
use autumn_web::app::AppBuilder;
use autumn_web::plugin::Plugin;
use autumn_web::plugin_contract::PluginContract;
struct MyPlugin;
impl Plugin for MyPlugin {
fn contract(&self) -> Option<PluginContract> {
Some(
PluginContract::new(env!("CARGO_PKG_NAME"))
.plugin_version(env!("CARGO_PKG_VERSION"))
.autumn_web("0.9"),
)
}
fn build(self, app: AppBuilder) -> AppBuilder {
app
}
}Structs§
- Plugin
Compatibility Error - An incompatible plugin/framework pairing, rendered as the diagnostic a user sees.
- Plugin
Contract - What a plugin declares about its own compatibility.
- Plugin
Surface - One plugin-facing API, with the tier it is declared at.
Enums§
- Contract
Verdict - The outcome of checking a
PluginContractagainst a framework version. - Surface
Tier - Stability tier of a plugin-facing API.
Constants§
- AUTUMN_
WEB_ VERSION - The
autumn-webversion this build presents to plugins. - PLUGIN_
CONTRACT_ MARKER - Machine-readable stderr marker carrying the declared plugin contracts of a built application.
- PLUGIN_
SURFACES - Every plugin-facing API Autumn declares, sorted by
name.
Functions§
- evaluate
- Check a plugin’s declared
autumn-webrange against a framework version. - experimental_
surface_ names - The names of every
SurfaceTier::Experimentalsurface, in registry order. - lockstep_
contract - Builds the compatibility contract a first-party plugin declares from
Plugin::contract(issue #1601). - lockstep_
range - The
autumn-webrange a crate released in lockstep with the framework declares support for. - stable_
surface_ names - The names of every
SurfaceTier::Stablesurface, in registry order. - surface
- Look a surface up by its canonical name.