On this page

0076. Plugin requirements and host compatibility

Context

A host should be able to add items or change implementations without breaking a plugin that requires only existing signatures. Requirements need to be reviewable without changing the lock format or introducing a plugin manifest.

Decision

A plugin is any package with a recorded harness.requires; a host is a package directory whose locked graph provides the required items. These are not new manifest concepts. Check the generated sidecar into the plugin package. harness hashes <file.hn> --requires prints it to stdout for redirection. Neither this command nor harness check-compat <harness.requires> [host-dir] writes files; the lock remains under ADR-0072's explicit fetch contract.

Version-1 requirements record the plugin name and signature hashes of direct cross-package imports from its loaded modules. Signature closures cover further references. Public signatures cannot expose private types, except for a newtype's representation; that representation is omitted from signatures because the newtype is opaque and its repr affects only its own body hash (ADR-0069, ADR-0075).

Also record foreign-provider impls whose interface and named target types are in the plugin imports' closure, with their provider module. The plugin root does not require its own impls: those implementations ship with the plugin. Impl selection uses only the interface and named target types, including instantiated generic arguments, not method types. The interface's signature closure already reaches types appearing in its method signatures. This conservatively over-approximates usage; a moved provider may cause E0951 until requirements are regenerated, even if an equivalent impl exists elsewhere.

Visibility is per file as specified in the Decision of ADR-0069: newtype constructor and .value access belong only to the declaring file, and foreign impls gain no privilege. Public signatures cannot expose private types of their module, except a newtype representation.

The compatibility command loads required modules and their imports from the host graph, including impl providers, without compiling the host root. It compares signatures only, superseding ADR-0075's body-compatibility clause. Body-only changes and additional items are accepted; capabilities are ignored for now. It reports all missing public items or impls (E0951) and signature mismatches (E0952), sorted by item name; malformed or unreadable sidecars are E0953 and unsupported versions E0954. Rows omit namespaces: any public same-name candidate with a matching signature satisfies the row; a present name with no matching signature is E0952.

Alternatives considered

Consequences

The sidecar can over-approximate impl requirements and must be regenerated and reviewed when requirements change. Compatibility is an explicit signature check, not a guarantee of behavioral equivalence; automatic integration is left to M9.7.