Repository navigation
Fail tests when the shell polls while idle or the fast paths get slow again - #15196
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… log Addresses Codex review: the theme hooks reached optional host apps such as asusctl and VSCodium, a subshell under an allowed command lost its allowance, and posix_spawn logged the parent instead of the child. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
…le test Addresses Codex review: both poll only for state with no change signal, and only while a session is active or the strength is missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…b pkill Addresses Greptile review: the test shell's clipboard startup pkill reached the session shell's watchers, a posix_spawn child could be logged after its own children, a subshell running only built-ins went uncounted, and a stuck menu guard could hang its budget test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Codex review: a fast theme could cover for a slow one, and a long idle window reached the screensaver and lock, which run on the desktop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Greptile review: the shell kept appending between the two passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Claude review: execl and friends, vfork and pidfd_spawn went unlogged. vfork becomes a fork, since a wrapper cannot return into a vfork child. system() and popen() remain a documented gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ectly Addresses Claude review: Raspberry Pis and ARM VMs start processes several times slower. The menu budget now needs XDG_RUNTIME_DIR, and the theme test checks the VS Code and Hunk waits structurally, which a scaled budget could hide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… while their reason holds Addresses Claude review: a spawn that coincides with a Hyprland, UPower or NetworkManager event gets a second window, and the events are printed. Each allowance is enabled by its condition and capped at its rate. The test shell gets power profile and login shell stubs, and cleanup no longer waits unbounded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stop monitors on exit Addresses Codex review: a session starting mid-window kept its probes disallowed on the retry, a long switch on a slow machine could let Hunk's timed nudge land before return, and an interrupted run left its event monitor pipelines running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er window Addresses Codex review: a seat with no readable keyboard is probed by design, and a monitor plugged in mid-run adds a widget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dbox Addresses Codex review: the waiting sleep stub outlived the test by up to ten seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Greptile review: the closing allowance checks ran inside the window, against limits sized for its nominal length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cli unlocalized, and reject failing guard batches Addresses Codex review: a power button counted as a second keyboard, a German session never matched wifi:connected, and a guard batch that failed fast was timed as a fast success though the menu throws its answers away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Codex review: glibc allows pidfd_spawn(NULL, ...), which the wrappers dereferenced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ards # Conflicts: # docs/testing.md
| start_event_monitors() { | ||
| local events="$1" socket="${XDG_RUNTIME_DIR:-/run/user/$UID}/hypr/${HYPRLAND_INSTANCE_SIGNATURE:-}/.socket2.sock" | ||
|
|
||
| MONITOR_PIDS=() |
There was a problem hiding this comment.
Keyboard reconnects falsely fail tests
start_event_monitors misses input-device events. InputDevices watches /dev/input and udev, then asks each keyboard widget to run hyprctl -j devices when a device changes. Those normal reads can fail this test without triggering its second window.
For example, unplugging and reconnecting the only keyboard leaves one readable keyboard at both allowance checks, so no keyboard allowance applies. Record input-device events too, and let them trigger the retry.
Omarchy found its shell polling on timers all over (omacom/omarchy#15196 and the series it closed); ours is GNOME, but nothing measured what the desktop does when nobody uses it. The report now leaves the session alone for 30 s after its checks and records every process's CPU share and scheduler runs - each timer an extension keeps is a wakeup - in idle.txt, with the shell's line in the report and, when something else is busiest, that process named with its threads, kernel stacks and open files. The shell at rest is under 1% of a core and 3 to 8 wakeups a second, three of them Vitals'. What the measurement found instead was gnome-software at a quarter of a core and over a thousand runs a second minutes after the first login, its files open in the Flatpak repos: Flathub's first catalogue refresh, which a fresh machine does once. Not a gate. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The recent performance PRs (#15026–#15049) only had a sentence in AGENTS.md keeping them from regressing. This adds tests that fail when they do. Where possible a test counts something that comes out the same on every machine (processes, tmux clients). Where it has to time something, it takes the fastest of several runs against a budget several times today's cost, or times two paths in the same run and compares them.
The guards
Idle shell spawns nothing (
test/shell.d/shell-idle-spawn-test.sh). Starts a second shell on the default config with its ownOMARCHY_PATHcopy, so it gets its own IPC socket and leaves the live one alone. Waits until IPC answers and the startup cover has finished, then waits for 4s with no spawns, then watches for 30s. It fails naming every command line the shell started in that window. Spawns are recorded from inside the shell's own process tree: a smallLD_PRELOADshim (fixtures/idle-shell/exec-log.c, built withccat test time) logs every exec, fork and posix_spawn the shell and its descendants make. So a probe that lives a millisecond is caught, and nothing outside the tree (the sampler included) can be mistaken for it. It skips without a compositor, like the other runtime tests, and also skips without a C compiler. Cleanup kills everything the test shell started, including children Quickshell leaves behind on exit (see below).The test shell is kept from acting on the session: it gets stubs for
pkill/killall,omarchy-powerprofiles-set/powerprofilesctl, and abashthat drops-l(a login shell would reset PATH and OMARCHY_PATH from/etc/omarchy.conf). Stay-awake is seeded so a long window cannot reach the screensaver or lock. Cleanup stops everything with a bounded TERM-then-KILL.During each window the test records Hyprland socket2,
upower --monitorandnmcli monitorevents. If spawns coincide with an event, it watches a second window and prints the events with any failure, so a reaction to a config reload, a charger or a screencast is told apart from a poll.Allowances are each enabled only while their condition holds (checked when the window opens and again when it closes), and capped at the rate their reason implies:
capture.shand whatever it runs: once per clipboard change, an event; unbounded.hyprctl -j devicesfrom the keyboard layout widget, only while the seat has more than one keyboard or none it can read, at most one per screen per 10s. Read the keyboard seat again when /dev/input changes instead of every 10 seconds #15203 replaces the multi-keyboard part with a/dev/inputand udev watch.probe.sh, only whilegliff-serverruns, at most one per 2s.nmcli ... device wifi list, only while Wi-Fi is connected, at most one per screen per 5s.Router alias dispatch (
test/cli). Copies the realbin/with a stub screenshot body and timesomarchy screenshotagainstomarchy screenshot --help(the full table load). It fails unless the dispatch costs under a quarter of the load. This adds to the existing unreadable-header check, and this one runs against the real command table.Menu guards (
test/shell.d/menu-guard-budget-test.sh). Builds the guard batch for the shipped menu withMenuModel.guardScriptand runs it on this machine's real hardware. Budgets: the batch within 200ms, each guard alone within 100ms, both scaled to the machine (below). On failure it lists the slowest guards. Skipped withoutXDG_RUNTIME_DIR, which holds the package snapshot every real menu has.Theme switch (
test/shell.d/theme-set-budget-test.sh). Runs the wholeomarchy-theme-set(not headless) in a scratch home, underenv -i, with a closedPATH: stubs,$ROOT/bin, and a symlink dir of plain tools. Optional host apps (asusctl, VSCodium, browsers) are therefore absent rather than retinted. The stubs get the costs the real apps have: a running Hunk, VS Code whose--list-extensionstakes an Electron boot, a Framework 16 keyboard, and three tmux sessions. Checks: each theme's switch within 500ms scaled to the machine (Tokyo Night and Catppuccin take different paths through the VS Code hook); at most 8 tmux clients; VS Code is never started to list extensions; and the switch returns before Hunk's settle nudge, which waits on a gate rather than the clock. The last three are structural, so a slow machine's larger budget cannot hide them.Scaling.
process_speed_percentinbase-test.shtimes 100 fork/execs oftrue, which take 25ms on the reference laptop, and the menu and theme budgets are multiplied by the ratio. A Raspberry Pi or ARM VM gets the room it needs. A machine more than 8x slower skips the timing (require_comparable_speed). The router check compares two paths in the same run, and the structural counts are unscaled.Docs: a "Performance guards" section in
docs/testing.md, a pointer from the Background Work rule in AGENTS.md, and a note thatbash -ldrops PATH stubs (more below).Measurements (this laptop; "old" is defbf90, just before #15039)
omarchy screenshotvs full loadomarchy-theme-set, stubbed appsMutation checks
Timer { interval: 5000 }starting aProcessadded toIndicators.qmlfails with6 /usr/bin/sudo -n truenamed.load_route_candidatesforced to return 1 (the old full-load path) fails the existing header test. With that test neutralised, the new timing check fails on its own: 181ms vs 181ms.menu-guards-parallel-test.sh,hw-hybrid-gpu-test.sh,network-wifi-connected-test.sh) remain what catches them.omarchy-theme-set-hunk(1054ms) oromarchy-theme-set-vscode(1064ms) from defbf90 fails the time budget. Restoringomarchy-theme-set-tmuxfails the client count (592), and the time too (537ms).Testing
./test/clipasses../test/all: the baseline failures, plusdefault-agent,toggle-input-device,runtime-smoke(bar put),screenshot-sanityandhyprland-startup-cursor-cold. These fail only in the run against the live desktop while other sessions were busy on it; the first two pass when rerun. This PR changes no code outsidetest/,docs/and AGENTS.md.XDG_RUNTIME_DIRgate; shim coverage (execl*,vforkas a logged fork,pidfd_spawn*, errno preserved;system()/popen()documented as a gap); thebash -lstub; bounded cleanup. The runtime-smoke cleanup is Stop the runtime smoke test's leftover shell children with a bounded wait #15202, and the keyboard poll is now event-driven in Read the keyboard seat again when /dev/input changes instead of every 10 seconds #15203.pkillreaching the live shell's watchers (the test shell now getspkill/killallstubs), ancestry order, fork-only children, a timeout for stuck menu guards, and one log snapshot for both passes.Found along the way
OMARCHY_PATH(asruntime-smoke-test.shdoes) leaves its plugin-directoryinotifywaitrunning after Quickshell is killed. Underflockthat orphan kept the desktop lock open indefinitely. The new test cleans up what its shell started.runtime-smoke-test.shstill leaks it.bash -lc, whichomarchy-theme-setuses for its app retints) rereads/etc/omarchy.confand puts that checkout'sbin/back ahead of any stub directory. Any test that stubs commands underomarchy-theme-setneeds abashstub, now documented in docs/testing.md.For a human to check
hyprctl -j devicespoll should become event-driven, which would remove that allowlist entry.🤖 Generated with Claude Code