ADR 0018: additive core API in 1.x
Status: Accepted on 2026-11-30 (knotrel/knotrel#239). Maintainer decision of
2026-11-30: new, non-breaking knotrel-core APIs may be added; changes to
existing APIs require 2.0.0. Supersedes the “no public item” clause of
ADR 0015 decision 2. Issues:
#157 (snapshots),
#234 (first use).
Related: ADR 0016 (snapshots), compatibility policy.
Context
ADR 0015 kept knotrel-core free of new dependencies and public items in
v1.3.0, so that the runtime refactor could not change the core’s contract. A
snapshot (ADR 0016) has to copy every
node and edge of a graph, but today the ett, hdt and cluster-forest
engines cannot list their edges through the public API. Without a core
addition, snapshots would work only on compact-bfs and the lifecycle graph.
Decision
- In 1.x the core may gain new public items when they are purely
additive under section 3 of the compatibility policy:
new inherent methods, new types, new variants of
#[non_exhaustive]enums or fields of#[non_exhaustive]structs, new optional configuration. They start as Experimental and are classified in stability and the public API snapshot, like any other addition. - Changing an existing public item requires 2.0.0. This covers removals, renames, narrowed signatures, added trait bounds, new required trait methods, and changes to documented behavior or error contracts.
- The rest of ADR 0015 decision 2 stands: the core gains no new dependency, stays synchronous and keeps no knowledge of the runtime or server.
Alternatives considered
- Keep the core frozen in v1.3.0. Snapshots would then be limited to
compact-bfsand the lifecycle graph, or each engine would need a server-side workaround that reaches into private structures. Rejected. - Allow core changes case by case through a new ADR each time. Additive items are already governed by the compatibility policy and the public API check. A separate ADR for each one adds review without adding protection. Rejected.
Consequences
- WP-P’s bulk listing (
for_each_nodeandfor_each_edgeonConnectivityGraphandLifecycleGraph, #234) proceeds as an Experimental addition. - The public API and API compatibility CI jobs remain the gate: an addition
must appear in the snapshot with a classification, and any breaking change
fails
cargo-semver-checksunless it ships in 2.0.0. - The core’s MSRV (Rust 1.98.1) and its absence of dependencies are unchanged.