hwmon: disambiguate colliding chip labels #3646
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 257 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.332
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3646"
general
weight: 0.35
mwimpelberg28
Summary
Fixes #3637.
Multiple hwmon nodes can be registered under a single parent device — for example,
asus-nb-wmion recent ASUS laptops registers one hwmon for fan control and another for WMI sensors. Bothdevicesymlinks resolve to the same/sys/devices/platform/asus-nb-wmi, sohwmonNameproduces the sameplatform_asus_nb_wmichip label for both, and any sensor file that exists in both nodes (e.g.pwm1_enable) trips:Approach
Updatenow does two passes:/sys/class/hwmon/*, compute the device-derived base chip name for each, and count collisions.namefile content if it disambiguates, otherwise with the hwmonX basename (always unique within a boot). The include/exclude filter is also moved here so user regexes match the label that is actually emitted in the metric.Entries that already produce a unique chip label are unaffected — no surprise suffixes for users not hitting the collision.
This is closer in spirit to the discussion in #333 (the same class of bug for dual-socket
coretempboxes), but contained: the fix only kicks in when an actual collision is detected.Test plan
New
collector/hwmon_linux_test.go:TestHwmonDuplicateChipNamesAreDisambiguated— reproduces the #3637 ASUS WMI scenario (two hwmon dirs sharing one platform device, both exposingpwm1_enable) and asserts bothGathersucceeds and the chip labels are distinct.TestHwmonUniqueChipNamesAreUnchanged— guards against unintended label drift for users not hitting the collision.TestHwmonDuplicateChipNamesWithSameNameFile— exercises the hwmonX-basename fallback when thenamefile content also collides.go test ./collector/), including the existing fixture-driven e2e checks.go vet ./...clean.