feat(inventory): deep hardware capture + per-probe substeps + verbose logs
CI / Lint + build + test (push) Successful in 1m35s
Release / release (push) Successful in 9m34s

Extend Inventory stage from a one-liner summary to a per-probe substep
emitter with ~20-30 narrative log lines per run.

- spec: per-DIMM memory (slot/size/speed/manufacturer/part_number),
  richer CPU (vendor/stepping/physical_cores/flags), disk
  model/transport/rotational, NIC driver/pci_addr, GPU vram/pci/driver,
  new System/Baseboard/PSU/OS top-level sections. All fields omitempty
  so existing expected-spec YAML and artifacts stay compatible.
- spec.Diff: new diffDIMMs/diffSystem/diffBaseboard/diffPSU/diffOS
  helpers; extended diffDisks/diffNICs/diffGPUs for new fields. GPU
  diff gains PCIAddr-pinned matching alongside count-by-model.
- agent/probes/inventory: CPU (/proc/cpuinfo extended), Memory
  (dmidecode -t 17 multi-block), Disks (+model/transport/rotational),
  NICs (+driver/pci from sysfs), GPUs (VRAM from lspci -vv),
  new System/Baseboard (dmidecode -t system/baseboard), PSU
  (dmidecode -t 39), OS (/proc/sys/kernel/osrelease + /etc/os-release).
  All probes accept a Logger and emit per-finding info/warn lines.
- agent/probes/firmware: parseDmidecodeAllSections for multi-block
  fixtures (memory / PSU).
- agent/runner: Inventory case becomes 9 substep rows (CPU / Memory /
  Disks / NICs / GPUs / System / Baseboard / PSU / OS) with per-probe
  start/complete timestamps.
- report: new Inventory HTML section between Stages and Firmware;
  resolveReporting loads the inventory.json artifact.
- agent/tests/fakes/dmidecode: dispatches on -t flag to serve bios /
  memory / system / baseboard / 39 fixtures for unit tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 22:21:17 -04:00
parent 481b67fb69
commit 8acef92a60
10 changed files with 1715 additions and 148 deletions
+42
View File
@@ -230,3 +230,45 @@ func TestIsRealNIC(t *testing.T) {
}
}
}
// dmidecode -t 39 fixture with two PSU blocks. Verifies that
// parseDmidecodeAllSections returns every matching block, not just the
// first (which was the old parseDmidecodeSection behavior).
const dmidecodePSU = `# dmidecode 3.3
Handle 0x0040, DMI type 39, 22 bytes
System Power Supply
Location: PSU1
Manufacturer: DELTA
Model Part Number: ABC760
Max Power Capacity: 760 W
Status: Present, OK
Handle 0x0041, DMI type 39, 22 bytes
System Power Supply
Location: PSU2
Manufacturer: DELTA
Model Part Number: ABC760
Max Power Capacity: 760 W
Status: Present, Unplugged
`
func TestParseDmidecodeAllSections(t *testing.T) {
blocks := parseDmidecodeAllSections(strings.NewReader(dmidecodePSU), "System Power Supply")
if len(blocks) != 2 {
t.Fatalf("expected 2 blocks, got %d", len(blocks))
}
if blocks[0]["Location"] != "PSU1" || blocks[1]["Location"] != "PSU2" {
t.Fatalf("locations wrong: %+v", blocks)
}
if blocks[1]["Status"] != "Present, Unplugged" {
t.Fatalf("psu2 status: %q", blocks[1]["Status"])
}
}
func TestParseDmidecodeAllSectionsEmpty(t *testing.T) {
blocks := parseDmidecodeAllSections(strings.NewReader(""), "Memory Device")
if len(blocks) != 0 {
t.Fatalf("expected 0 blocks on empty input, got %d", len(blocks))
}
}