Public: anyone can read this; the crew can change it.

Disk health rules: a spec catalog and alerts only on what the drive itself reports #10616

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This adds the disk health catalog and rules as pure modules. Nothing calls them yet: no route, no page, no I/O, as the issue asks.

shipped production is serving it deploy cca14ac

opened this

This adds the disk health catalog and rules as pure modules. Nothing calls them yet: no route, no page, no I/O, as the issue asks.

  • src/machines/disk_catalog.ts: a spec for Samsung SSD 980 PRO 1TB (600 TBW, 5-year warranty, temperature warning 82 °C, critical 85 °C). Any other model returns null.
  • src/machines/disk_health.ts: parseSmartJson returns the reading, a named refusal for bad input, or { kind: "behind-controller" } for a PERC disk with no NVMe health log.
  • assessDisk: it alerts only on a critical-warning bit, spare below its threshold, percentage used ≥ 80, media errors above the previous reading, or critical-temperature minutes above the previous reading. 41 unsafe shutdowns alone stays ok.
  • Tests: test/disk-health.test.ts covers each rule against the four fixtures plus the PERC disk under test/fixtures/smart/. All 15 tests pass.

Why the pull was parked: I did not see the failing check log. The branch did have a merge conflict with main in scripts/unreached-allow.json, where main had dropped src/kernel/why_now.ts from the list. I resolved it by dropping why_now.ts and keeping the two disk modules. They are listed there as not yet reached, because the page that reads them is the next slice. bun scripts/gate.ts and bun x tsc --noEmit are clean after bun install. I ran only the disk-health test file, not the full suite.

Not done: no route, page or alert wiring. The new pull is the first time the forge's check runs on this merged state.

Closes #10464

commented

This adds the disk health catalog and rules as pure modules. Nothing calls them yet: no route, no page, no I/O, as the issue asks.

  • src/machines/disk_catalog.ts: a spec for Samsung SSD 980 PRO 1TB (600 TBW, 5-year warranty, temperature warning 82 °C, critical 85 °C). Any other model returns null.
  • src/machines/disk_health.ts: parseSmartJson returns the reading, a named refusal for bad input, or { kind: "behind-controller" } for a PERC disk with no NVMe health log.
  • assessDisk: it alerts only on a critical-warning bit, spare below its threshold, percentage used ≥ 80, media errors above the previous reading, or critical-temperature minutes above the previous reading. 41 unsafe shutdowns alone stays ok.
  • Tests: test/disk-health.test.ts covers each rule against the four fixtures plus the PERC disk under test/fixtures/smart/. All 15 tests pass.

Why the pull was parked: I did not see the failing check log. The branch did have a merge conflict with main in scripts/unreached-allow.json, where main had dropped src/kernel/why_now.ts from the list. I resolved it by dropping why_now.ts and keeping the two disk modules. They are listed there as not yet reached, because the page that reads them is the next slice. bun scripts/gate.ts and bun x tsc --noEmit are clean after bun install. I ran only the disk-health test file, not the full suite.

Not done: no route, page or alert wiring. The new pull is the first time the forge's check runs on this merged state.

Approved

Pure modules, no route, page, terminal or I/O, so the security, both-doors and docs items do not apply yet. The preview shows nothing new and I did not expect it to. Tests cover each rule, including the boundaries (spare at vs below threshold, 79 vs 80, rising vs equal), and 41 unsafe shutdowns alone stays ok. The unreached-allow entries are justified because the reading page is the next slice. Next, two things. (1) Wire the reader: a page and a TUI screen with docs/features/disk-health.md, and delete the allowlist entries in the same pull. (2) Make the failing test name each reason (bits, spare, media errors) instead of only counting 3, and drop or use the _spec parameter once a caller exists.

commented

Left #10464 open: 1 unticked item remain (src/machines/disk_health.ts: parseSmartJson(text) turns smartctl --json -a output into { model, firmware, capacityBytes, dataUnitsWritten, bytesWritten, percentageUsed, availableSpare, spareThreshold, mediaErrors, criticalWarning, temperatureC, warnTempMinutes, critTempMinutes, powerOnHours, unsafeShutdowns } or a named refusal for bad input; a device behind a RAID controller (PERC / megaraid, no NVMe health log) parses as { kind: "behind-controller" }, never as an SSD.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs