use crate::depot::capsules::{ReplayCapsuleEntry, ReplayDepotRefusal, StoredReplayEntryRef};
use crate::descriptor::{
AdmissionGround, CheckRef, ClaimRef, Classification, ExecutionSuite, MutationPointRef,
PopulationRef, ProposalId, ReplayBearingGround, Row, RowRefusal, StagedTableRefusal,
SubjectRoute,
};
use crate::identity::{ContentAddress, DomainTag, IdentityProfileVersion};
use crate::muterprater::{
ActivationDisposition, DemonstratedRejection, MutationTarget, MutationVerdict,
};
use crate::report::{
ClaimExercise, ExecutionKey, Fingerprint, ReplayCapsule, RunReport, TrialId, TrialReport,
};
#[path = "type_guard.rs"]
mod guard;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum OracleClass {
GoldenVector,
IndependentTranscript,
StructuralRead,
CompiledReadBack,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct SurvivorExplanation {
target: MutationTarget,
claim: ClaimRef,
missing: OracleClass,
closing: CheckRef,
}
#[must_use = "a refusal is the reason a survivor was not explained"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ExplanationRefusal {
NotASurvivor(MutationVerdict),
OwnerUnmapped,
}
#[must_use = "a check gap is a finding, never a candidate"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct CheckGap {
claim: ClaimRef,
check: CheckRef,
missing: OracleClass,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CandidateSketch {
suite: ExecutionSuite,
classification: Classification,
subject: SubjectRoute,
population: PopulationRef,
}
#[must_use = "a refusal is the reason a candidate was not synthesized"]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SynthesisRefusal {
CheckGapFound(CheckGap),
ExternalSurvivorNamesNoPoint,
RowRefused(RowRefusal),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct OwedClaim {
claim: ClaimRef,
opening_condition: &'static str,
}
#[must_use = "a refusal is the reason an owed claim was not declared"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum OwedClaimRefusal {
NoOpeningCondition,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ProofShape {
StatedCase,
GeneratedSearch,
ScheduledFault,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ObligationLane {
TestRow,
FuzzSeed,
ChaosScenario,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct OwedDeclaration {
owed: OwedClaim,
shape: ProofShape,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct InferredObligation {
owed: OwedClaim,
exercise: ClaimExercise,
shape: ProofShape,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DischargeEvidence {
lane: ObligationLane,
trial: TrialId,
key: ExecutionKey,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Demonstration {
report: RunReport,
trial_report: TrialReport,
rejection: DemonstratedRejection,
}
#[must_use = "a refusal is the reason a kill was not demonstrated"]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProofRefusal {
StagingRefused(StagedTableRefusal),
NotStaged,
CandidateNotInCensus,
CandidateNotSelected,
CandidateDidNotExecute,
CandidateDidNotRefuse,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ProofDelta {
before: usize,
after: usize,
}
#[must_use = "a refusal is the reason a proof delta was not stated"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ProofDeltaRefusal {
NoProofAdded {
before: usize,
after: usize,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MutantKilledGround {
target: MutationTarget,
activation: ActivationDisposition,
capsule: ReplayCapsule,
demonstration: Demonstration,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ClaimPinnedGround {
claim: ClaimRef,
capsule: ReplayCapsule,
delta: ProofDelta,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ObligationDischargedGround {
owed: OwedClaim,
discharge: DischargeEvidence,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum NoComparisonReason {
GroundCarriesNoFailure,
NoKnownMaterial,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FailureComparison {
candidate: Fingerprint,
known: Vec<Fingerprint>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ObligationComparison {
owed: ClaimRef,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NoComparison {
reason: NoComparisonReason,
}
#[must_use = "a refusal is the reason a proposal was not offered"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum DuplicateRefusal {
FingerprintAlreadyKnown(Fingerprint),
ObligationAlreadyDischarged(TrialId),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ProposalDestination {
suite: ExecutionSuite,
}
pub const PROPOSAL_TAG: DomainTag =
DomainTag::declared("proposal", IdentityProfileVersion::declared(1));
pub trait ProposalDocument {
fn candidate(&self) -> &Row;
fn ground_summary(&self) -> AdmissionGround;
fn destination(&self) -> ProposalDestination;
fn identity(&self) -> ProposalId;
}
pub trait ReplayBearingProposal: ProposalDocument {
fn replay_capsule(&self) -> &ReplayCapsule;
fn replay_ground(&self) -> ReplayBearingGround;
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MutantKilledProposal {
candidate: Row,
ground: MutantKilledGround,
duplicate: FailureComparison,
destination: ProposalDestination,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ClaimPinnedProposal {
candidate: Row,
ground: ClaimPinnedGround,
duplicate: NoComparison,
destination: ProposalDestination,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ObligationDischargedProposal {
candidate: Row,
ground: ObligationDischargedGround,
duplicate: ObligationComparison,
destination: ProposalDestination,
}
#[must_use = "a refusal is the reason a proposal was not built"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ProposalRefusal {
NotACandidate,
SurvivorPointMismatch {
synthesis: MutationPointRef,
target: MutationPointRef,
},
}
#[must_use = "a refusal is the reason a mutant-killed proposal was not offered"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum KillProposalRefusal {
MutationNotDemonstrated {
verdict: MutationVerdict,
},
DemonstrationMismatch {
mutation: ContentAddress,
demonstration: ContentAddress,
},
ReplayExecutionMismatch {
replay: ContentAddress,
demonstration: ContentAddress,
},
ReplayFingerprintMismatch {
replay: ContentAddress,
demonstration: ContentAddress,
},
Duplicate(DuplicateRefusal),
Refused(ProposalRefusal),
}
#[must_use = "a refusal is the reason a discharge proposal was not offered"]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum DischargeProposalRefusal {
Duplicate(DuplicateRefusal),
Refused(ProposalRefusal),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StoredProposalRef {
proposal: ProposalId,
token: String,
}
#[must_use = "a refusal is the reason a proposal was not stored"]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SinkRefusal {
Unavailable,
AlreadyStored(ProposalId),
EmptyLocation,
DestinationNotDurable,
}
pub trait ProposalSink {
fn store<Document: ProposalDocument>(
&mut self,
proposal: &Document,
) -> Result<StoredProposalRef, SinkRefusal>;
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ReplayAdmissionReceipt {
row: Row,
entry: ReplayCapsuleEntry,
proposal_custody: StoredProposalRef,
replay_custody: StoredReplayEntryRef,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DischargeAdmissionReceipt {
row: Row,
proposal_custody: StoredProposalRef,
}
#[must_use = "a refusal is the reason human admission did not complete"]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum HumanAdmissionRefusal {
ProposalCustodyMismatch {
expected: ProposalId,
found: ProposalId,
},
RowRefused(RowRefusal),
ReplayDepotRefused(ReplayDepotRefusal),
ReplayCustodyMismatch {
expected: crate::descriptor::ReplayRef,
found: crate::descriptor::ReplayRef,
},
}