Skip to content

Clamp Linux battery capacity percentage#1957

Open
VACInc wants to merge 1 commit intohenrygd:mainfrom
VACInc:fix-linux-battery-capacity-clamp
Open

Clamp Linux battery capacity percentage#1957
VACInc wants to merge 1 commit intohenrygd:mainfrom
VACInc:fix-linux-battery-capacity-clamp

Conversation

@VACInc
Copy link
Copy Markdown
Contributor

@VACInc VACInc commented Apr 27, 2026

Summary

  • clamp Linux sysfs battery capacity values to the valid 0-100 range before reporting them
  • add a regression test for a kernel/sysfs capacity value above 100

Context

Some Linux systems can briefly report battery capacity values above 100 via /sys/class/power_supply/*/capacity. Beszel currently forwards that value directly, which can surface impossible percentages like 105% in integrations.

Tests

  • go test -tags testing ./agent/battery
  • go test ./agent/...

@VACInc VACInc requested a review from henrygd as a code owner April 27, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant