Repository navigation
fix(reports): show attribute name, value and threshold in alert lines - #1085
Conversation
populateAlerts left AttributeName and Threshold empty and used TransformedValue, which is 0 for most attributes, so report lines read 'Attribute 3 () = 0'. Fill the name from the attribute or its metadata, report the value the attribute is evaluated on, and include the manufacturer threshold. Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
Starosdev
left a comment
There was a problem hiding this comment.
Thanks for picking this one up, and for the test that pins the original bug.
Reviewed at head 560071e. Core fix is right — the fields existed (reports/models.go:104) and both formatters already render them, so this was purely a generator gap. Source-traced only; no build or test run. Five issues, all in alertAttributeDetails.
-
transformedATA attrs report packed raw bytes. OnlyNormalizedis special-cased, so attributes 9, 188 and 194 fall through toRawValue. Attribute 194's transform israwValue & 0b11111111(thresholds/ata_attribute_metadata.go:1033), so a 194 alert with raw 65576 prints 65576 where the UI shows 40C. Both existing consumers useTransformedValuehere:measurements/smart_ata_attribute.go:229-238anddetail.component.ts:387-391. Prefer exporting that existing selector over a third copy of the switch. -
ATA threshold printed against a raw-scale value. smartctl
threshapplies to the normalizedValue, but it is set for every ATA attribute andformatter_text.go:141prints it whenever non-zero. Attribute 10 with raw 2, normalized 100, thresh 97 renders= 2 [threshold: 97]. The UI showsthreshonly whendisplay_type === 'normalized'(detail.component.ts:440-447); match that. -
devstat and FARM lose their real threshold. Both prefer the metadata threshold and fall back to the drive value (
smart_ata_devstat_attribute.go:101-104,smart_farm_attribute.go:91-94); the PR readsattr.Thresholdonly.devstat_7_8fails against metadata threshold 100 whileattr.Thresholdis 0, so the threshold is dropped from the line. Mirror the fallback. -
ATA name and value diverge from the UI (minor): the smartctl
Namewins over metadatadisplay_name, so labels readSpin_Up_Timeagainst the UI'sSpin Up Time(detail.component.ts:361-367); an attribute with neither aNamenor metadata still yields an empty name, sincedefault: name = attrIDonly covers an unknown Go type; and for an attribute missing fromAtaMetadatathe value staysRawValuewhere the UI returns normalizedvalue(detail.component.ts:393-406). -
Test leaves the risky paths uncovered (minor): it does bind the original bug and is not tautological, but statuses are hand-set rather than from
PopulateAttributeStatus, and transformed ATA, raw ATA with a threshold, devstat/FARM thresholds, SCSI and missing metadata are all untested. A transformed case plus a no-threshold assertion on a raw attribute would have caught 1 and 2.
Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
|
Thanks for the careful review! Pushed 89faa38 for all five points. I also updated the PR description.
@Starosdev I've pushed the changes, could you take another look when you have time? Thanks! |
#1086 calls the unexported thresholdValue, so renaming it here would break the build once both PRs are merged. Keep it and add ThresholdValue for the report generator. Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
|
One small follow-up (019c143): instead of renaming |
|
Thanks for the quick turnaround, and for catching that the rename would have broken #1086; that was the right call. Reviewed at head
Two things left. 1. The NVMe and SCSI no-threshold sentinel reaches the PDF (blocking). Both formatters currently use 2. The metadata-absent ATA value now disagrees with #1086. This PR returns the normalized That is defensible. #1086 wants the value the status was evaluated on, and this PR wants the value a reader sees. It should be deliberate rather than incidental, though. Since #1086 already exports a package-level helper, the cleanest shape is for this PR to call it inside the metadata-present branch and drop Minor, no change requested: attributes 174, 204, 227 and 228 have metadata with no |
NVMe and SCSI attributes store -1 for no threshold, which the PDF report printed. Map it to 0 in alertAttributeDetails so every formatter sees no threshold. Add a FARM metadata-threshold test, and document the ATA value rule and why attributes 174, 204, 227 and 228 report RawValue. Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
|
Thanks, pushed 43adc8a.
|
Starosdev
left a comment
There was a problem hiding this comment.
Approving at head 43adc8af. Both items are addressed: the negative sentinel is clamped after the switch so it covers every protocol, and the comment records that measurements.AttributeEvaluatedValue owns the metadata-present ATA rule once #1086 lands.
Merge order is #1086 first, then this as it stands. Two follow-ups are yours to open after that: the nullable *int64 threshold, so a real zero (ATA attribute 4 at THRESH 000, NVMe critical_warning) can be told from no threshold and the PDF can render blank instead of 0, and the switch to AttributeEvaluatedValue dropping ThresholdValue.
Source-traced; CI on this head has not reported yet.
|
Thank you! Noted on the merge order. Once #1086 and this one are in, I'll open the two follow-ups: the nullable |
## Summary Move the darwin and freebsd cross-compiles off `macos-latest` and onto `ubuntu-latest` in both the CI and release build matrices. Only one GitHub-hosted macOS runner is available at a time, so two of the three macOS jobs queue and are cancelled at a 15-minute wall, which fails the whole run even though every test and lint job is green. ## Type of Change - [x] CI/CD or infrastructure change ## Related Issues Fixes #1097 Unblocks #1085 and #1086, whose runs failed only on these jobs. ## Changes Made - `.github/workflows/ci.yaml:173-175`: `darwin/amd64`, `darwin/arm64` and `freebsd/amd64` now build on `ubuntu-latest`. - `.github/workflows/release.yaml:182-184`: the same three entries, so a release cannot publish without its darwin and freebsd binaries when a macOS runner is unavailable. ## Testing - [ ] I have tested this locally - [ ] I have added/updated tests that prove my fix/feature works - [x] All existing tests pass This PR validates itself: its own CI run executes the changed matrix, so the three moved jobs either build on Ubuntu here or they do not. Reasoning for why no macOS host is needed, which is what the change rests on: - Both workflows set `STATIC: true` (`ci.yaml:164`, `release.yaml:172`), and the Makefile turns that into `CGO_ENABLED = 0` plus `-tags "static netgo"` (`Makefile:28-31`). `make binary-all` is then a pure Go cross-compile selected by `GOOS` and `GOARCH`. - `make package-collector-omnibus` runs `GOOS= GOARCH= GOARM= go run ./build/package-collector-omnibus --target-os ... --target-arch ...`, building the packager for the host and passing the target as flags. - Nothing in either job runs a test or a tool on the target platform; both only cross-compile and upload artifacts. Evidence for the failure, from the runs on #1085 and #1086: - `41835858037` rerun: `Build darwin/amd64` succeeded in 63 seconds, while `Build darwin/arm64` and `Build freebsd/amd64` both started at 18:42:54 UTC and were cancelled at 18:57:55, the same second, exactly 15m00s later. No logs exist for the cancelled jobs. - `41835856980` rerun: all three cancelled, `darwin/amd64` at 16m06s. - `develop` CI at 13:49 UTC the same day was fully green, so this affects runs needing more than one macOS runner at once. ## Checklist - [x] My code follows the project's code style - [x] I have performed a self-review of my code - [x] I have commented my code where necessary (particularly complex areas) - [x] I have updated the documentation if needed - [x] My changes generate no new warnings - [x] No console.log, debug statements, or commented-out code ## Additional Notes The `ci.yaml` artifact names embed `matrix.cfg.on` (`ci.yaml:193`), so they change from `binaries-macos-latest-darwin-arm64` to `binaries-ubuntu-latest-darwin-arm64`. Nothing consumes them; `release.yaml` names and downloads its own artifacts (`release.yaml:213,234`). A narrower alternative is `max-parallel` on the macOS entries, which would serialise them rather than move them. That keeps the ten times macOS minute rate and still leaves the jobs queueing, so it treats the symptom. Review: required (alters the release build matrix, which decides which platform binaries a published release contains)
…1104) ## Summary Follow-up to #1085 and #1086, as @Starosdev asked in the approval comment. The report's alert line now takes its ATA value from `measurements.AttributeEvaluatedValue`, and the extra exported `SmartAtaAttribute.ThresholdValue` is removed. No change in what the report prints. **Problem:** None visible to users. This is a cleanup. Until #1086 landed, the report code had its own copy of "which ATA field does the status use", through an exported method added only for it. **How it happens:** Not a bug. It was a stop-gap, noted in a comment in `alertAttributeDetails`. **Cause:** #1085 merged before `AttributeEvaluatedValue` existed, so it called `ThresholdValue`, which gives the same result. ## Type of Change - [x] Refactoring (no functional changes) ## Related Issues Follow-up to #1085 and #1086. No issue. ## Changes Made - `generator.go`: for an ATA attribute with metadata, `value` comes from `AttributeEvaluatedValue`. The ATA-without-metadata rule (normalized value, as the detail page shows) stays, as the helper would give the raw value there. Comment updated. - `smart_ata_attribute.go`: removed `ThresholdValue`. Nothing else called it (searched the repo). The private `thresholdValue` stays. **Scope:** The nullable threshold is a separate PR (#1103). It touches nearby lines in `alertAttributeDetails`, so the second to merge may need a small rebase. ## Testing - [x] I have tested this locally - [x] I have added/updated tests that prove my fix/feature works Added `TestAlertAttributeDetails_ATAValueMatchesEvaluatedValue`: for every ATA attribute with metadata, the alert value equals `AttributeEvaluatedValue`. As this is a refactor it passes before and after; the existing `TestAlertAttributeDetails` cases pass unchanged. Commands: `go vet` and `go test` on `webapp/backend/pkg/reports` and `webapp/backend/pkg/models/measurements` (pass), `gofmt -l` on the changed files (clean). `go vet` also on `pkg/notify` and `pkg/web/...`. I did not run the full suite. Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
## [1.79.3](v1.79.2...v1.79.3) (2026-11-05) ### Bug Fixes * **release:** restore changelog bodies and add a release dry run ([#1113](#1113)) ([ee517f2](ee517f2)), closes [#1112](#1112) * **reports:** count warning devices from active failures in report generator ([#1107](#1107)) ([1c80d1a](1c80d1a)), closes [#1105](#1105) ### Refactoring * **reports:** use AttributeEvaluatedValue for ATA alert values ([#1104](#1104)) ([aa4e266](aa4e266)), closes [#1085](#1085) [#1086](#1086) [#1086](#1086) [#1085](#1085) [#1103](#1103)
Summary
Scheduled report warning/failure lines showed an empty attribute name, a value of 0 and no threshold, e.g.
Attribute 3 () = 0.populateAlertsnever setAttributeNameorThreshold, and usedGetTransformedValue(), which is 0 for most attributes.Type of Change
Related Issues
Fixes #1079
Changes Made
alertAttributeDetailsinreports/generator.go, which follows the detail page (detail.component.ts):Nameonly if there is no metadata, then the attribute ID); value fromThresholdValue(normalized, transformed or raw, so temperature shows 40 instead of the packed raw bytes); the drive threshold is shown only for normalized attributes or attributes without metadata.Value, drive threshold, metadata display name. Their "no threshold" marker-1is reported as0, so the text, HTML and PDF reports all show no threshold instead of-1.SmartAtaAttribute.ThresholdValuethat calls the existingthresholdValue, so the report reuses it instead of a third copy of the switch.thresholdValuestays, since fix(notify): compare evaluated value for repeat-only-on-change notifications #1086 uses it.-1marker, and SCSI.Testing
go test ./webapp/backend/pkg/reports/... ./webapp/backend/pkg/models/measurements/...passes. Before the change the new cases fail (for example attribute 194 printed 65576 instead of 40, attribute 10 printed a threshold of 97 next to a raw value of 2). Not run: the full suite or a live scheduled report.Checklist