Skip to main content

Module capability

Module capability 

Source
Expand description

RFC-018 Stage A — backend capability discovery surface.

Consumers of Arc<dyn EngineBackend> (and HTTP clients hitting ff-server) historically had no typed way to ask “what can this backend actually do?” before dispatching — they discovered capability gaps empirically, by trying a trait method and catching crate::engine_error::EngineError::Unavailable. This module adds a first-class discovery primitive: a Supports flat-bool struct, a BackendIdentity tuple, and a Capabilities container that crate::engine_backend::EngineBackend exposes via capabilities().

Stage A (this module) is additive: the trait method has a default impl that returns a Capabilities tagged family = "unknown" with every supports.* bool false, so out-of-tree backends keep compiling. Concrete in-tree backends (ValkeyBackend, PostgresBackend) override to report real caps.

Shape history. v0.9 shipped a BTreeMap<Capability, CapabilityStatus> map; v0.10 reshaped to the flat Supports struct below per cairn’s original #277 ask (flat named-field dot-access, no enum + no map lookup). Partial-status nuance (e.g. non-durable cursor on Valkey subscribe_completion) now lives in rustdoc on the trait method and docs/POSTGRES_PARITY_MATRIX.md; the flat bool answers “is this callable at all.”

Stages B + C (follow-up PRs) derive docs/POSTGRES_PARITY_MATRIX.md from the runtime value and expose GET /v1/capabilities on ff-server.

See rfcs/RFC-018-backend-capability-discovery.md for the full design, the four owner-adjudicated open questions, and the Alternatives-considered record.

Structs§

BackendIdentity
Minimal-identity triple for a backend. Consumers that only need the family label + version (e.g. for metrics dimensioning) read this rather than the full Capabilities.
Capabilities
Full capability snapshot for a backend: its BackendIdentity plus a flat Supports surface of per-method bools.
Supports
Per-capability boolean support surface. Flat named-field shape so consumers can dot-access (e.g. caps.supports.cancel_execution) instead of map lookup. #[non_exhaustive] protects future additions from source-breaking consumers; construct via Supports::none or by returning one from crate::engine_backend::EngineBackend::capabilities.
Version
Backend crate version. Kept as a struct (not a semver string) per RFC-018 §9 Q2: consumers can write if backend.capabilities().identity.version >= Version::new(0, 10, 0) { .. } without pulling a semver-parsing dep.