feat(doctor): battery health readout (#80)
Some checks failed
Check / eval (push) Has been cancelled

Report-only cycle_count + retained capacity (charge_* or energy_*) as
% of design on system batteries; soft warn below 70% of design; skip
when attrs missing. NOMARCHY_POWER_SUPPLY_ROOT for the checks.doctor
fixture (test_power has no cycle/design attrs).

Verified: V2 — nix flake check --no-build; checks.doctor green (fake
BAT0 cycles/% + Device-scope ignore); local BAT0 smoke (energy_*).
This commit is contained in:
Bernardo Magri
2026-07-11 10:06:13 +01:00
parent 3132ba5ac8
commit 71786bda6b
7 changed files with 114 additions and 16 deletions

View File

@@ -363,6 +363,12 @@ Design/decision records and a running log of shipped work (items marked
`checks.doctor` VM test asserts the `hibernate` row renders. (Gotcha
recorded: the script runs `set -euo pipefail`, so a no-match `grep` inside
`$(…)` or a `cond && action` aborts it — use `|| true` and `if`.)
✓ **Doctor battery health (#80, `VISION § C`):** report-only
`cycle_count` + retained capacity (`charge_full`/`charge_full_design` or
`energy_*`) as `% of design`, system batteries only (not Device-scope
peripherals). Self-gates when attrs missing; soft warn below 70% of
design. `NOMARCHY_POWER_SUPPLY_ROOT` for the `checks.doctor` fixture
(`test_power` has no cycle/design attrs).
- ✓ **Hibernate double-unlock:** on resume from hibernate the LUKS
passphrase already gates the machine, but locking hyprlock before sleep
meant a second password. Fixed by *not locking* before an encrypted