feat(doctor): #77 hibernate/sleep section (VISION § C)
All checks were successful
Check / eval (push) Successful in 3m41s

nomarchy-doctor gains a read-only hibernate/sleep section (the highest-ROI
Day-2 gap, a natural #76 follow-on): resume device on the kernel cmdline
(+ resume_offset for a swapfile), disk swap >= RAM, zram active, and any
suspend/hibernate error in the previous boot's kernel log. Self-gates
(skip on swap=0) and emits only ok/warn/skip, so it never fails the sheet.
Adds `hibernate` to the checks.doctor probe list so the row is asserted.

Fixes a set -euo pipefail hazard the first VM run caught (exit 1, no
verdict): a no-match grep inside $(...) and a `cond && action` both abort
under set -e — now guarded with || true / || echo 0 / if. Recorded in
MEMORY as a reusable gotcha for writeShellScriptBin scripts.

Verification: V2 PASS — checks.doctor VM test green (fresh build, exit 0;
asserts the hibernate row renders, healthy run stays 0). V1 — ran on real
LUKS+@swap hardware: all three ok rows render (resume set, swap 34G >= RAM,
zram 16G) and the sheet reaches its verdict. V0 bash -n + flake check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-10 21:06:45 +01:00
parent cf97f5605d
commit e841251399
6 changed files with 99 additions and 15 deletions

View File

@@ -99,16 +99,7 @@ high-ROI, etc.) live in the journal + ROADMAP — not here.*
### Product / day-2
- **Doctor: hibernate/sleep section** (`VISION § C`) — the doctor covers
units/disk/flake/network/audio/GPU/fingerprint/fwupd/charge but has **no**
hibernate check, even though #76 just made hibernation a default. Add a
read-only section: `resume=`+`resume_offset` present on `/proc/cmdline`
(or acknowledge the `swap=0` opt-out), a disk swap ≥ RAM present, zram
active at its priority, and no failed suspend/resume in the recent journal.
Self-gating (skip when swap=0). Why: "trust > new power UI." Cost: ~1
iteration, V2-guardable — the highest-ROI Day-2 gap found + a natural #76
follow-on. (Verified 2026-07-10: no resume/swap/hibernate lines in
`nomarchy-doctor.sh`.)
_(Doctor hibernate/sleep section → promoted to **NEXT #77** 2026-07-10.)_
_(Battery charge-limit instant → shipped 2026-07-10; V3 PASS Latitude
5310: Custom charge type + live menu + unplug re-apply.)_
@@ -169,10 +160,10 @@ _(Identity taste retunes + hand `btop.theme` for white/vantablack/lumon/
### v1.0 pointer
See **VISION**. Open PROPOSED: doctor hibernate section (`§C`, top Day-2
pick); Omarchy migrant doc (`§F`); auto time-of-day theme pair (`§D`, big);
NVIDIA wrappers deferred past v1; IR portal (b)/(c) hardware. Browser
default = Chromium; power = PPD.
See **VISION**. Doctor hibernate section promoted → NEXT #77. Open
PROPOSED: Omarchy migrant doc (`§F`); auto time-of-day theme pair (`§D`,
big); NVIDIA wrappers deferred past v1; IR portal (b)/(c) hardware.
Browser default = Chromium; power = PPD.
## Decisions `[human]`

View File

@@ -17,6 +17,27 @@ Template:
---
## 2026-07-10 — #77 doctor hibernate/sleep section (V2 PASS)
- **Task:** BACKLOG #77 (promoted from PROPOSED by Bernardo) — read-only
hibernate section in nomarchy-doctor (`VISION § C`, #76 follow-on).
- **Did:** Added a hibernate/sleep row group to `nomarchy-doctor.sh`: resume
device on cmdline (+ `resume_offset` for a swapfile), disk swap ≥ RAM,
zram active, previous-boot suspend/hibernate error. Self-gates (`skip` on
swap=0); only ok/warn/skip → never fails the sheet. Added `hibernate` to
the `checks.doctor` probe list.
- **Verified:** **V2 PASS**`checks.doctor` VM test green (fresh build,
exit 0; asserts the hibernate row renders + healthy run still 0). **V1**
ran on this box's real LUKS+@swap layout: all three `ok` rows render
(resume set, swap 34G ≥ RAM, zram 16G) and the sheet reaches its verdict.
**V0** bash -n + flake check.
- **Gotcha (fixed + MEMORY):** the doctor runs `set -euo pipefail`; my first
cut aborted before the verdict because a no-match `grep` inside `$(…)` and
a `cond && action` both trip set -e. Fixed with `|| true` / `|| echo 0` and
an `if`. First VM run caught it (exit 1, no verdict) — the test earned its keep.
- **Pending:** none — fully agent-verifiable (read-only checks, no V3).
- **Next suggestion:** NEXT head is #76 `[blocked:hw]`; remaining PROPOSED
(Omarchy doc §F, auto time-of-day theme §D) await triage.
## 2026-07-10 — QA sweep (clean) + VISION-gap pass → 3 PROPOSED
- **Task:** Bernardo — QA/drift sweep, then a VISION-gap pass with proposals.
- **Did (sweep):** Fanned out two subagents (Bernardo OK'd spawning for

View File

@@ -25,6 +25,14 @@ iteration would otherwise rediscover.
- In VM tests `pgrep -f PATTERN` can match the test backdoor's own
`bash -c` wrapper (the pattern is in its cmdline) — use `pgrep -x`
or a `[t]uigreet`-style bracket pattern.
- **`writeShellScriptBin` scripts run `set -euo pipefail`** (nomarchy-doctor,
the menu, lifecycle CLIs). So a **no-match `grep` inside `$(…)`** (grep exits
1 → command-sub fails → abort) and a **standalone `cond && action`** (false
cond → abort) both kill the script mid-run — the tell is output that stops
before the final/verdict line with no error. Guard: `… | grep … || true`
inside `$()`, `cmd 2>/dev/null || echo 0` for captures, and `if` instead of
`&& action`. (#77 doctor hibernate section; caught by the checks.doctor VM
test on first run.)
- A checks.* fixture CANNOT be a writeText/toFile state file read at
eval time ("path … is not valid" — flake check's eval store won't
realise it): extract the logic into a pure importable file and