operations capa

operations-host-inventory

Host hardware inventory: CPU/RAM/GPU/NVIDIA-driver/Docker/disk detection + SMR probe (composes operations-drive-health)

Host hardware inventory: CPU/RAM/GPU/NVIDIA-driver/Docker/disk detection + SMR probe (composes operations-drive-health)

Tieroperations
Roleunclassified (baselined)
Pathcrates/operations/host-inventory
Edition2021
Targetsoperations_host_inventory
Public items28 across 8 modules
Tests52

What it is for

Host hardware inventory library crate.

Detects OS, CPU, RAM, NVIDIA GPU + driver, Docker, and a disk inventory (with an SMR probe), composing operations_drive_health for SMART grading. Shared by multiple consumers (frigate-box, bootusb, rust-inventory-ai) so detection lives in one tested place instead of being re-hand-rolled per app.

Testability

All system access goes through the CommandRunner trait (subprocess calls use strict argument vectors — never a shell — and file reads are explicit paths). Unit tests drive detection with testkit::FixtureRunner and canned tool output, so no test touches real hardware. Production uses SystemCommandRunner.

Status

Skeleton: the shared types + per-domain module signatures exist and compile; each detect() is implemented (TDD, tests-first) in the Sprint 0 fan-out.

Capabilities

DetectError

Host hardware inventory library crate.

Item
pub enum DetectError

HostReport

Host hardware inventory library crate.

Item
pub struct HostReport
fn inventory(runner : & dyn CommandRunner) -> HostReport

CpuInfo

CPU detection (parse /proc/cpuinfo).

Item
pub struct CpuInfo
fn detect(runner : & dyn CommandRunner) -> Result <CpuInfo, DetectError>

DiskInfo

Block-device inventory + SMR probe, composing operations_drive_health for

Item
pub struct DiskInfo
fn detect(runner : & dyn CommandRunner) -> Result <Vec <DiskInfo>, DetectError>

SmrStatus

Block-device inventory + SMR probe, composing operations_drive_health for

Item
pub enum SmrStatus

DockerInfo

Docker / container-runtime detection (docker version, docker info).

Item
pub struct DockerInfo
fn detect(runner : & dyn CommandRunner) -> Result <DockerInfo, DetectError>

fingerprint (other)

Privacy-preserving host hardware fingerprint (ADR 0017).

Item
pub const ALGORITHM: & str
fn raw_components(runner : & dyn CommandRunner) -> Vec <(& 'static str, Option <String>)>

MachineFingerprint

Privacy-preserving host hardware fingerprint (ADR 0017).

Item
pub struct MachineFingerprint
fn fingerprint(runner : & dyn CommandRunner, secret : & u8) -> MachineFingerprint

Quality

Privacy-preserving host hardware fingerprint (ADR 0017).

Item
pub enum Quality

GpuInfo

NVIDIA GPU + driver detection (nvidia-smi, lspci fallback).

Item
pub struct GpuInfo
fn detect(runner : & dyn CommandRunner) -> Result <GpuInfo, DetectError>

MemoryInfo

Memory detection (parse /proc/meminfo).

Item
pub struct MemoryInfo
MemoryInfo :: const fn total_gib(self) -> u64
fn detect(runner : & dyn CommandRunner) -> Result <MemoryInfo, DetectError>

OsInfo

OS identity detection (parse /etc/os-release).

Item
pub struct OsInfo
fn detect(runner : & dyn CommandRunner) -> Result <OsInfo, DetectError>

FixtureRunner

Test fixtures for driving detection without real hardware.

Item
pub struct FixtureRunner
FixtureRunner :: fn new() -> Self
FixtureRunner :: fn with_command(mut self, program : & str, args : & & str, output : CommandOutput) -> Self
FixtureRunner :: fn with_file(mut self, path : & str, contents : & str) -> Self
FixtureRunner :: fn run(& self, program : & str, args : & & str) -> Result <CommandOutput, DetectError>
FixtureRunner :: fn read_file(& self, path : & str) -> Result <String, DetectError>

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

operations_host_inventory

flowchart TD
  n_operations_host_inventory["operations_host_inventory"]
  n_operations_host_inventory --> n_cpu["cpu"]
  n_operations_host_inventory --> n_disk["disk"]
  n_operations_host_inventory --> n_docker["docker"]
  n_operations_host_inventory --> n_fingerprint["fingerprint"]
  n_operations_host_inventory --> n_gpu["gpu"]
  n_operations_host_inventory --> n_memory["memory"]
  n_operations_host_inventory --> n_os["os"]
  n_operations_host_inventory --> n_testkit["testkit"]

Public surface

`crate root`

ItemWhat it is
pub enum DetectErrorError raised while probing the host
pub struct HostReportAggregate host report
fn inventory(runner : & dyn CommandRunner) -> HostReportProbe the host through runner, collecting a best-effort HostReport

`cpu`

ItemWhat it is
pub struct CpuInfoCPU model + core counts.
fn detect(runner : & dyn CommandRunner) -> Result <CpuInfo, DetectError>Detect the CPU from /proc/cpuinfo

`disk`

ItemWhat it is
pub enum SmrStatusZoned-storage classification from /sys/block/<dev>/queue/zoned
pub struct DiskInfoOne block device.
fn detect(runner : & dyn CommandRunner) -> Result <Vec <DiskInfo>, DetectError>Enumerate block devices with transport, removable/rotational flags, SMR status, and mountpoints

`docker`

ItemWhat it is
pub struct DockerInfoDocker engine + compose + NVIDIA-runtime state.
fn detect(runner : & dyn CommandRunner) -> Result <DockerInfo, DetectError>Detect Docker + compose + the NVIDIA container runtime

`fingerprint`

ItemWhat it is
pub const ALGORITHM: & strFingerprint algorithm/version tag (bump to rotate the recipe or secret).
pub enum QualityConfidence tier of the identity evidence (ADR 0017)
pub struct MachineFingerprintA privacy-preserving host fingerprint: HMAC digests + presence/quality metadata only.
fn raw_components(runner : & dyn CommandRunner) -> Vec <(& 'static str, Option <String>)>Collect and normalize each identity component, without hashing — the exact same set fingerprint uses internally, before the HMAC step
fn fingerprint(runner : & dyn CommandRunner, secret : & u8) -> MachineFingerprintCompute the host fingerprint via runner, keyed by secret

`gpu`

ItemWhat it is
pub struct GpuInfoNVIDIA GPU + driver state.
fn detect(runner : & dyn CommandRunner) -> Result <GpuInfo, DetectError>Detect the NVIDIA GPU(s) + driver

`memory`

ItemWhat it is
pub struct MemoryInfoPhysical memory totals.
MemoryInfo :: const fn total_gib(self) -> u64Total RAM rounded to whole gibibytes (useful for the 12 GB floor check).
fn detect(runner : & dyn CommandRunner) -> Result <MemoryInfo, DetectError>Detect total RAM from /proc/meminfo

`os`

ItemWhat it is
pub struct OsInfoOperating-system identity, from /etc/os-release.
fn detect(runner : & dyn CommandRunner) -> Result <OsInfo, DetectError>Detect the OS from /etc/os-release

`testkit`

ItemWhat it is
pub struct FixtureRunnerA CommandRunner backed by canned command output and file contents
FixtureRunner :: fn new() -> SelfA runner with no fixtures (every lookup misses).
FixtureRunner :: fn with_command(mut self, program : & str, args : & & str, output : CommandOutput) -> SelfRegister canned output for an exact program+args invocation.
FixtureRunner :: fn with_file(mut self, path : & str, contents : & str) -> SelfRegister canned contents for an exact file path.
FixtureRunner :: fn run(& self, program : & str, args : & & str) -> Result <CommandOutput, DetectError>
FixtureRunner :: fn read_file(& self, path : & str) -> Result <String, DetectError>

Re-exports. Exported here, defined elsewhere.

ExportDefined in
{CommandOutput,CommandRunner,SystemCommandRunner}runner::{CommandOutput,CommandRunner,SystemCommandRunner}
{MediaVerdict,SmartSummary}operations_drive_health::{MediaVerdict,SmartSummary}
{fingerprint,raw_components,MachineFingerprint,Quality}fingerprint::{fingerprint,raw_components,MachineFingerprint,Quality}

Boundary

Depends on no other workspace tier.

Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-boot-media, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, … (40 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)operations
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/operations/host-inventory
Vocabulary in force (lexicon)current

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`operations-drive-health`operationsnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
hex^0.4noalways
hmac^0.12noalways
serde^1derivenoalways
serde_json^1noalways
sha2^0.10noalways
thiserror^2noalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
serde_json^1noalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_infrastructure_hardware_forensics["infrastructure-hardware-forensics"] -->|uses| SELF
  SELF["operations-host-inventory"]
  SELF -->|runtime| n_operations_drive_health["operations-drive-health"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
liboperations_host_inventory`src/lib.rs`

Error model

Error typeNamed by
DetectErrordetect

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: infrastructure-hardware-forensics.

Verification

KindCount
Unit tests52
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root302
cpu200
disk301
docker200
fingerprint502
gpu200
memory200
os200
testkit101

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc2628
Public modules with a //! block88
pie showData
    title Public items with rustdoc
    "Documented" : 26
    "No rustdoc detected" : 2

Metrics

MetricValue
Rust source files10
Source lines1974
Code lines1497
Public API items28
Public modules8
Tests52
Examples0
Cargo features0
Direct runtime dependencies7
Workspace reverse dependencies1
pie showData
    title Public API by kind
    "constant" : 1
    "enum" : 3
    "function" : 9
    "method" : 6
    "struct" : 9
pie showData
    title Rust source composition
    "Code" : 1497
    "Blank or comment" : 477

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las operations · Manual