vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
//! Frozen mutation-class extension contract for adversarial source rewrites.

use vyre::Program;

/// Concrete mutation catalog previously available at `crate::adversarial::mutations`.
pub mod catalog;

include!(concat!(env!("OUT_DIR"), "/mutation_classes_registry.rs"));

/// Mutated IR program emitted by a [`Mutator`].
pub struct MutatedProgram {
    /// Stable mutation identifier.
    pub id: String,
    /// Program after applying the mutation.
    pub program: Program,
}

/// Community extension point for generating adversarial IR mutations.
///
/// This is the frozen mutator contract from `ARCHITECTURE.md`
/// §Frozen Contracts. Implementations must keep [`Self::id`] stable across
/// releases because certificates, TOML rule packs, and external reports use it
/// as the durable identity for the class. [`Self::mutations_for`] must return
/// only concrete source rewrites represented by [`Mutation`]; it must not
/// report abstract placeholders, side-effect-only probes, or mutations whose
/// applicability depends on hidden global state.
///
/// Implementations must be thread-safe, deterministic for identical input, and
/// complete for the mutation family they advertise. Returning an empty vector is
/// valid only when `source` contains no applicable target for that class.
pub(crate) trait Mutator: Send + Sync {
    /// Stable machine-readable mutation-class id.
    fn id(&self) -> &'static str;

    /// Apply this mutation class to a program.
    fn mutate(&self, program: &Program) -> Option<MutatedProgram>;
}