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 #10471
I added the spec catalog and the disk-health parser and alert rules as pure modules, with no route, page or I/O. test/disk-health.test.ts passes (15 tests), bun x tsc --noEmit is clean, and bun scripts/gate.ts printed nothing. I did not run the forge's full check.
stopped parked by the crew deploy dac67c1
3 earlier comments
I added the spec catalog and the disk-health parser and alert rules as pure modules, with no route, page or I/O. test/disk-health.test.ts passes (15 tests), bun x tsc --noEmit is clean, and bun scripts/gate.ts printed nothing. I did not run the forge's full check. The keep_plan tool wasn't available, so there is no plan on the issue.
What changed
src/machines/disk_catalog.ts:diskSpec(model)is an exact-match lookup. It currently holdsSamsung SSD 980 PRO 1TB: 600 TBW, 5-year warranty, warning 82 °C, critical 85 °C. Any other model, or different casing, returnsnull.src/machines/disk_health.ts, parsing:parseSmartJson(text)readssmartctl --json -aoutput into the reading fields from the issue.
- Extra fields: the reading also carries kind: "nvme", which the issue didn't list.
- Bytes written: bytesWritten is data units × 512,000, as the NVMe spec defines a data unit.
- PERC: a megaraid/PERC device with no NVMe log returns { kind: "behind-controller" }.
- Refusals: bad input returns { kind: "refused", reason }. The reasons are not-json, not-smartctl-output, no-nvme-health-log, and bad-field with the field name.
src/machines/disk_health.ts, alerts:assessDisk(reading, previous?, spec)alerts on exactly the five rules from the issue and nothing else. Unsafe shutdowns, current temperature, minutes above the warning temperature, and written-vs-rated never raise an alert.- Fixtures:
test/fixtures/smart/hashealthy(the 11-09 reading: 1,074,219 data units, about 550 GB, 39 °C, 2,575 h, 41 unsafe shutdowns),worn(82% used),hot(critical minutes at 57),failing(warning bits 0x05, spare 7% against a threshold of 10%, media errors 12) andperc. These are synthetic files modeled on smartctl's JSON, not captures from a real drive. - Tests: each rule has a boundary test (spare 9 vs 10, used 79 vs 80, errors rising vs equal vs no previous reading). 4,100 unsafe shutdowns on their own stay ok.
What I chose not to do
specis accepted byassessDiskfor the signature but changes no alert. Written vs rated TBW and the projection belong to #10465 and #10466.- No SATA or SAS SMART parsing. A non-NVMe device that isn't behind a controller is refused as
no-nvme-health-log.
How to try it: bun test test/disk-health.test.ts.
Disk health rules: a spec catalog, and alerts only on what the drive itself reports (#10464).
Changes
src/machines/disk_catalog.tsis a catalog of drive specs.src/machines/disk_health.tsraises alerts only on what the drive itself reports in its SMART data. It never alerts on guesses.test/disk-health.test.tshas 15 tests. Fixtures undertest/fixtures/smart/cover healthy, failing, worn, hot and PERC (RAID-controller) drives.
The preview deploy "failure" needed no code change
- The summary "running at … · no tests declared, none run" is what the deploy writes for a successful deploy whose
forge.jsonhas noapp.test(NO_TESTS_TAILinsrc/apps/runtime.ts). It is not an error. - The log tail you sent ends in a SIGTERM drain from the environment being stopped. That is not a crash.
- The preview answers
/healthzwith 200. - I did not add an
app.test. The repository'scheckblock already runs the gate, the type check and the sharded tests on every push.
Checks run locally
bun scripts/gate.tspassed.bun scripts/fast.tsnamed 18 test files for the 8 changed files.bun test test/disk-health.test.tspassed 15 of 15.- I did not re-run
bun x tsc --noEmitthis turn, and nothing changed since the last push, so there is nothing new to push.
To try it, run bun test test/disk-health.test.ts.
🤖 Generated with Claude Code
Disk health rules: a spec catalog, and alerts only on what the drive itself reports.
What changed
src/machines/disk_catalog.tsis a catalog of drive specs, looked up by model.src/machines/disk_health.tsparsessmartctl --json -aoutput for NVMe drives and assesses it. Only what the drive reports as bad raises an alert. Unsafe shutdowns, temperature now, and written versus rated are plain numbers, never alerts.- Nothing in the app imports either module yet, so the "every module under src/ is imported by another, or allowed" check failed on both. I added the two files to
scripts/unreached-allow.json, which is the repository's way to list staged work. The list can only shrink, so the next slice that uses them removes the entries. - I merged
maininto the branch. That also droppedsrc/kernel/why_now.tsfrom the allow list, because it is reached oncemainis merged in.
What I chose not to do I did not wire the modules into a page or the alert path. That is a larger change, and this pull is the pure, tested core.
How to try it
bun test test/disk-health.test.ts test/unreached.test.ts— 19 pass.bun x tsc --noEmitandbun scripts/gate.tsare clean.- I did not run the full suite here; the forge's check runs it on the push.
Parked by the crew: the check stayed red through 2 automatic tries
I added the spec catalog and the disk-health parser and alert rules as pure modules, with no route, page or I/O.
test/disk-health.test.tspasses (15 tests),bun x tsc --noEmitis clean, andbun scripts/gate.tsprinted nothing. I did not run the forge's full check. Thekeep_plantool wasn't available, so there is no plan on the issue.What changed
src/machines/disk_catalog.ts:diskSpec(model)is an exact-match lookup. It currently holdsSamsung SSD 980 PRO 1TB: 600 TBW, 5-year warranty, warning 82 °C, critical 85 °C. Any other model, or different casing, returnsnull.src/machines/disk_health.ts, parsing:parseSmartJson(text)readssmartctl --json -aoutput into the reading fields from the issue.- Extra fields: the reading also carries
kind: "nvme", which the issue didn't list. - Bytes written:bytesWrittenis data units × 512,000, as the NVMe spec defines a data unit. - PERC: a megaraid/PERC device with no NVMe log returns{ kind: "behind-controller" }. - Refusals: bad input returns{ kind: "refused", reason }. The reasons arenot-json,not-smartctl-output,no-nvme-health-log, andbad-fieldwith the field name.src/machines/disk_health.ts, alerts:assessDisk(reading, previous?, spec)alerts on exactly the five rules from the issue and nothing else. Unsafe shutdowns, current temperature, minutes above the warning temperature, and written-vs-rated never raise an alert.test/fixtures/smart/hashealthy(the 11-09 reading: 1,074,219 data units, about 550 GB, 39 °C, 2,575 h, 41 unsafe shutdowns),worn(82% used),hot(critical minutes at 57),failing(warning bits 0x05, spare 7% against a threshold of 10%, media errors 12) andperc. These are synthetic files modeled on smartctl's JSON, not captures from a real drive.What I chose not to do
specis accepted byassessDiskfor the signature but changes no alert. Written vs rated TBW and the projection belong to #10465 and #10466.no-nvme-health-log.How to try it:
bun test test/disk-health.test.ts.Closes #10464