From 3536abc6567ee164b3d1e1d17ace20bec22406e1 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Mon, 20 Jul 2026 19:40:28 +0100 Subject: [PATCH] test(display): de-flake the dock harness re-dock assertion (#154) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tools/monitor-fallback.nix flaked at the #148 reload-mid-dock step: after a lid-closed `hyprctl reload` re-lights the disabled Virtual-1 panel, the watcher's enforce_dock_intent re-disables it — but only on the loop's 1s idle tick, because re-enabling an existing connector emits no `monitoradded` and the chatty IPC events `continue` past reconcile. Under this softGL VM's load (swaync crash-loops against the absent Vulkan device) that idle tick is starved, so the re-dock lands ~15-20s out — right on the old timeout=15. An instrumented run confirmed the mechanism is correct: dockMode=true is read, `action=re-dock` fires, the panel is re-disabled (it just missed the bound). Fix is the bound, not the watcher: 15s → 45s, in line with the test's own 20-30s waits. Harness now green end-to-end (~61s). Not a product bug and independent of the #150 extraction (the built transition/keyboard tools have byte-identical store paths across it). Co-Authored-By: Claude Opus 4.8 --- agent/BACKLOG.md | 21 --------------------- docs/ROADMAP.md | 24 +++++++++++++++++++----- tools/monitor-fallback.nix | 9 ++++++++- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/agent/BACKLOG.md b/agent/BACKLOG.md index cdbc2a2..9659b3d 100644 --- a/agent/BACKLOG.md +++ b/agent/BACKLOG.md @@ -175,27 +175,6 @@ If that count is zero over a few weeks post-linger, **close this unbuilt**. If i is not, the upstream issue has sat ten months on vaxerski's "that will cause a segfault no?" and a reproducer would be worth more than a local guard. -### 154. `[watch]` `tools/monitor-fallback.nix` is red on `main` at the #148 reload-mid-dock assertion - -Found while verifying #150 (2026-07-20): the dock/undock VM harness fails at -the `enforce_dock_intent` step — after a lid-closed `hyprctl reload` it waits -15s (generated `:75`) for the watcher to re-disable `Virtual-1` and -times out; the panel is never re-disabled and `action=re-dock` is never -logged. **Confirmed pre-existing:** a clean-HEAD worktree run -(fdf9790, before any #150 change) fails at the *identical* assertion, and the -#150 refactor is proven inert here (the built `nomarchy-display-transition` / -`nomarchy-keyboard-layout` have byte-identical store paths on HEAD vs the -#150 branch). The `dock` transition itself succeeds (`result=ok`, both -workspaces move, internal disabled) — only the post-reload re-dock invariant -fails. Likely a harness/environment issue (the `enforce_dock_intent` tick -depends on the watcher reading `settings.display.dockMode` from the in-flake -state, which may not be writable in this NixOS-test sandbox) rather than a -product regression — but it means the maintainer V2 dock harness is not a -usable gate until re-greened. Do first: reproduce, then check whether -`set_dock_intent` actually persists `dockMode=true` inside the VM (grep the -run journal for `dock-intent=…state-write-failed`); if the state write is the -gap, the fix is in the harness, not the watcher. - ### 149. `[watch]` Waybar's exec-once workaround may be defending against nothing post-linger Spun out of #147 (shipped 2026-07-17) so its loose thread survives the entry: diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 63c2f61..54ef198 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -541,11 +541,25 @@ Design/decision records and a running log of shipped work (items marked `nomarchy-display-transition` / `nomarchy-keyboard-layout` on HEAD vs the refactor. Gates: parse + home/toplevel builds + `checks.docking-ux` (structural, `bash -n` + safety-feature greps) all green. The - `tools/monitor-fallback.nix` dock VM harness is **red on `main` already** - (the #148 reload-mid-dock assertion — identical failure on clean HEAD; - BACKLOG #154), so it could not gate this; the dock transition inside it - still ran `result=ok`. The idle wake-path behaviour change (full undock, - incl. dock-intent clearing + `restore_keyboards`) is V3 — HARDWARE-QUEUE. + `tools/monitor-fallback.nix` dock VM harness was **red on `main` at the + time** — a flaky 15s bound on the #148 re-dock (identical failure on clean + HEAD), diagnosed and fixed the same day (see below), so it did not gate this + landing; the dock transition inside it always ran `result=ok`. The idle + wake-path behaviour change (full undock, incl. dock-intent clearing + + `restore_keyboards`) is V3 — HARDWARE-QUEUE. +- ✓ **Dock harness de-flaked (#154, 2026-07-20):** `tools/monitor-fallback.nix` + flaked at the #148 reload-mid-dock assertion — after a lid-closed + `hyprctl reload` re-lights the disabled `Virtual-1` panel, the watcher's + `enforce_dock_intent` re-disables it, but only on the loop's 1s **idle + tick** (a reload re-enables an existing connector, emitting no + `monitoradded`, and chatty IPC events `continue` past `reconcile`). Under + the softGL VM's load — swaync crash-loops against the absent Vulkan device — + that idle tick is starved and the (correct, prompt-on-hardware) re-dock + lands ~15-20s out, right on the old `timeout=15`. Instrumented run proved + the mechanism fires with `dock-intent=true` and re-disables the panel; fix + is the bound (15→45s, matching the test's other 20-30s waits), not the + watcher. Harness now green end-to-end (61s). Not a product bug and unrelated + to #150 (byte-identical tool store paths). - ✓ **The idle brick's CAUSE found (#127 closed, 2026-07-17):** the incident was misdated — it did not happen "before 12:51:34 Jul 15" (that boot was healthy all day and ended in a routine clean reboot); it ended the diff --git a/tools/monitor-fallback.nix b/tools/monitor-fallback.nix index 99c7e90..7b017f5 100644 --- a/tools/monitor-fallback.nix +++ b/tools/monitor-fallback.nix @@ -140,8 +140,15 @@ pkgs.testers.runNixOSTest { # re-dock action. machine.succeed("printf 'state: closed\\n' > /run/nomarchy-test-lid-state") machine.succeed(hy + "reload'") + # A reload re-lights the *already-present* (disabled) Virtual-1 connector, + # which emits no `monitoradded` — so the watcher only re-disables it on its + # 1s idle tick (chatty IPC events `continue` past reconcile). Under this + # softGL VM's load (swaync crash-loops on the absent Vulkan device, see the + # journal) that idle tick is badly starved and the re-dock lands ~15-20s + # out — a real, prompt re-dock on hardware, but right on the old 15s bound, + # so this flaked. Bounded generously, in line with the 20-30s waits above. machine.wait_until_succeeds( - hy + "-j monitors' | jq -e 'all(.[]; .name != \"Virtual-1\")'", timeout=15 + hy + "-j monitors' | jq -e 'all(.[]; .name != \"Virtual-1\")'", timeout=45 ) machine.succeed("journalctl -t nomarchy-display-watch | grep -q 'action=re-dock'") print("reload-mid-dock: panel re-disabled by enforce_dock_intent; re-dock logged (#148)")