evidence · 3.6 KiB

settings-backend.md

Committed at docs/evidence/coherent-shell/settings-backend.md. This is what grounds the requirements that cite it.

Open raw source

Settings capability and action interface

This is a host-tested userspace checkpoint for the coherent shell, not a rendered Settings surface or physical acceptance. The launcher consumes the JSON interface asynchronously so capability reads and power commands cannot block touch dispatch. No coherent-shell task is completed by this file alone.

Protocol

k230-settings status returns schema: 1 and a controls object containing network, brightness, keyboard and motion. Each control has state, value and label; optional fields include action, unit and detail. States distinguish unavailable, read-only, writable and action.

request reboot|poweroff returns a confirmation label and opaque token, valid for 30 seconds. The UI must show this separate confirmation and Cancel. cancel TOKEN performs no power action. confirm TOKEN consumes the token before attempting the exact noninteractive sudo/systemctl command. Replacement, replay and expiration fail. Denial returns failed and a retry route, which must start a new confirmation. Success means requested, not observed restart.

Only the two existing image sudo rules authorize power actions. The default runtime path is /run/shell/settings, a mode-0700 directory owned by the session user. Pending confirmation is transient and requires no home state. External commands have a three-second timeout and discard their output.

Host evidence

On 2026-09-24, python3 tests/test_device_settings.py passed nine tests: actual sysfs capability parsing, absent/read-only/ambiguous controls, pending brightness, no battery/network identifiers, fresh home, cancellation, denial/replay, expiration/replacement, runtime ownership, and command timeout. Sysfs fixtures and injected command results do not prove device behavior. The tests explicitly reject the planned scroll and flick-stop cases until those UI behaviors have their own actual input tests.

nix build .#handheld-settings --no-link --print-out-paths --max-jobs 1 --cores 8 also passed, producing /nix/store/yabiwy3maplzxbbhbnk97206jcaxl978-k230-settings. This wraps the helper with the cross-package Python, procps and systemd paths; it is package proof, not a running Settings surface.

The explicit operation allowlist correction was rebuilt after review, producing /nix/store/46sw7cwipb8g0pfjqa7vry4x1x65345g-k230-settings. The same nine host tests pass, including an unexpected operation with an otherwise valid token; it neither executes an action nor consumes the pending confirmation.

Remaining: launcher integration and asynchronous action feedback, real Settings scroll/gesture checks, installed image and board observations.