ossctl_core/protocol/contract.rs
1//! Public wire DTO for the normalized `OSS-RELEASE.md` contract (SCHEMA.md §4).
2//!
3//! This is the versioned public surface every `/oss-*` member reads. At founding
4//! the wire DTO is exactly the canonical model — the serialized form of
5//! [`crate::contract::schema::Contract`] *is* SCHEMA.md §4, so a second parallel
6//! struct would be duplication with no divergence to justify it. This module
7//! therefore re-exports the canonical types and owns the wire-version
8//! declaration ([`CONTRACT_SCHEMA_VERSION`]).
9//!
10//! The seam the ADR mandates (internals refactor without a wire break) stays
11//! open: when the internal model ever needs a shape the wire cannot follow,
12//! introduce a dedicated `ContractDto` here plus a `From<&schema::Contract>`
13//! conversion and pin it — exactly the "sanctioned escape hatch when it hurts"
14//! posture ADR-0001 takes toward the domain-crate split. Until then, one model,
15//! documented as the wire contract.
16//!
17//! Consumers read this document under the CLI's canonical `data` envelope:
18//! `{schema_version, data: <this shape>, warnings}` — every `ossctl --json`
19//! command shares that envelope, so the §4 fields live at `.data.*`, uniform
20//! with `facts`, `audit`, and the rest.
21
22pub use crate::contract::schema::{
23 Adapter, Changelog, ChangelogMode, ChangelogSource, Contract, ContributionProvenance,
24 DependencyBot, DocsSite, Ecosystem, HealthBadge, Maturity, ProvenanceLevel, Registry, Release,
25 ReleaseLayout, ReleaseModel, Status, Target, VersioningBase,
26};
27
28/// The `OSS-RELEASE.md` contract-document schema version this build reads and
29/// emits. Distinct from the JSON-envelope [`crate::SCHEMA_VERSION`]: this
30/// versions the *contract document* (SCHEMA.md §4), that versions the *wire
31/// envelope*. Both are `1` today. A breaking change to the §4 shape bumps this
32/// (and [`crate::contract::schema::KNOWN_SCHEMA_VERSION`], its enforcement
33/// twin), never silently (migration rule).
34pub const CONTRACT_SCHEMA_VERSION: u32 = crate::contract::schema::KNOWN_SCHEMA_VERSION;