Commits
Upstream replaced the batched sessions event with per-session
session_added events. Update the CoreState dispatch handler to match.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace Box<dyn CgroupManager> with Sessiond<C: CgroupManager + 'static>
to eliminate dynamic dispatch. Update all impl blocks in device.rs,
seat.rs, session.rs, and user.rs to carry the generic parameter.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bevy_ecs 0.19 and edition 2024 require rustc >=1.95 which is newer than
the cargo package in nixery's nixpkgs snapshot. Switch all workflows from
the nixpkgs cargo/rustfmt packages to rustup installing stable at runtime.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a CgroupManager trait so tests can run without root by passing
--no-cgroup to select DummyCgroupManager (all no-ops). SystemCgroupManager
now fails hard if /sys/fs/cgroup/sessiond cannot be created rather than
silently continuing. The poll_destroy closure accesses cgroup state through
take_cgroup/has_uid_sessions trait methods instead of struct fields directly.
Also allows root in addition to management_uid for reboot/poweroff/suspend/hibernate.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Soften /var/lib/sessiond create_dir_all to a warning so the daemon
starts as a non-root user (needed for integration tests in CI)
- Update get_session_returns_fields to use the caller's UID and assert
username is present rather than hardcoding "testuser" (username is
now resolved by the daemon from /etc/passwd, not passed in the protocol)
- Reformat test files to match cargo fmt expectations
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Generate badge.svg in CI and push it to the coverage-badge Garage
bucket via awscli2. README badge now points directly to the hosted SVG
instead of the old shields.io endpoint badge.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add coverage for set_session_state/set_state (active state transitions,
missing component, vt component path) and fill out iterator helper edge
cases. Also reverts nextest experiment back to cargo test and fixes the
coverage workflow to scope to master only, generate badge.svg inline,
and drop the broken publish-badge step.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace cargo test with cargo nextest in both workflows. Use the
CARGO_BIN_EXE_daemon compile-time env var to locate the daemon binary
in integration tests, removing the manual path-walking heuristic and
the separate pre-build steps.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mirrors the coverage workflow — cargo test may only produce the
instrumented test binary and not target/debug/daemon, which integration
tests need to spawn as a subprocess.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nixery containers have no /etc/passwd, so users::get_user_by_name("root")
returns None. resolve_user/resolve_group already handle numeric strings,
so pass the current uid/gid directly to avoid the name lookup.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cargo-llvm-cov cleans target/llvm-cov-target before each run, removing
any pre-built daemon binary. Build into the regular target/debug/ instead
(which llvm-cov never touches), and add a fallback in daemon_binary() to
look two levels up from the llvm-cov test binary location.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cargo llvm-cov passes --tests to cargo test, which only builds the
instrumented test binary (deps/daemon-*), not the regular binary at
debug/daemon. Integration tests spawn the daemon as a subprocess and
look for it at debug/daemon, so we must build it there explicitly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Running workspace-wide caused the pam crate to be compiled with a
linker step, failing with cannot find -lpam in the nixery environment.
Scoping to --package daemon also makes cargo llvm-cov build the daemon
binary in its own target dir, removing the need for a separate build step.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces thread-based daemon spawning with subprocess spawning so the
test client and daemon have distinct PIDs. This prevents issues where
the daemon would record the test process PID as the session leader and
potentially send signals to itself.
Adds --management-user CLI arg (default: root) to control which UID
may create/destroy sessions, replacing the #[cfg(not(test))] bypass.
Integration tests pass their own UID via --management-user so the
subprocess daemon authorises them correctly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Keeping the client socket open while calling daemon.stop() prevented the
calloop event loop from responding to the loop signal. Wrapping each
connect_core block in a scope ensures the connection is dropped before
join() is called.
Also removes leftover [DBG]/[TST] eprintln! debug statements from the
session object and event handlers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a CgroupManager trait so tests can run without root by passing
--no-cgroup to select DummyCgroupManager (all no-ops). SystemCgroupManager
now fails hard if /sys/fs/cgroup/sessiond cannot be created rather than
silently continuing. The poll_destroy closure accesses cgroup state through
take_cgroup/has_uid_sessions trait methods instead of struct fields directly.
Also allows root in addition to management_uid for reboot/poweroff/suspend/hibernate.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Soften /var/lib/sessiond create_dir_all to a warning so the daemon
starts as a non-root user (needed for integration tests in CI)
- Update get_session_returns_fields to use the caller's UID and assert
username is present rather than hardcoding "testuser" (username is
now resolved by the daemon from /etc/passwd, not passed in the protocol)
- Reformat test files to match cargo fmt expectations
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add coverage for set_session_state/set_state (active state transitions,
missing component, vt component path) and fill out iterator helper edge
cases. Also reverts nextest experiment back to cargo test and fixes the
coverage workflow to scope to master only, generate badge.svg inline,
and drop the broken publish-badge step.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cargo-llvm-cov cleans target/llvm-cov-target before each run, removing
any pre-built daemon binary. Build into the regular target/debug/ instead
(which llvm-cov never touches), and add a fallback in daemon_binary() to
look two levels up from the llvm-cov test binary location.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cargo llvm-cov passes --tests to cargo test, which only builds the
instrumented test binary (deps/daemon-*), not the regular binary at
debug/daemon. Integration tests spawn the daemon as a subprocess and
look for it at debug/daemon, so we must build it there explicitly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Running workspace-wide caused the pam crate to be compiled with a
linker step, failing with cannot find -lpam in the nixery environment.
Scoping to --package daemon also makes cargo llvm-cov build the daemon
binary in its own target dir, removing the need for a separate build step.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces thread-based daemon spawning with subprocess spawning so the
test client and daemon have distinct PIDs. This prevents issues where
the daemon would record the test process PID as the session leader and
potentially send signals to itself.
Adds --management-user CLI arg (default: root) to control which UID
may create/destroy sessions, replacing the #[cfg(not(test))] bypass.
Integration tests pass their own UID via --management-user so the
subprocess daemon authorises them correctly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Keeping the client socket open while calling daemon.stop() prevented the
calloop event loop from responding to the loop signal. Wrapping each
connect_core block in a scope ensures the connection is dropped before
join() is called.
Also removes leftover [DBG]/[TST] eprintln! debug statements from the
session object and event handlers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>