Skip to content

tools: phone-gesture-test, on-phone gesture tests of the quick-settings pages - #652

Open
den-kloot wants to merge 2 commits into
derekross:mainfrom
den-kloot:tools-phone-gesture-test
Open

den-kloot wants to merge 2 commits into
derekross:mainfrom
den-kloot:tools-phone-gesture-test

Conversation

@den-kloot

Copy link
Copy Markdown
Contributor

What and why

tools/phone-gesture-test runs swipe scenarios on the quick-settings pages (Wi-Fi, Bluetooth, the notification shade) on a real phone and checks each one through the shell's own state. It came out of #553: the hand checks there didn't show that over an app a swipe from the very bottom edge reached the home strip instead of the page; a scripted run did.

  • Same result on any device: pages open through the shell's IPC (openWifi, openBluetooth, summon), never by a tap on a tile; the package's default tile layout for the run; an empty workspace or one with a terminal; and only the gesture under test is a real touch, through a uinput touchscreen (tools/phone-gesture-touch) at points in logical pixels taken from hyprctl monitors and the page's own window (hyprctl layers).
  • Verdicts are computed, never judged: the shell's state after the gesture (shell call omamobile.quicksettings state) with Recents still shut (no scenario opens it, so Recents means the touch reached the home strip), and for a page that should stay open, arithmetic on the pixels: the list's row profile has to move up with the drag, since a touch that never arrived would also leave the page open. Where rows look alike (network names of one length) the list lines up at several shifts, a whole row apart, and then every one of them has to be a move. A screen that isn't the one a scenario needs is a SKIP, not a pass or a fail.
  • It puts everything back: fictional notifications within the history's room (the service deletes its oldest files beyond historyLimit), dismissed again the way a swipe does; do-not-disturb during the run; the bar's unread mark; the tile layout. It waits for the phone to cool below 75 °C, since a throttled phone delivered touches late in one of my runs.
  • tests/phone-gesture-test checks the arithmetic, the touch points and the preconditions in CI, without a phone. docs/GESTURE-TESTS.md describes the scenarios, the verdicts and the limits; AGENTS.md lists the tool, with "announce it" since it takes over the screen for a few minutes.

Device and build

  • Phone: Pixel 9a (tegu)
  • Kernel release (uname -r): 7.3.0-rc6-omamobile-push1-gcbb1a7eb0a78
  • Packages changed, with versions: none (tools, a test, docs)

Checks (no phone needed)

  • tools/pr-check origin/main passes
  • tests/all passes: on the phone, everything up to tests/kernel-pr-check passes; that test needs the kernel build environment and fails the same way here on main without this change, and tests/all stops there. The tests after it that this change touches pass on their own (tests/phone-smoke, tests/phone-gesture-test, tests/tools-help); CI runs the whole suite
  • tests/packages passes (or the packages I touched: none)
  • Each changed package has its version bumped, and the new version is in the commit subject (no package changed)
  • Commits have area prefixes and bodies that say why; any AI help is a Co-Authored-By: or Assisted-by: trailer, never a Signed-off-by:

On the phone

tools/phone-smoke report

phone-smoke: unknown

Kernel 7.3.0-rc6-omamobile-push1-gcbb1a7eb0a78, tools at unknown, 2026-11-11T02:30Z.

Check Result Detail
boot (required) ok kernel 7.3.0-rc6-omamobile-push1-gcbb1a7eb0a78, slot b, up 19014s
storage guard (required) ok 62 partitions; only userdata and slot B's boot images writable
root (required) ok ext4 on userdata, 83G free
kernel health (required) ok no oops or BUG; 0 WARN, 31 error lines in dmesg (0 known, 31 new)
new dmesg errors not ok cpif: rx_demux: PCIE: ERR! N is not opened x8; cpif: pass_skb_to_demux: PCIE: N<N: ERR! N>recv_skb fail (N) x8; cpif: io_dev_recv_skb_single_from_link_dev: N<-PCIE: ERR! rx_demux fail (err N) x8
systemd units not ok failed: omamobile-bt-addr@hci0.service
USB gadget (required) ok bound to 11210000.usb
display ok card1-DSI-1 connected, 1080x2424
GPU ok render node on panthor
session (required) ok Hyprland and the Omarchy shell running
lock ok PAM file present (the shell didn't answer lock status)
touch ok Synaptics TouchComm Touchscreen
buttons ok gpio-keys
Wi-Fi ok wlp1s0 on brcmfmac, link up
Bluetooth ok hci0, powered false
battery ok 88% Full, 37 °C
sound cards ok googleteguaocsn
sensors ok Accelerometer AmbientLight Proximity
cameras skip no libcamera tools
thermal ok hottest zone 56 °C

Packages: hyprland 0.57.0-3.1, libcamera 0.7.2-4.22, mesa 1:26.2.4-1.4, omacam 0.3.3-1, omamessages 0.2.2-1, omamobile-apps 0.2.2-1, omamobile-audio 0.5.15-1, omamobile-device-tegu 0.2.9-1, omamobile-firstboot 0.1.3-1, omamobile-gnss 0.2.7-1, omamobile-keyring 20261026-1, omamobile-mirror 0.1.1-1, omamobile-mmd 0.1.2-1, omamobile-modem 0.1.16-1, omamobile-modem-sit 0.3.31-1, omamobile-omarchy 0.1.32-1, omamobile-owl-widgets 0.1.2-1, omamobile-sensors 0.2.1-1, omamobile-shell 0.2.100-1, omamobile-voice 0.1.0-1, omaphone 0.2.3-1, omarchy 4.0.6-1, omatel-agent 0.2.4-2, quickshell 0.3.2.r7.g2b4501a-1

🤖 Generated with Claude Code

…gs pages

derekross#553's hand checks didn't see that over an app a swipe from the very
bottom edge reached the home strip instead of the page; a scripted run
did. This adds that run as a tool: a uinput touchscreen
(tools/phone-gesture-touch) swipes at points taken from hyprctl's output
and layer geometry, so it runs the same on any device, and the verdict
comes from the shell's own state over IPC, with Recents still shut, plus
arithmetic on the pixels where a page should stay open (the list's row
profile has to move up with the drag; where rows look alike and line up
at several shifts, every one of them must be a move), never from a model
or a video.

Each test sets up its screen itself: pages open over IPC, the package's
default tile layout, an empty workspace or one with a terminal, fictional
notifications within the history's room, do-not-disturb, a phone below
75 C; and everything is put back. Thirteen scenarios cover derekross#553's pages on
the home screen and over an app, including a swipe from inside the home
strip's 44 px zone. docs/GESTURE-TESTS.md describes it;
tests/phone-gesture-test checks its arithmetic and preconditions in CI,
without a phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross

Copy link
Copy Markdown
Owner

Thank you for this. Turning "the hand checks missed it" into a tool is the right response, and the design choices are the ones I'd want: pages opened over IPC so only the gesture is a touch, verdicts from the shell's own state with "recent apps stayed shut", a SKIP when the screen isn't the one a scenario needs, and pixel evidence where a pass could also mean that nothing happened. The care around the owner's phone shows too: the history headroom so a real notification is never pushed out, the unread mark, the tile layout moved aside and back. I checked that last one against Quickshell's FileView at the commit the phones run: it watches the directory as well as the file, so the shell does pick the owner's layout up again when you move it back.

I ran tests/phone-gesture-test and broke six of the tool's rules one at a time (the edge swipe's start point, the history headroom, the recent-apps check, the keyboard precondition, the look-alike-rows rule, the 20 px minimum). Each one failed the test, so it really does guard the arithmetic.

Two things to change before I merge:

  1. A dropped SSH session leaves the phone changed. The cleanup runs from finally, and you handle SIGTERM, but not SIGHUP, and a hang-up is what the tool gets when the USB link or the SSH session drops mid-run. Python then exits without finally: do-not-disturb stays on, the tile layout stays at .gesture-test-aside, the terminal stays open (it's in its own session) and the fictional notifications stay. The next run notices the tile file, but nothing notices do-not-disturb, and that's the one that costs the owner real notifications. Please handle SIGHUP the same way as SIGTERM, and at start detect a previous run's leftovers for do-not-disturb as well, for example a small state file that records the setting from before and that restore() removes.

  2. The sudo password.

    • ENV is a copy of the whole environment, so GESTURE_TEST_SUDO_PW is handed to every child, including the foot window, which keeps it for its lifetime. Please read it once and remove it from ENV.
    • With the variable set, the helper runs under sudo -S and you write the password to its stdin. sudo only reads stdin when it needs a password; if it already has a ticket from a moment ago, the password line goes on to phone-gesture-touch, which tries to parse it as a swipe and exits. I read this from the code and haven't run it, so tell me if I've got it wrong. sudo -S -v first and then sudo -n for the helper, as your interactive path does, would cover both cases.

Smaller things, as you see fit:

  • The lock is checked once at the start. A run takes minutes; a re-check in precondition() (and a SKIP while a call's surface is up) would keep a swipe off those screens.
  • Finger.close() ends with self.p.kill(), which a normal user can't do to a sudo child; the exception would come out of finally and results.json wouldn't be written.
  • A check at start for foot, grim, magick and notify-send, with one clear line when one is missing.
  • The test's python3 -I ignores PYTHONDONTWRITEBYTECODE, so it leaves tools/__pycache__/ behind; sys.dont_write_bytecode = True in the heredoc avoids that.
  • The AGENTS row says "(any device)". So far it has run on one 9a and a VM with the 9a's screen. I'll run it on my 7 Pro when I test omamobile-shell 0.2.119: a swipe up closes the shade card and the Wi-Fi and Bluetooth panels #553, and I'd rather the row said so once that's done.

I'll merge this after #553, since five of the scenarios are about what #553 adds.

…ithout the password on stdin

Review of derekross#652. A run whose SSH session or USB link dropped got SIGHUP
and exited without its cleanup: do-not-disturb stayed on, the tile layout
stayed aside, the terminal (in its own session) stayed open. SIGHUP now
ends a run through the same cleanup as SIGTERM and Ctrl-C, the cleanup
ignores a second signal and has a timeout on every command, and
results.json is written with "interrupted". Each change is recorded in
~/.local/state/phone-gesture-test/run.json before it is made and the file
goes once everything is back, so what a run that couldn't clean up left
(SIGKILL, a power cut) is put back at the next start or by --cleanup:
do-not-disturb, the tile layout, the terminal, the fictional
notifications, the unread mark (only ever moved back), an open page and
the workspace.

GESTURE_TEST_SUDO_PW is read once and removed from the environment, so
the terminal no longer keeps it. The helper is started with sudo -n after
sudo -S -v: with a ticket from a moment ago, sudo -S didn't read the
password and the helper took it for its first swipe.

Also: the lock and a call's screen are checked before every gesture;
Finger.close() never raises (a sudo child can't be signalled by the
user); missing commands are named with their packages at the start; the
CI test no longer leaves tools/__pycache__; the AGENTS row says where it
has run so far instead of "any device".

On a Pixel 9a (omamobile-shell 0.2.119 from derekross#553): a hang-up mid-run (the
pty's master closed, as sshd does) left nothing changed, where f75cba3
left do-not-disturb on, the tiles aside and the terminal open; a SIGKILL
mid-run was put back by --cleanup and by the next run; with a live sudo
ticket f75cba3's 01 ended in ERROR (the helper parsed the password) and
this one passed; the full suite 11/13 twice (03/04 SKIP: few networks in
range at night), as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@den-kloot

Copy link
Copy Markdown
Contributor Author

Thanks for running it and for breaking it on purpose; that's the check I couldn't do on my own tool. Both of your readings were right, and I reproduced each on the 9a before changing anything. All of it is in d56181e, on top of f75cba3.

1. A dropped session. I cut a run off mid-test by closing its pty's master, which is what sshd does when the connection drops, so the run gets SIGHUP the way it would over USB. With f75cba3, do-not-disturb stayed on, quicksettings.json stayed at .gesture-test-aside, the terminal stayed open and the Bluetooth page stayed up, as you said. Now:

  • SIGHUP ends a run through the same finally as SIGTERM and Ctrl-C. Once the cleanup starts it ignores further signals, and every command it runs has a timeout (sh()), so it can't hang either. results.json is still written, with "interrupted": "SIGHUP". A terminal that's gone (EIO/EPIPE) no longer stops the run's output.
  • Each change is recorded in ~/.local/state/phone-gesture-test/run.json before it's made: do-not-disturb as it was, the tile file moved aside, the terminal's pid, the workspaces, the unread mark. restore() removes the file only when every one of its steps worked, and each step runs even if the one before it failed. The next run reads the file first and puts back whatever is still changed; --cleanup does only that. Every step checks how things are now, so a change the run never made, or one already undone, is left alone. The unread mark only ever moves back, and a recorded pid only counts while its command line is still the suite's.

On the 9a, same run (07-10 over an app, cut off during 08):

do-not-disturb tile layout terminal page / workspace results.json
f75cba3, hang-up on aside open Bluetooth page up none
d56181e, hang-up off back closed closed, back on 1 interrupted: SIGHUP
d56181e, SIGKILL, then --cleanup off back closed closed, back on 1 (none: killed)
d56181e, SIGKILL, then the next run off, before its first test back closed closed, back on 1 the next run's

2. The sudo password.

  • GESTURE_TEST_SUDO_PW is popped from os.environ once, before ENV is copied from it. On the 9a, /proc/<foot>/environ had it with f75cba3 and doesn't now.
  • You read the ticket case right. In one pty, after a sudo -v, f75cba3 with the variable set gave 01 ERROR [Errno 32] Broken pipe: phone-gesture-touch died on json.loads of the password line. The helper now always runs under sudo -n, after sudo -S -p '' -v with the variable or sudo -v without it, so its stdin only ever carries swipes. In the same pty, d56181e passed 01. A password sudo refuses stops the run with one line.

The smaller ones:

  • The lock is checked in precondition(), before every gesture, and so is a call's screen (omamobile-call, omamobile-call-top): either one is a SKIP. I covered both in tests/phone-gesture-test but didn't bring them up on the phone: locking it would have needed the owner's PIN to get back in, and I had no call to take.
  • Finger.close() never raises: EOF, then terminate(), each with its own wait, PermissionError caught. A helper that can't be stopped is noted in results.json (cleanup.touch_helper_left_running); it exits at EOF anyway.
  • At start the run checks for grim and magick, plus foot, notify-send, wf-recorder or sudo when the chosen tests need them, and names the package of any that's missing (phone-gesture-test: missing foot (package foot), grim (package grim), magick (package imagemagick)). --cleanup needs only hyprctl, omarchy-shell and qs.
  • sys.dont_write_bytecode = True in the test's heredoc: no tools/__pycache__/ after tests/phone-gesture-test.
  • The AGENTS row and GESTURE-TESTS.md now say "so far run on a Pixel 9a and a VM with its screen". Please change that after your 7 Pro run, or tell me and I will.

tests/phone-gesture-test now has 62 checks. The new ones cover SIGHUP/SIGTERM raising into the cleanup, the sudo calls (-S -v with the password on its stdin, then -n; -v, then -n without one), the password gone from os.environ and ENV, close() with a helper that refuses signals, and put_back() against a recorded run (do-not-disturb, tiles, the fictional notifications against the owner's, the unread mark never moved forward, a tile file left alone when the owner has a new one, an open page, the workspace). tools/pr-check origin/main passes.

A regression run on the 9a, with #553's 0.2.119 installed as a fresh install (byte for byte 7ce4bbf's quick-settings QML): 11/13 twice, as before. 03/04 were SKIPs again because only a few networks were in range at night (the list ended 439-455 px above the page's bottom). 06 moved 129 px for a 300 px drag, with also_lines_up_at 62. The notification history was full, so the suite posted no fictional notifications (as designed), and 05/06 ran on the ones already in the shade. Cleanup errors: none; do-not-disturb off/on/off; every history file kept; no run.json left.

derekross added a commit that referenced this pull request Nov 12, 2026
… Omarchy 4.5's state (#694)

The quick-settings tile and the home screen's toggle read Do Not Disturb
with the notification service's dndState call. Omarchy 4.5 renamed it to
isDnd and answers "Function not found" to the old name, so on 4.5 both
kept whatever state they started with: turning Do Not Disturb on from
anywhere else never showed. Setting it from the tile still worked, since
setDnd kept its name.

Both now run one line that asks isDnd first and dndState second, so 4.0
phones are unchanged. test/dnd-state.sh takes that line from the QML and
runs it against a stand-in for each service.

On the Pixel 7 Pro (Omarchy 4.5.0-3): `notifications dndState` answers
"Function not found." and `isDnd` answers "off". The changed tile has
not been run on the phone.

Found by the round 53 review of #652.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
@derekross

Copy link
Copy Markdown
Owner

Thank you, this is a careful round. Both points are met, and I checked them rather than read them: SIGHUP and SIGTERM now end a run through the cleanup, every change is recorded in run.json before it's made (do-not-disturb included, which was the gap), and the next run or --cleanup puts back what a killed run left. The sudo password leaves the environment before any child gets one, and the helper only ever starts under sudo -n. I broke eight of the new rules one at a time (no SIGHUP handler, the password left in the environment, sudo -S without -v, no do-not-disturb put back, the unread mark moved forward, no call check, no lock re-check, an owner's new tile file overwritten) and the test failed each time. On a merge with today's main all 62 checks pass. The table of what a hang-up leaves, before and after, was exactly the evidence I'd have asked for.

Three things before I merge, and the first is main moving under you, not something you missed:

  1. Omarchy 4.5. Since 11-11 the phones are held at Omarchy 4.5.0-3 and main's shell is 0.2.126; your runs were on 4.0.6. Omarchy rewrote its notification service in between, and two parts of the tool still describe the old one:

    • dndState is gone. The 4.5 service has isDnd, toggleDnd and setDnd. qs ipc answers an unknown function with "Function not found." and exit 0, so quiet() raises "the notification service doesn't answer dndState" and every run without --loud stops there. put_back() asks the same question. isDnd gives the same "on"/"off".
    • The history is no longer a directory of files. 4.5 keeps live.json, history.json and quiet.json in ~/.local/state/omarchy/notifications/, with limits of 100 rows each in Store.js, and Service.qml has no historyLimit. So on 4.5 history_limit() falls back to 10, history_before is empty because the directory doesn't exist, the run always posts 8, and owner_history_kept comes out true without having compared anything. Could the count and the before/after compare go through what the shell itself reads (notificationRows reads both files on main), with "not checked" in results.json when there was nothing to compare? The paragraph in GESTURE-TESTS.md about historyLimit needs the same update.
    • The test's fake_notifications answers any method name, which is why CI couldn't see the rename. If it knew only the service's real methods, the next rename would fail the test.

    Then one run on a phone on Omarchy 4.5 with shell 0.2.126 or newer, please. (Our own quick settings called dndState in two places too, which your review of the service turned up for us; that is fixed on main as of today, omamobile-shell 0.2.127: the Do Not Disturb tile and home toggle read Omarchy 4.5's state #694.)

  2. tests/all conflicts with main, in the long for t in … line. Main now has a block at the end of the file, "One suite per line from here on", so that pull requests stop meeting in that line. Please rebase, leave the loop line as main has it, and add these as the last two lines:

    echo "# tests/phone-gesture-test"
    tests/phone-gesture-test
    

    That's the resolution I tested with. While the branch conflicts GitHub runs no CI on it, so the rebase also gets you a run.

  3. The lock check fails open. screen_locked() is true only for the answer "true". When omarchy-shell gives no answer (no OMARCHY_PATH in the environment, a shell that isn't responding), the empty string reads as "not locked" and the run goes on. Your smoke report shows that state on the 9a: "the shell didn't answer lock status". Since the point of the check is that a swipe never lands on the lock screen, please go on only for exactly "false", refuse at start otherwise, and make it a SKIP in precondition().

Smaller, as you see fit: a failed setup step (quiet(), tiles()) ends in a traceback with no results.json, where one line would do; the test leaves its two mkdtemp directories behind; pid 999999 can exist on a machine with a large pid_max (stub ours, or pick one above pid_max); and GESTURE-TESTS.md wants an SPDX line.

The order stays as before: this goes in after #553, and I'll run it on my 7 Pro then and change the "so far run on" line.

robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
… Omarchy 4.5's state (derekross#694)

The quick-settings tile and the home screen's toggle read Do Not Disturb
with the notification service's dndState call. Omarchy 4.5 renamed it to
isDnd and answers "Function not found" to the old name, so on 4.5 both
kept whatever state they started with: turning Do Not Disturb on from
anywhere else never showed. Setting it from the tile still worked, since
setDnd kept its name.

Both now run one line that asks isDnd first and dndState second, so 4.0
phones are unchanged. test/dnd-state.sh takes that line from the QML and
runs it against a stand-in for each service.

On the Pixel 7 Pro (Omarchy 4.5.0-3): `notifications dndState` answers
"Function not found." and `isDnd` answers "off". The changed tile has
not been run on the phone.

Found by the round 53 review of derekross#652.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants