Skip to content

Stub omarchy-osd in the system power test - #12575

Closed
davidboulay wants to merge 1 commit into
omacom:quattrofrom
davidboulay:test-stub-omarchy-osd
Closed

davidboulay wants to merge 1 commit into
omacom:quattrofrom
davidboulay:test-stub-omarchy-osd

Conversation

@davidboulay

Copy link
Copy Markdown

test/shell.d/system-power-test.sh runs bin/omarchy-system-reboot and bin/omarchy-system-shutdown for real. It stubs systemd-run, omarchy-state, omarchy-hyprland-window-close-all and sleep — but not omarchy-osd, so line 11 of each script runs unstubbed:

omarchy-osd -i shutdown -m "Shutting down" -d 5000

omarchy-osd is a thin wrapper around omarchy-shell -q osd show, which reaches the shell over IPC keyed on HYPRLAND_INSTANCE_SIGNATURE / XDG_RUNTIME_DIR. Neither the stub PATH nor a sandboxed HOME isolates that. Running the suite on a live session paints "Rebooting", then "Shutting down", centred at the bottom of the real screen for five seconds each — with nothing behind them, because systemd-run is mocked. It reads exactly like the machine is going down.

Found it the confusing way: an OSD appeared mid-session on an otherwise healthy machine. Uptime was unbroken, /run/systemd/shutdown/scheduled was empty, no transient run-r* timer existed and every window was still open — because the only real call in that script was the OSD.

Headless CI never noticed: with no compositor omarchy-osd just fails, and the script doesn't check its exit status.

This stubs it alongside the rest and asserts the call rather than letting it escape, so the OSD each script shows is now covered. toggle-input-device-test.sh, chromium-ytdlp-test.sh and brightness-display-apple-cache-test.sh already stub omarchy-osd, so this brings the last executor in line — I checked the other nine omarchy-osd callers under bin/ and no other test actually executes one.

Verified on a live Hyprland session: all four assertions pass, nothing is painted on screen.

ok - reboot runs after being scheduled outside the terminal scope
ok - shutdown runs after being scheduled outside the terminal scope
ok - reboot leaves state and windows alone when scheduling fails
ok - shutdown leaves state and windows alone when scheduling fails

🤖 Generated with Claude Code

The test runs bin/omarchy-system-reboot and bin/omarchy-system-shutdown
for real, stubbing systemd-run, omarchy-state,
omarchy-hyprland-window-close-all and sleep. omarchy-osd was left out, so
both scripts' `omarchy-osd -i ... -d 5000` calls ran unstubbed.

omarchy-osd is a wrapper around `omarchy-shell -q osd show`, which reaches
the shell over IPC keyed on HYPRLAND_INSTANCE_SIGNATURE and
XDG_RUNTIME_DIR. Neither the stub PATH nor a sandboxed HOME isolates that,
so running the suite on a live session painted "Rebooting" and then
"Shutting down" on the real screen for five seconds each — with no reboot
or shutdown behind them, since systemd-run was mocked.

Stub it alongside the rest and assert the call, so the OSD each script
shows is covered rather than merely escaping.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@llstrk

llstrk commented Sep 21, 2026

Copy link
Copy Markdown

Verified: the power test keeps OSD calls inside its mocks

Verified: 41e9e18f against e38c1d12; no issue found in the changed test.

                              Baseline       PR
Target assertions             4 pass         4 pass
Calls reaching shell IPC      2              0
Rendered test-run OSD          Visible        Absent

The baseline's passing test still sent Rebooting and Shutting down through the real OSD wrappers. An isolated graphical comparison displayed the shutdown card on baseline and no card on the PR. Scheduling remained mocked throughout; no machine reboot or shutdown occurred.

Verified: the new stub records the expected icon, message, duration and ordering. Diagnostic mutations removing the OSD, changing its message/icon, moving its position, or invoking it after failed scheduling are rejected by the patched assertions. The test also works without an installed OSD helper.


Review information

Test scope: isolated command/IPC boundaries and an owned graphical session, with destructive operations intercepted. Only test code changes; no production power behavior change is claimed.

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Automated AI review: Astra ran initial tests and mutation controls; independent Fable 5.1 and Astra reviewers added wrapper, failure-path and graphical validation. Both completed reports and material evidence were read before synthesis.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for tracking this down, @davidboulay. Your diagnosis is right: on current quattro (8b4eae66), test/shell.d/system-power-test.sh runs the real omarchy-osd from line 11 of both bin/omarchy-system-reboot and bin/omarchy-system-shutdown, so a run on a live desktop paints "Rebooting" and "Shutting down".

This duplicates #7216, which is older, targets quattro too, and makes the same change to the same file: it adds omarchy-osd to the stubbed commands and asserts -i reboot -m Rebooting -d 5000 and -i shutdown -m "Shutting down" -d 5000 in order, between the systemd-run call and omarchy-state. It also covers one case this PR misses. Its stub logs each argument tab-separated instead of joining $* with spaces, so it checks that "Shutting down" reaches omarchy-osd as a single -m argument. That PR, and issue #6999 that it closes, describe the same symptom you saw.

I compared the two diffs against quattro. A second opinion from Codex Medium, given only the two pull requests, agreed they are the same change; its independence from my reading is not guaranteed. I did not run this branch's tests on a worker, because #7216 has already been verified there.

I'm closing this in favour of #7216. If I've misread the two, reopen it.

@omarchybot omarchybot added the duplicate This issue or pull request already exists label Oct 1, 2026
@omarchybot omarchybot closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants