Everything below the CLI was merged and green against fakes; none of it was
reachable and none of it had ever met a compositor. This wires it up and then
puts the compositor in a position to disagree.
CLI (src/hhstream/cli.py, src/hhstream_session/**)
session container [ID], session reconcile [ID], and the seven pointer verbs
from PLAN §9. `start` still prints the bare session id and nothing else.
`list` gains WS / OUTPUT / POINTER, with the gap marker where a value is
genuinely unknown rather than a blank that reads as zero -- the POINTER
column needs a second, read-only `pointer.state` call because the `list`
reply carries no lease state.
The lease id is cached in `hhstream_session.lease` (under
$XDG_RUNTIME_DIR), because PLAN §9's gesture verbs take no --lease and the
wire requires a lease_id on every one of them; --lease and $HHSTREAM_LEASE
override it, and a `no_lease` refusal drops the stale entry.
Exit codes are the contract's: a gesture with no lease is 9 and never
reaches the broker, and a compositor failure is 10 with a message that says
the session is still running. `kill` now warns about
`session.container_survivors` -- windows the compositor still shows -- and
distinguishes `null` ("could not ask") from `[]`.
`shot`/`record --output NAME` capture one container through `grim -o`; the
frame socket publishes the main output only, so it cannot do it.
Module (nix/module.nix)
sessions.containers.{enable,max,mode,workspaceBase},
sessions.pointer.{enable,leaseTtl,leaseMax}, rendered into the generated
TOML with §10's key names. hhstream-pointer.service: the operator's account,
supplementary group hhstream, After=/BindsTo= the compositor,
Restart=on-failure, KillMode=process, and the command line §3.4 freezes.
tmpfiles for /run/hhstream plus RuntimeDirectoryPreserve on the broker,
without which restarting the broker deletes the driver's socket out from
under it. The runtime-directory length assertion is untouched.
And ExecStartPost on the compositor, opening its IPC directory to its own
group: Hyprland creates <runtime>/hypr with S_IRWXU, so the broker -- a
different account by design -- could not reach the request or event socket
at all, and degraded silently exactly as it is built to.
Checks (checks/**)
vm-ipc: both sockets at their frozen names, measured against sun_path's 108
bytes, and a socket2 subscriber that receives an openwindow for a window the
test creates. The subscriber is the shipped HyprlandIPC, not a second
implementation: this check exists to prove that this client hears this
compositor.
vm-containers: one hh-* output per session at the container mode, the window
on it, a second window of the same application beside it, an unmatched
window quarantined, grim -o isolating one container, teardown removing the
output and freeing the slot. PLAN experiment 3 is answered: `hyprctl output
create headless` works.
vm-pointer: a version-2 virtual pointer, a warp and a click whose
coordinates the *application* reports, BUSY naming the holder, an expired
lease swept with its held button lifted, and a broker restart that leaves
the lock free, the bookmark intact and the driver reachable.
checks/lib gains the guest the three share, their test-script helpers (no
assertions live there), an event-socket subscriber and a Wayland client that
says where it was clicked -- nothing in nixpkgs both honours
$HHSTREAM_APP_ID and reports pointer events.
Reported, not worked around: the broker reads none of the container or
pointer config (policy.py takes [defaults] and [apps] only), `start` has no
no_container field so --no-container is refused rather than silently ignored,
and nix/hyprland-conf.nix sets input:follow_mouse = 0, which sends pointer
events to the focused window only -- measured, with the cursor at the aimed
pixel and no client told. README.dev.md has the evidence for each.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WQy29x9AfHWyzNd1f7XPGK
56 lines
2.3 KiB
Nix
56 lines
2.3 KiB
Nix
# The guest programs the session checks need, packaged with the interpreters
|
|
# they actually require.
|
|
#
|
|
# Separate from `test-tools.nix` because these two need things that one does
|
|
# not: `hhs-ipc-watch` imports the shipped `hhstreamd.ipc` (so it needs the
|
|
# package on PYTHONPATH -- it is the client under test, not a reimplementation
|
|
# of it), and `hhs-pointer-target` is a Wayland client (so it needs pywayland).
|
|
#
|
|
# Both are self-tested at build time, for the same reason test-tools.nix does
|
|
# it: a broken helper otherwise surfaces as a baffling VM failure three layers
|
|
# away, long after the thing that would have explained it scrolled past.
|
|
{
|
|
runCommandLocal,
|
|
python3,
|
|
hhstream,
|
|
}:
|
|
let
|
|
# pywayland for the Wayland client; nothing else, so an import error in the
|
|
# guest is a real missing dependency and not this file being generous.
|
|
waylandPython = python3.withPackages (ps: [ ps.pywayland ]);
|
|
in
|
|
runCommandLocal "hhstream-session-tools"
|
|
{
|
|
nativeBuildInputs = [ python3 ];
|
|
meta.description = "Event-socket witness and pointer target for the hhstream session checks";
|
|
} ''
|
|
mkdir -p $out/bin
|
|
|
|
# The event-socket subscriber runs the broker's own IPC client, so it is
|
|
# pointed at what nix/package.nix installed rather than at a copy.
|
|
cat > $out/bin/hhs-ipc-watch <<EOF
|
|
#!${python3}/bin/python3
|
|
import sys
|
|
sys.path.insert(0, "${hhstream}/${python3.sitePackages}")
|
|
sys.argv[0] = "hhs-ipc-watch"
|
|
exec(compile(open("${./ipc_watch.py}").read(), "${./ipc_watch.py}", "exec"))
|
|
EOF
|
|
|
|
install -Dm755 ${./pointer_target.py} $out/bin/hhs-pointer-target
|
|
chmod +x $out/bin/hhs-ipc-watch
|
|
sed -i '1s|.*|#!${waylandPython}/bin/python3|' $out/bin/hhs-pointer-target
|
|
|
|
# Proof that both start, that `hhstreamd.ipc` is importable through the path
|
|
# above, and that pywayland's xdg_shell bindings are present -- the three
|
|
# ways these could be broken without the guest ever saying so.
|
|
$out/bin/hhs-ipc-watch --help > /dev/null
|
|
$out/bin/hhs-pointer-target --help > /dev/null
|
|
${waylandPython}/bin/python3 -c 'from pywayland.protocol.xdg_shell import XdgWmBase'
|
|
# The target refuses to guess an app id, and the checks depend on that
|
|
# refusal being exit 2 rather than a window with somebody else's class.
|
|
if $out/bin/hhs-pointer-target; then
|
|
echo "hhs-pointer-target started with no app id; it must refuse" >&2
|
|
exit 1
|
|
fi
|
|
''
|