Skip to main content

Crate fmeca

Crate fmeca 

Source
Expand description

fmeca — the deterministic, offline kernel for structured FMECA (Failure Modes, Effects & Criticality Analysis).

The caller (an LLM) does the fuzzy work — naming failure modes, causes, effects, and proposing mitigations. This kernel owns structure: a typed failure-mode / mitigation ledger, the fixed qualitative criticality matrix (S×P → High/Medium/Low), the prevent→detect→fail-fast mitigation-order discipline, computed residual risk, gap detection with notify/clarify/ remediate signals, a readiness gate, and report export.

Criticality, residual, and standing are computed — a pure fold over an append-only event log, never stored. No LLM, no network. The kernel is a pure function of (events in) → (criticality + residual + gaps + readiness out).

§Layout

  • model — the typed data model (failure mode, mitigation, entity, levels, criticality, domain, issue).
  • scoring — the fixed code-resident evidence→score catalog + the observation→Level map (the model never picks a score).
  • response — the deterministic response_class magnitude derivation.
  • criticality — the fixed qualitative S×P matrix (the 3×3 strategy’s cells).
  • matrix — the swappable MatrixStrategy seam: a closed set of fixed matrices selected per session (3×3 default + NASA GSFC-HDBK-8004 5×5), each with locked cells.
  • event — the append-only event log line type.
  • store — the StateStore trait + filesystem (JSONL) impl.
  • projection — the FmecaState fold + computed criticality/residual/standing.
  • detect — issue detectors (one per IssueType).
  • signal — the three first-class signals + risk.next.
  • readiness — the readiness gate.
  • export — report.export.
  • validate — validate_log, structural checks over a session log.
  • engine — the Engine tying it together, with the per-session write lock.

Re-exports§

pub use analyze::AnalyzeFailureMode;
pub use analyze::AnalyzeInput;
pub use analyze::AnalyzeMitigation;
pub use analyze::AnalyzeReport;
pub use analyze::analyze;
pub use criticality::criticality;
pub use engine::Engine;
pub use error::FmecaError;
pub use error::Result;
pub use event::Event;
pub use export::ExportedMitigation;
pub use export::FmecaReport;
pub use export::FmecaRow;
pub use matrix::MatrixStrategy;
pub use matrix::StrategyLevel;
pub use model::AnalysisLevel;
pub use model::Criticality;
pub use model::Disposition;
pub use model::DispositionChange;
pub use model::Domain;
pub use model::EntityRef;
pub use model::EvidenceBasis;
pub use model::EvidenceKind;
pub use model::EvidenceRef;
pub use model::FailureMode;
pub use model::FailureModeStanding;
pub use model::Issue;
pub use model::IssueType;
pub use model::Level;
pub use model::Mitigation;
pub use model::MitigationKind;
pub use model::MitigationStatus;
pub use model::MitigationStatusChange;
pub use model::ParentRef;
pub use model::Rescore;
pub use model::ResolutionEvidence;
pub use model::SessionMeta;
pub use projection::FailureModeView;
pub use projection::FmecaState;
pub use projection::MitigationView;
pub use projection::Registry;
pub use readiness::CriticalityBuckets;
pub use readiness::ReadinessReport;
pub use readiness::ResolutionCounts;
pub use readiness::VerifiedGate;
pub use response::ResponseClass;
pub use response::Scope;
pub use response::response_class;
pub use scoring::Axis;
pub use scoring::ScoreCriterion;
pub use scoring::catalog;
pub use scoring::catalog_for;
pub use scoring::derive_level;
pub use scoring::derive_ordinal;
pub use signal::Signal;
pub use signal::SignalKind;
pub use signal::next_risk;
pub use store::FilesystemStore;
pub use store::StateStore;
pub use validate::LogProblem;
pub use validate::LogProblemKind;
pub use validate::validate_log;

Modules§

analyze
Stateless one-shot FMECA (analyze): hand the kernel an ENTIRE analysis in one call, get back the ENTIRE computed report.
criticality
The fixed qualitative criticality matrix.
engine
The kernel engine + session manager.
error
Kernel error type with stable, machine-parseable prefixes.
event
The append-only event log.
export
report.export: emit the FMECA report.
matrix
Swappable criticality-matrix strategy seam.
model
The typed FMECA data model.
projection
The FmecaState fold: replay the append-only log into a live snapshot with computed criticality, residual risk, and standing.
readiness
The readiness gate: deterministic, computed, honest.
response
Remediation-magnitude derivation: from a failure mode’s computed criticality + a breadth signal, derive HOW big the response must be.
scoring
Evidence→score mapping: the code owns the map from observed evidence to a level WITHIN THE ACTIVE STRATEGY’S SCALE; the caller (an LLM) NEVER supplies a numeric/qualitative score directly.
signal
First-class output signals: returned on every append and every read so the caller can never forget to check.
store
The event-log persistence seam.
validate
validate_log: structural checks over a session’s event log.