ferrox/provenance.rs
1//! Ferrox's `ProvenanceSource` marker.
2//!
3//! Migrated to the [`converge_pack::ProvenanceSource`] trait. Public
4//! surface is unchanged at call sites:
5//! `FERROX_PROVENANCE.proposed_fact(...)` reads the same.
6//!
7//! The `converge-core` engine emits the uniform `suggestor.execute`
8//! tracing span automatically around every `Suggestor::execute`
9//! call. Suggestors override `Suggestor::provenance()` to return
10//! `FERROX_PROVENANCE.as_str()` so the engine's span carries the
11//! right origin.
12
13use converge_pack::ProvenanceSource;
14
15/// Marker type identifying ferrox-emitted facts.
16#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
17pub struct Ferrox;
18
19impl ProvenanceSource for Ferrox {
20 fn as_str(&self) -> &'static str {
21 "ferrox"
22 }
23}
24
25/// Canonical provenance constant for ferrox.
26pub const FERROX_PROVENANCE: Ferrox = Ferrox;
27
28#[cfg(test)]
29mod tests {
30 use super::*;
31 use converge_pack::ContextKey;
32
33 #[test]
34 fn provenance_string_is_stable() {
35 assert_eq!(FERROX_PROVENANCE.as_str(), "ferrox");
36 }
37
38 #[test]
39 fn proposed_fact_uses_canonical_source_string() {
40 let fact = FERROX_PROVENANCE.proposed_fact(
41 ContextKey::Diagnostic,
42 "diagnostic",
43 converge_pack::TextPayload::new("content"),
44 );
45 assert_eq!(fact.provenance(), "ferrox");
46 }
47}