#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ProvenanceTag {
pub origin: &'static str,
pub absorbed_session: &'static str,
pub description: &'static str,
}
impl ProvenanceTag {
#[must_use]
pub fn is_valid(&self) -> bool {
!self.origin.is_empty()
&& !self.absorbed_session.is_empty()
&& !self.description.is_empty()
&& self
.origin
.bytes()
.all(|b| b.is_ascii_alphanumeric() || b == b'_')
}
}
pub const PROV_CG_SHADERS: ProvenanceTag = ProvenanceTag {
origin: "lattice_qcd",
absorbed_session: "lattice/cg v0.6.1",
description: "Conjugate gradient solver for lattice QCD",
};
pub const PROV_LATTICE_QCD: ProvenanceTag = ProvenanceTag {
origin: "lattice_qcd",
absorbed_session: "lattice v0.6.4",
description: "Lattice QCD gauge field theory operations",
};
pub const PROV_SPECTRAL: ProvenanceTag = ProvenanceTag {
origin: "physics_validation",
absorbed_session: "spectral v0.6.0",
description: "Spectral theory and eigenvalue methods",
};
pub const PROV_HERMITE_LAGUERRE: ProvenanceTag = ProvenanceTag {
origin: "physics_validation",
absorbed_session: "special v0.6",
description: "Hermite/Laguerre polynomials for nuclear physics",
};
pub const PROV_ESN_NPU: ProvenanceTag = ProvenanceTag {
origin: "ml_inference",
absorbed_session: "esn_v2 npu",
description: "Echo State Network NPU backend",
};
pub const PROV_ODE_GENERIC: ProvenanceTag = ProvenanceTag {
origin: "marine_bio",
absorbed_session: "numerical/ode_generic",
description: "Generic ODE solver (phage_defense, cooperation, etc.)",
};
pub const PROV_BIO_PRIMITIVES: ProvenanceTag = ProvenanceTag {
origin: "marine_bio",
absorbed_session: "bio handoff v4",
description: "Life-science GPU primitives (Felsenstein, Smith-Waterman, etc.)",
};
pub const PROV_BRAY_CURTIS: ProvenanceTag = ProvenanceTag {
origin: "diversity_stats",
absorbed_session: "bray_curtis_f64",
description: "Bray-Curtis distance for diversity metrics",
};
pub const PROV_TENSOR_SESSION: ProvenanceTag = ProvenanceTag {
origin: "neural_dispatch",
absorbed_session: "S-01, S-11",
description: "TensorSession operation batching",
};
pub const PROV_SWARM_NN: ProvenanceTag = ProvenanceTag {
origin: "ml_inference",
absorbed_session: "metalForge swarm",
description: "Swarm neural network forward and scores",
};
pub const PROV_BATCH_FITNESS: ProvenanceTag = ProvenanceTag {
origin: "ml_inference",
absorbed_session: "metalForge batch_fitness",
description: "Batched fitness evaluation for evolutionary algorithms",
};
pub const PROV_RK45_ADAPTIVE: ProvenanceTag = ProvenanceTag {
origin: "neural_dispatch",
absorbed_session: "metalForge rk45",
description: "Adaptive Dormand-Prince RK45 for regulatory networks",
};
pub const ALL_TAGS: &[ProvenanceTag] = &[
PROV_CG_SHADERS,
PROV_LATTICE_QCD,
PROV_SPECTRAL,
PROV_HERMITE_LAGUERRE,
PROV_ESN_NPU,
PROV_ODE_GENERIC,
PROV_BIO_PRIMITIVES,
PROV_BRAY_CURTIS,
PROV_TENSOR_SESSION,
PROV_SWARM_NN,
PROV_BATCH_FITNESS,
PROV_RK45_ADAPTIVE,
];
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn all_tags_are_structurally_valid() {
for tag in ALL_TAGS {
assert!(
tag.is_valid(),
"structurally invalid provenance tag: {tag:?}"
);
}
}
#[test]
fn tag_count() {
assert_eq!(ALL_TAGS.len(), 12);
}
}