test(hibernate): #76 slice 3 — V2 hibernate→resume VM check (PASS)
All checks were successful
Check / eval (push) Successful in 4m11s

Add checks.hibernate: a runNixOSTest modeled on nixpkgs' hibernate.nix,
wired to the actual risk #76 introduces — coexistence with the zram swap
that oom.nix now enables by default. It imports oom.nix, puts the disk
swap at a lower priority than zram with an explicit boot.resumeDevice,
and uses systemd-initrd. The test drives a full
hibernate -> power-off -> resume -> crash cycle: a volatile ramfs marker
survives resume but NOT a crash-boot (proving genuine resume), and it
asserts zram sits at priority 100 while the disk swap is lower, so the
hibernate image lands on disk rather than volatile zram.

What QEMU genuinely can't do — feed a boot-time resume_offset for a btrfs
swapfile (offset only exists after first-boot allocation) or drive a
LUKS-initrd unlock — stays a V3 laptop check (HARDWARE-QUEUE, dev box
already runs that exact layout), plus the no-swap notify in a real
session. With this, all V0/V1/V2 work on #76 is done; #76 collapses to a
[blocked:hw] stub and the design record moves to ROADMAP.

Verification: V2 PASS — nix build .#checks.x86_64-linux.hibernate built
the driver fresh and exited 0. nix flake check --no-build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-10 19:45:47 +01:00
parent 2d0cb48d5c
commit ba8963a385
5 changed files with 140 additions and 65 deletions

View File

@@ -290,6 +290,27 @@ that run; leftover open items still need a pass.*
screenshot loaded. Check that the UI draws on the current theme palette
(tools colored properly) and hitting save places the screenshot in
`~/Pictures/Screenshots/` while hitting copy places it in the clipboard.
- [ ] **#76 hibernate→resume on the real LUKS+@swap layout** — the V2 VM test
proves the resume mechanism + zram coexistence, but QEMU can't feed a
boot-time `resume_offset` for a btrfs *swapfile* nor drive the LUKS
initrd unlock, so this triple needs hardware (dev box already runs it:
LUKS mapper `cryptroot`, btrfs `@`, `/swap/swapfile`).
1. Confirm the layout: `swapon --show` lists `/swap/swapfile` (Type file)
**and** `/dev/zram0` at priority 100; `cat /proc/cmdline` shows
`resume_offset=…`; `nixos-option boot.resumeDevice` is the btrfs UUID.
2. Open apps, note an unsaved in-RAM state (e.g. a terminal `echo` scroll,
an editor buffer). Run `nomarchy-menu → Power → Hibernate` (or
`systemctl hibernate`). Machine writes the image and **powers off**.
3. Power on: you unlock LUKS **once** in the themed prompt and land back
in the **same session** — windows/state restored, not a fresh login.
4. **Pass** = session restored after a full power-off + single unlock.
Fail (fresh boot / stuck initrd) → NOW bug in BACKLOG (capture
`journalctl -b -1 | grep -i -E 'hibernat|resume|swap'`).
- [ ] **#76 no-swap Hibernate notify** — on a machine installed with `swap = 0`
(or temporarily `sudo swapoff -a`): `nomarchy-menu → Power → Hibernate`
must surface a desktop notification ("Couldn't hibernate — likely no
swap is configured. See docs/MIGRATION.md → Enabling hibernation."),
**not** a silent no-op. (`swapon` after, if you swapoff'd for the test.)
## AMD dev box only
- [ ] **AMD runtime bits** — VA-API (`vainfo` → radeonsi), amd-pstate EPP