A Rust library for managing diagnostic fault reporting, processing, and querying in Software-Defined Vehicles. The library implements the fault lifecycle defined by ISO 14229 (UDS) and exposes fault state through an OpenSOVD-compatible interface.
fault-lib/
├── src/
│ ├── common/ # Shared types: FaultId, FaultRecord, FaultCatalog, debounce …
│ ├── fault_lib/ # Reporter-side API (fault reporting, enabling conditions)
│ ├── dfm_lib/ # Diagnostic Fault Manager (processing, SOVD, KVS storage)
│ └── xtask/ # Developer automation (cargo xtask …)
├── tests/
│ └── integration/ # Integration tests (fault-lib ↔ DFM end-to-end)
├── examples/ # Runnable examples (DFM, SOVD fault manager, tst_app)
├── docs/ # Sphinx / mdBook documentation
│ └── design/ # Architecture & design decisions
├── .github/workflows/ # CI/CD pipelines
├── .vscode/ # Recommended VS Code settings
├── BUILD # Root Bazel targets
├── MODULE.bazel # Bazel module dependencies (bzlmod)
├── Cargo.toml # Rust workspace root
├── project_config.bzl # Project metadata for Bazel macros
├── LICENSE # Apache-2.0
└── README.md # This file
| Crate | Description |
|---|---|
common |
Foundational types shared by reporters and DFM: FaultId, FaultRecord, FaultCatalog, DebounceMode, compliance tags, IPC timestamps. |
fault_lib |
Reporter-side API. Applications use Reporter to publish fault records to DFM via iceoryx2 IPC. Includes enabling-condition guards and builder-pattern catalog configuration. |
dfm_lib |
Diagnostic Fault Manager. Receives records via FaultRecordProcessor, manages lifecycle state, persists to KVS (KvsSovdFaultStateStorage), and exposes faults through SovdFaultManager. |
xtask |
Developer automation tasks (e.g., code generation helpers). |
git clone https://github.com/eclipse-opensovd/fault-lib.git
cd fault-lib# Cargo (all crates)
cargo build --workspace
# Bazel (all targets)
bazel build //src/...Start the Diagnostic Fault Manager (DFM):
cargo run -p dfm_lib --example dfmThe dfm process uses hardcoded fault catalogs matching the JSON files in
src/fault_lib/tests/data/. When ready you will see:
[INFO dfm_lib::fault_lib_communicator] FaultLibCommunicator listening...
In a separate terminal, start a reporter application:
cargo run -p fault_lib --features testutils --example tst_app -- -c src/fault_lib/tests/data/hvac_fault_catalog.json
# or
cargo run -p fault_lib --features testutils --example tst_app -- -c src/fault_lib/tests/data/ivi_fault_catalog.jsonThe tst_app reporter loops 20 times over every fault in the catalog,
alternating between Failed and Passed with a 200 ms delay.
# All workspace tests (unit + integration)
cargo test --workspace
# Integration tests only
cargo test -p integration_tests
# Bazel tests
bazel test //...The tests/integration/ crate contains a comprehensive end-to-end test suite
exercising the full fault-lib - DFM - SOVD pipeline without IPC:
| Module | What it covers |
|---|---|
test_report_and_query |
Basic report - process - SOVD query flow |
test_lifecycle_transitions |
Full lifecycle: NotTested - PreFailed - Failed - Passed |
test_persistent_storage |
KVS persistence across DFM restart, delete operations |
test_multi_catalog |
Multi-tenant catalog isolation, cross-catalog independence |
test_debounce_aging_cycles_ec |
Debounce, aging policies, operation cycles, enabling conditions |
test_error_paths |
Error handling, validation, edge cases |
test_boundary_values |
Boundary conditions, limits, overflow scenarios |
test_concurrent_access |
Thread safety, concurrent publish/query |
test_ipc_query |
IPC-based SOVD query/clear protocol |
test_json_catalog |
JSON catalog parsing, validation |
CI automatically runs these checks on every PR and push to main.
To run them locally before pushing:
cargo fmt --all -- --check
bazel test //:format.checkcargo clippy --workspace --all-targets -- \
-D warnings -D clippy::unwrap_used -D clippy::expect_used \
-D clippy::todo -D clippy::unimplemented -A clippy::new_without_defaultcargo build --workspace
cargo test --workspace
bazel build //src/...
bazel test //...cargo +nightly miri test --workspacebazel test //:copyright.check| Document | Description |
|---|---|
| Design | Architecture and design decisions |
To run a live preview of the documentation locally:
bazel run //docs:live_previewProject-specific metadata used by Bazel macros (e.g., dash_license_checker):
PROJECT_CONFIG = {
"asil_level": "QM",
"source_code": ["rust"],
}