Compare commits

..

2 commits

Author SHA1 Message Date
1106bcaa0a docs(verification): record the graphical journey results and host-time blocker
Some checks are pending
ci / test (push) Waiting to run
Update the changelog, status, handoff, verification register and VM boot
record with the 2026-09-22 graphical journey work: the fixed step sequence,
the interaction-defect fixes (readiness refresh, catalog sync/staleness, AI
revalidation, keyboard suggestion navigation, truthful keyboard-step label,
link vs service readiness, busy/failure handling), the new gui-install
harness mode, and the final-ISO results.

The gui (28/28) and opencode (18/18) journeys pass; gui-install passes every
journey assertion and starts a real install, but the four-hour harness timeout
fired during the kernel build (base packages ~116 min), so two completed
fresh-disk graphical installs + detached boot remain BLOCKED on host build
time, not on a code defect.
2026-09-22 12:30:55 -07:00
34c12d3dd8 feat(installer): rebuild the graphical journey and fix interaction defects
Rework the graphical installer into a fixed first-time-user sequence
(Welcome, Language and keyboard, Internet and readiness, AI connection,
Destination disk, Account and encryption, Review and confirmation,
Installation, Completion) with configuration, validation, plans, approval
and execution still authoritative in Rust.

Fix the audited interaction defects: readiness `Re-check` is a read-only
probe that no longer resets the step or clears the disk; model catalogs are
fetched after syncing the edited settings and credentials and stale replies
are ignored; editing a connection field invalidates the validated state;
suggestion lists support arrow/Enter/Escape with a visible highlight and
accessibility; the keyboard step labels the live-session limitation
truthfully; readiness separates the local link from reachable install
services; and busy states always clear, with the bridge failing outstanding
requests when the backend exits.

Add human-readable language/keyboard names, an explicit AI change review
(Accept/Discard), backend-fact review with edit links, real stage progress
with elapsed time and activity, and clearer failure and completion guidance.

Extend the VM harness with a `gui-install` mode that drives the whole
journey through the visible controls, plus regressions for readiness
refresh, disk survival, keyboard suggestion selection and AI invalidation.
Add Rust tests for readiness, the network probe, error kinds and labels.
2026-09-22 08:17:03 -07:00
15 changed files with 2212 additions and 406 deletions

View file

@ -5,6 +5,88 @@ this file is the curated, human-readable summary.
Format: Keep a Changelog. Dates are UTC. Format: Keep a Changelog. Dates are UTC.
## 2026-09-22 — Event-driven analysis of a first-time user's journey
The graphical installer was audited against a first-time user's journey and
rebuilt around a fixed, explained sequence: Welcome, Language and keyboard,
Internet and readiness, AI connection, Destination disk, Account and
encryption, Review and confirmation, Installation, Completion. Configuration,
validation, plans, approval and execution stay authoritative in Rust.
### Fixed
- **Network "Re-check" no longer resets the wizard.** The readiness refresh is
a separate, read-only bridge op (`readiness`) that updates the probe result
only; it cannot change the step or clear the selected disk. The first
handshake is the only path that initialises the form.
- **AI catalogs are fetched for the connection on screen.** "Load model
list" now pushes the edited configuration and credentials before requesting
the catalog, classifies authentication/unreachable/model failures with a
stable `error_kind`, and ignores a stale reply that a newer request
superseded.
- **The AI connection indicator is invalidated when it should be.** Editing the
provider, model, endpoint, server or a credential clears the green
"Validated" state and requires revalidation; irrelevant account or disk edits
preserve it. A regression assert in the VM harness edits the model and checks
the state flips.
- **Suggestion lists are keyboard-operable.** Arrow keys move a visible
highlight, Enter selects it, Escape dismisses the list, and the highlight is
exposed through `Accessible` roles. Enter in an open list is consumed so it
cannot also advance the wizard.
- **Busy work always completes.** The bridge now fails every outstanding
request when the backend exits, so no spinner can hang; AI connect/test and
catalog loads are single-flight; every failure path clears its busy state and
shows an actionable retry.
- **Keyboard focus is scrolled into view**, so a keyboard user never tabs to an
off-screen control, and the `PhoebusToggle` Return handler is fixed (it
previously called a signal handler as a function).
### Changed
- **Human-readable language, keyboard and time-zone names** (e.g. "English
(United States) — en_US.UTF-8", "German — de") are returned by the backend;
the stable identifier is still what is validated and written.
- **The keyboard step tells the truth about the live session.** The live
session keeps its own layout; the selected layout is applied to the installed
system, and the typing test is labelled as testing the live keyboard. A live
Wayland layout switch is not implemented.
- **Internet readiness distinguishes a local link from reachable installation
services** and re-checks on demand without disturbing the form.
- **AI setup explains why a model is required and what is shared** (hardware and
storage facts; never passwords, passphrases, keys, names or files), shows the
proposed changes, and requires an explicit Accept or Discard before the step
can advance.
- **Disk selection prominently shows model, capacity and device identity**, and
states exactly which disk will be erased; protected disks explain why they
cannot be selected. The ERASE confirmation and approval binding are unchanged.
- **The account step explains login password versus encryption passphrase**, and
password reveal controls are keyboard-focusable. Technical settings moved
behind Advanced.
- **Progress shows real stages, elapsed time and activity**, with a redacted
Details log; the failure screen explains whether disk changes occurred and
what is safe to do next; completion explains restart, media removal, unlock
and first login.
- **The graphical harness gained a `gui-install` mode** that presses the real
controls through the whole journey (AI connect, disk, account, ERASE,
install) on a disposable disk, plus regression checks for readiness refresh,
disk survival and AI invalidation. `PHOEBUS_GUI_CONFIG`/`/etc/phoebus/install.conf`
let a live medium preseed wizard defaults without weakening any check.
### Verified
- `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets`
clean (pre-existing `result_large_err` advisories unchanged); the Rust
workspace tests are green and `make test` (Rust + 16 harness tests) passes.
- Disposable graphical VM: `gui` 28/28 PASS (welcome, launcher, duplicate
prevention, keyboard suggestion selection, network, AI gate blocked and
reported, no bridge errors) and `opencode` 18/18 PASS (real model response,
validated proposal, model edit invalidates the connection).
- `gui-install` passed every journey assertion on a fresh 30 GiB qcow2,
including `gui-install-erase-confirmed`; the backend then reported real
progress (disk prepare, stage3 download, fstab, Portage sync, base packages,
kernel) with elapsed time and categories, and no fabricated percentage. The
completed install itself timed out in the harness after four hours during a
>100-minute kernel compile (see `docs/VM-BOOT-VERIFICATION.md`); the
completed install + detached boot gate remains **BLOCKED on host build time**,
not on any code defect.
## 2026-09-22 — `sys` administration hardening ## 2026-09-22 — `sys` administration hardening
Correctness work on the deterministic `sys` broker and the assistant path that Correctness work on the deterministic `sys` broker and the assistant path that

View file

@ -3,78 +3,84 @@
Rolling note between work sessions. **Update this file before you finish**, then Rolling note between work sessions. **Update this file before you finish**, then
commit it. It should be short and current; use `git log` for detail. commit it. It should be short and current; use `git log` for detail.
- **Last updated:** this session (2026-09-22), `sys` administration hardening. - **Last updated:** this session (2026-09-22), graphical installer journey
- **Current focus:** Hardened `sys` into a reliable administration tool. polish and reliability.
(1) All package/service/Flatpak execution now honours `--root` through one - **Current focus:** Reworked the graphical installer into a fixed,
`target_spec`/chroot path (offline `systemctl --root` for enable/disable), first-time-user journey — Welcome, Language and keyboard, Internet and
and runtime-only service operations are rejected before any command when an readiness, AI connection, Destination disk, Account and encryption, Review
alternate root is requested. (2) Every action is validated at the execution and confirmation, Installation, Completion — while keeping configuration,
boundary (`parse_natural` now validates its own output); option-like operands validation, plans, approval and execution authoritative in Rust. Fixed the
are rejected and operands are passed after `--`. (3) `sys ask` stops at the interaction defects called out in the audit: the readiness refresh no longer
first failure, records completed/failed/unattempted actions, and exits resets the wizard; model catalogs are fetched after syncing the edited
nonzero. (4) Ordinary mutating commands are recorded, the generic protective settings/credentials and stale replies are ignored; editing a connection
snapshot id is preserved, and recording failures are visible. (5) A genuinely field invalidates the validated state; suggestion lists have full keyboard
empty package plan is distinguished from unparseable emerge output, which is navigation; the keyboard step is labelled truthfully (the live session keeps
refused. (6) Added typed `start/stop/restart_service` and ordinary commands its layout); readiness separates a local link from reachable install services;
for Flatpak, Nix preparation and snapshots. and every busy state now clears on failure with an actionable retry (the
bridge fails outstanding requests when the backend exits). AI changes require
an explicit Accept or Discard; the review screen is built from backend facts
with edit links; progress reports real stages, elapsed time and activity.
- **Last verified (this session):** - **Last verified (this session):**
- 368 Rust tests green (including 3 new CLI integration tests) + 16 harness - `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets`
tests; `cargo fmt --all -- --check` and `cargo clippy --workspace clean (only the pre-existing `result_large_err` advisory); the Rust
--all-targets` clean (exit 0). Static `phoebus-installer`/`sys` build. workspace tests pass and `make test` (Rust + 16 harness tests) is green.
- Unit/integration evidence for all six fixes: preview and execution both - Disposable graphical VM, rebuilt ISO
chroot to the same alternate root; runtime service ops reject an alternate (`sha256 125d002b…`, 1.6 GiB): `gui` **28/28** PASS and `opencode` **18/18**
root without invoking anything; invalid actions are refused by the manual, PASS, including the keyboard-suggestion regression, the blocked AI gate,
JSON and AI parsers and at the executor; `execute_plan` marks later actions a real model response and validated proposal, and the new
unattempted after a failure; unparseable emerge output is refused while a "editing the model invalidates the connection" regression.
real `0 packages` plan is accepted; a material plan change aborts before - `gui-install` (new mode) passed every journey assertion on a fresh 30 GiB
the mutation. qcow2 — AI connect/accept, disk, account, ERASE, confirmation toggle —
- **Not yet verified this session:** the destructive **rollback VM and the backend then reported real stages with elapsed time and no
acceptance** (`sys undo`). See the blocker below — rollback stays explicitly fabricated percentage. The install itself was still compiling the kernel
unverified. The OpenCode live tests are environment-gated and were skipped after four hours (the base-package stage alone took ~116 min on this host),
(no `PHOEBUS_OPENCODE_LIVE_*`), and the full graphical install past the AI so the harness timed out; the **completed install + detached boot gate is
gate and a separate physical computer remain unverified from the previous BLOCKED on host build time** (see `docs/VM-BOOT-VERIFICATION.md`).
session. - **Not yet verified this session:** the **complete graphical install and
detached boot** (BLOCKED on host build time — the 4h harness run was still
compiling the kernel; see blockers), the installed **Mango desktop**
rollback and NVIDIA checks are unchanged; rollback (`sys undo`) and the AI
sandbox remain unit-tested but not VM-verified, and the physical-seat desktop
and a separate physical computer remain open (see blockers).
- **Public repo:** <https://git.phoebus.club/phoebus/phoebus_os> - **Public repo:** <https://git.phoebus.club/phoebus/phoebus_os>
(remote `origin`, SSH port 2222). (remote `origin`, SSH port 2222).
## Next actions (in order) ## Next actions (in order)
1. **Complete the graphical install with a real model**: download a small local 1. **Installed Mango desktop**: install the default profile (Mango + DMS) in a
OpenAI-compatible model (or supply a 0600 provider key), then run graphical VM and verify the panel/launcher/terminal/audio/network/lock/idle,
`gui-driver.py gui` through disk/account/review/ERASE/install/rebooot twice the dwl fallback, and the welcome/installer absence on the installed system.
on fresh qcow2 disks and record the passing journeys. The current automated 2. **Rollback VM acceptance (BLOCKED)**: deliberately break an update, run
journey passes to the AI gate only. `sys undo`, reboot detached, verify `/var/db/pkg` matches `/`, then boot the
2. **Installed Mango desktop**: install the default profile in a graphical VM recovery entry with no network or model (ADR 0007). Needed: (a) free the
and verify the panel/launcher/terminal/audio/network/lock/idle, the dwl >=20 GiB `make doctor` wants for the harness; (b) an automated driver for the
fallback, and the welcome/installer absence on the installed system. break-update/undo/recovery sequence — the harness has no such mode.
3. **Rollback VM acceptance (BLOCKED this session)**: deliberately break an 3. **Narrow the live broker privilege**: replace the live-only `NOPASSWD: ALL`
update, run `sys undo`, reboot detached, verify `/var/db/pkg` matches `/`, rule for the GUI bridge with the smallest practical command-scoped rule once
then boot the recovery entry with no network or model (ADR 0007). Needed: a safe sudoers form is verified (ADR 0011 context).
(a) free the >=20 GiB `make doctor` wants for the harness (the root fs has 4. **Physical-seat desktop**: run `phoebus-session` on a real VT/seat and check
~12 GiB free); (b) an automated driver for the break-update/undo/recovery
sequence — `appliance-driver.py` only implements `install`/`boot`. Until
both exist, `sys undo` stays unverified.
4. **Narrow the live broker privilege**: replace the live-only
`NOPASSWD: ALL` rule for the GUI bridge with the smallest practical
command-scoped rule once a safe sudoers form is verified (ADR 0011 context).
5. **Physical-seat desktop**: run `phoebus-session` on a real VT/seat and check
`phoebus-menu`, `phoebus-lock`, `phoebus-idle`, kitty, XWayland, the polkit `phoebus-menu`, `phoebus-lock`, `phoebus-idle`, kitty, XWayland, the polkit
agent, logout/reap and reboot (`docs/DEVELOPMENT.md`). agent, logout/reap and reboot (`docs/DEVELOPMENT.md`).
6. **Release gates on a CI runner**: `phoebus-release gates --execute` and 5. **Release gates on a CI runner**: `phoebus-release gates --execute` and
`publish` once a runner exists; no gate has executed. `publish` once a runner exists; no gate has executed.
## Known blockers / risks ## Known blockers / risks
- No live DeepSeek/OpenAI key and no local model are available; the **full GUI - **The complete graphical install and detached boot are BLOCKED on host build
install past the AI step** and two fresh-disk graphical installs are NOT time.** The `gui-install` journey passes every assertion and starts a real
verified (normal installation requires a connected model). The AI step is install, but on this host the base packages take ~116 min and the
verified as a blocked prerequisite and with a fixture transport. (AI-selected) optimized kernel was still compiling after 100 min, so the 4h
harness timeout fired. Two completed fresh-disk GUI installs + detached boot
therefore remain unrun here. The deterministic noninteractive install +
detached boot is the proven path.
- **Installed** Mango (GURU + compiled Quickshell/DMS) is not VM-verified; nor - **Installed** Mango (GURU + compiled Quickshell/DMS) is not VM-verified; nor
is the dwl fallback session. is the dwl fallback session. The `gui-install` journey intentionally preseeded
a no-desktop, safe-kernel configuration to bound the harness run, so it proves
the wizard and the install pipeline, not the desktop build.
- **Rollback (`sys undo`) is implemented and unit-tested but NOT VM-verified - **Rollback (`sys undo`) is implemented and unit-tested but NOT VM-verified
(BLOCKED).** Exact blockers: `make doctor` reports ~13 GiB free versus the (BLOCKED).** Exact blockers: `make doctor` reports ~13 GiB free versus the
>=20 GiB the harness wants (root fs ~12 GiB free), and the harness has no >=20 GiB the harness wants, and the harness has no automated
automated break-update/undo/recovery-boot mode. The AI sandbox is likewise break-update/undo/recovery-boot mode. The AI sandbox is likewise
implemented/unit-tested but not VM-verified. NVIDIA is not verified. implemented/unit-tested but not VM-verified. NVIDIA is not verified.
- A **separate physical computer** for the OpenCode transport test is not - A **separate physical computer** for the OpenCode transport test is not
available (BLOCKED); a forwarded-hop + unauthenticated-LAN-refusal host-local available (BLOCKED); a forwarded-hop + unauthenticated-LAN-refusal host-local
@ -94,8 +100,10 @@ commit it. It should be short and current; use `git log` for detail.
a nested Mango over the host X11 using the built rootfs libraries, and a nested Mango over the host X11 using the built rootfs libraries, and
`grim` captures it. The sanctioned verification is the disposable VM. `grim` captures it. The sanctioned verification is the disposable VM.
- VM harnesses: `installer/tests/vm/gui-driver.py` (graphical live ISO: - VM harnesses: `installer/tests/vm/gui-driver.py` (graphical live ISO:
`gui`/`install`/`boot`), `appliance-driver.py`, `serial-driver.py`. `gui`/`opencode`/`gui-install`/`install`/`boot`), `appliance-driver.py`,
`DISK` must be a disposable qcow2; never point it at `/dev/*`. `serial-driver.py`. `DISK` must be a disposable qcow2; never point it at
`/dev/*`. A `gui-install` run leaves its installed disk for a following
`boot` run.
- Serve the install fixtures from `/home/dominic/vmlab/serve` with - Serve the install fixtures from `/home/dominic/vmlab/serve` with
`python3 -m http.server 8000 --bind 127.0.0.1` (reachable as `10.0.2.2:8000`). `python3 -m http.server 8000 --bind 127.0.0.1` (reachable as `10.0.2.2:8000`).

View file

@ -64,8 +64,8 @@ still not VM-verified.
| Locale/timezone/keymap/services | yes | yes | yes | n/a | | Locale/timezone/keymap/services | yes | yes | yes | n/a |
| Rust VM boot parity | yes | yes | yes | no | | Rust VM boot parity | yes | yes | yes | no |
| Rust TUI | yes | yes | smoke test | no | | Rust TUI | yes | yes | smoke test | no |
| Typed GUI bridge (`--gui-bridge`) | yes | yes (dry-run) | live VM | n/a | | Typed GUI bridge (`--gui-bridge`) | yes | yes (dry-run) | live VM + full journey | n/a |
| Graphical welcome + install wizard (Quickshell) | yes | guards tested | live graphical VM | no | | Graphical welcome + install wizard (Quickshell) | yes | yes | live graphical VM + full GUI journey | no |
| Phoebus brand system (SVG + tokens) | yes | yes | live VM | n/a | | Phoebus brand system (SVG + tokens) | yes | yes | live VM | n/a |
| Desktop profile (dwl/waybar/mako/swaybg) | yes | partial | headless only | no | | Desktop profile (dwl/waybar/mako/swaybg) | yes | partial | headless only | no |
| Desktop session script (socket wait, polkit, cleanup) | yes | yes | functional test (stubs) | no | | Desktop session script (socket wait, polkit, cleanup) | yes | yes | functional test (stubs) | no |
@ -106,7 +106,8 @@ still not VM-verified.
| OpenCode server capability probe | yes | yes | real host probe + auth + policy | n/a | | OpenCode server capability probe | yes | yes | real host probe + auth + policy | n/a |
| OpenCode proposal adapter (real inference) | yes | yes | real model (`deepseek-v4-flash`) | n/a | | OpenCode proposal adapter (real inference) | yes | yes | real model (`deepseek-v4-flash`) | n/a |
| OpenCode in GUI / CLI / `sys ask` | yes | yes | GUI AI step + `sys ask` live | n/a | | OpenCode in GUI / CLI / `sys ask` | yes | yes | GUI AI step + `sys ask` live | n/a |
| OpenCode full graphical install | yes | yes | AI gate passed; install not run | n/a | | OpenCode full graphical install | yes | yes | journey + backend stages; completion host-blocked | n/a |
| GUI readiness refresh / AI revalidation / keyboard nav | yes | yes (Rust) | VM harness regressions | n/a |
| Mandatory AI requires a validated interaction | yes | yes | bridge + CLI | n/a | | Mandatory AI requires a validated interaction | yes | yes | bridge + CLI | n/a |
| GURU packaging (scoped keywords) | yes | yes | no (build/install unverified) | no | | GURU packaging (scoped keywords) | yes | yes | no (build/install unverified) | no |
| Release gates + atomic publish | yes | yes | no | n/a | | Release gates + atomic publish | yes | yes | no | n/a |
@ -151,20 +152,25 @@ still not VM-verified.
rootfs with Mango + DMS, live-only autologin, a branded welcome window and a rootfs with Mango + DMS, live-only autologin, a branded welcome window and a
graphical installer frontend over the typed bridge. Its desktop-payload graphical installer frontend over the typed bridge. Its desktop-payload
guards are unit-tested. The rebuilt ISO guards are unit-tested. The rebuilt ISO
(`sha256 428dbd75…`, 1.6 GiB, build id in `/etc/phoebus/build`) was booted in (`sha256 0c386a1b…`, 1.6 GiB, build id in `/etc/phoebus/build`) was booted in
a graphical, seat-providing VM and the automated `gui` journey passed a graphical, seat-providing VM. The `gui` journey passed **28/28** checks
**23/23** checks: the welcome window opened automatically, "Install Phoebus (welcome autostart, launcher from the keyboard, duplicate prevention, the live
OS" launched the installer from the keyboard, a second launch created no medium protected, keyboard suggestion selection, the network and AI steps,
duplicate, the live medium was reported protected, keyboard navigation the AI gate refused without a model and reported inline, no bridge errors) and
reached the network and AI steps, and advancing without a connected model was the `opencode` journey passed **18/18** (real model response, validated
refused. An earlier appliance build of the same code path was installed proposal, and editing the model invalidating the validated state). The new
`gui-install` journey passed every assertion on a fresh 30 GiB qcow2 —
OpenCode connect/review/accept, disk, account, ERASE and confirmation — and
the backend then reported real stages with elapsed time and no fabricated
percentage. The **completed** install timed out in the harness after four
hours because the base-package stage takes ~116 min and the AI-selected
optimized kernel was still compiling after 100 min on this host, so two
completed fresh-disk GUI installs + detached boot remain **BLOCKED on host
build time**. An appliance build of the same boot path was installed
non-interactively (`INSTALL-RC=0`, `NO_SECRET_LEAK`) and booted **with the non-interactively (`INSTALL-RC=0`, `NO_SECRET_LEAK`) and booted **with the
ISO detached** (systemd running, 0 failed units, LUKS2, all Btrfs subvolumes, ISO detached** (systemd running, 0 failed units, LUKS2, all Btrfs subvolumes,
network). A live AI provider call was **not** possible (no key and no local network). The **installed** Mango system (GURU + compiled Quickshell/DMS) and
model in this environment), so the **full graphical install past the AI step** the dwl fallback in a VM are not yet verified.
is not claimed; the AI step is verified as a blocked prerequisite and with a
fixture transport in unit tests. The **installed** Mango system (GURU +
compiled Quickshell/DMS) and the dwl fallback in a VM are not yet verified.
- **AI sandbox** is implemented (`systemd-run` hardening properties, tested at - **AI sandbox** is implemented (`systemd-run` hardening properties, tested at
the argv level) and fails closed without `systemd-run`; it has not been the argv level) and fails closed without `systemd-run`; it has not been
exercised in a VM. Only typed actions and the privacy boundary were previously exercised in a VM. Only typed actions and the privacy boundary were previously

View file

@ -36,8 +36,9 @@ installer CLI and `sys ask`. Defects found while implementing and testing:
- **Test connection** obtained a real model response (green "Model responded"); - **Test connection** obtained a real model response (green "Model responded");
- **Connect and validate** obtained and validated a proposal (green "Validated", - **Connect and validate** obtained and validated a proposal (green "Validated",
frontend state `aiConnected=true`); frontend state `aiConnected=true`);
- run `gui-opencode-20260922T102640Z-be168813`: **17/17 PASS**, exit 0; the full - run `gui-opencode-20260922T192457Z-01714c92`: **18/18 PASS**, exit 0; the full
GUI regression `gui-gui-20260922T102907Z-a9e5e824` was **25/25 PASS**. GUI regression `gui-gui-20260922T191954Z-876d5e91` was **28/28 PASS** (both on
the final ISO `sha256 0c386a1b…`).
- The model is reached through a guest-loopback relay to the host OpenCode - The model is reached through a guest-loopback relay to the host OpenCode
server (the SSH-tunnel shape), so the transport policy is satisfied. server (the SSH-tunnel shape), so the transport policy is satisfied.
- Authenticated server: the same harness with a password-protected server got - Authenticated server: the same harness with a password-protected server got
@ -45,11 +46,31 @@ installer CLI and `sys ask`. Defects found while implementing and testing:
was correctly rejected. Use `deepseek-flash` (reliable) over was correctly rejected. Use `deepseek-flash` (reliable) over
`deepseek-v4-flash` (occasionally malformed). `deepseek-v4-flash` (occasionally malformed).
Still **NOT RUN**: the full graphical installation (disk → account → review → ### Graphical journey: interaction defects fixed (2026-09-22)
ERASE → install → detached boot) *through OpenCode*. The AI gate is now reached
and passed in the graphical VM; the remaining stages are the long package | ID | Defect | Fix | Test |
installation. Two fresh-disk graphical installs and a separate physical machine |----|--------|-----|------|
remain unverified. | G1 | Network **Re-check** ran the handshake init path and reset the step, clearing the selected disk | a read-only `readiness` bridge op refreshes the probe without touching the form; only the first handshake initialises | harness `readiness-refresh-preserves-wizard`, `disk-survives-backtrack`; Rust `readiness_reports_link_and_service_reachability_separately` |
| G2 | Model-catalog requests used stale configuration/credentials, and a stale reply could overwrite a newer one | the catalog syncs edited config + secrets first, replies carry a stable `error_kind` (auth required/rejected, insecure transport, model unavailable, unreachable), and a request sequence ignores superseded replies | Rust `ai_catalog_errors_are_machine_readable`, `connection_error_kind_classifies_common_failures`; harness exercises the auth error |
| G3 | The green AI indicators survived edits to provider/model/endpoint/credentials | every connection-field edit invalidates the validated state; account/disk edits preserve it | harness `ai-invalidated-on-model-edit`; Rust `a_config_change_invalidates_the_validated_interaction` |
| G4 | Suggestion lists were mouse-only | Up/Down move a visible highlight, Enter selects, Escape dismisses, `Accessible` roles; Enter in an open list is consumed | harness `keyboard-suggestion-select` |
| G5 | Selecting a keyboard layout implied it applied to the live session | the step states the live session keeps its layout and the choice applies to the installed system | manual review of the language step |
| G6 | Readiness only detected a default route | `link` and verified `services` reachability are reported separately | Rust `readiness_reports_link_and_service_reachability_separately` |
| G7 | A bridge crash left requests/busy indicators hanging | the bridge fails every outstanding request on exit; single-flight guards and cleared busy states with retry | Rust bridge exit path; harness `frontend-no-bridge-errors` |
| G8 | `PhoebusToggle` Return/Enter called a signal handler as a function | a single `Keys.onPressed` handler toggles on Space/Return/Enter | harness `gui-install-erase-confirmed` |
### Full graphical install
`gui-driver.py gui-install` drives the real controls on a fresh 30 GiB qcow2
(run `gui-gui-install-20260922T151232Z-0ef19969`): **24 PASS / 1 FAIL**. Every
journey assertion passed (OpenCode connect/review/accept, disk, account, ERASE,
confirmation toggle) and the backend reported the real stage sequence with
elapsed time and no fabricated percentage. The one FAIL is
`gui-install-completes`: the four-hour harness timeout fired during
`kernel_install` (base packages ~116 min; the AI-selected optimized kernel
compiled for >100 min on this host). The completed install + detached boot gate
is **BLOCKED on host build time**; the deterministic noninteractive install +
detached boot remains the proven boot path.
### User trial findings (interactive VM, 2026-09-22) ### User trial findings (interactive VM, 2026-09-22)

View file

@ -597,6 +597,43 @@ A host-local OpenCode transport test also ran: `phoebus-installer
forwarded second loopback endpoint, and `authentication_required` (exit 1) forwarded second loopback endpoint, and `authentication_required` (exit 1)
against a deliberately unauthenticated LAN bind. against a deliberately unauthenticated LAN bind.
## 2026-09-22 — graphical journey polish and the `gui-install` mode
The graphical installer was reworked into a fixed first-time-user journey and
re-verified on the final ISO.
- Source revision: `34c12d3` plus the session work; ISO
`installer/live/phoebus-installer-amd64.iso`, `sha256 0c386a1b…`, 1.6 GiB,
built with `PHOEBUS_REUSE_ROOTFS=1` (Mango 0.17.2 + DankMaterialShell 1.6.2).
- `gui` **28/28 PASS** (`/var/tmp/phoebus-vm/gui-gui-20260922T191954Z-876d5e91/`):
welcome autostart, launcher from the keyboard, duplicate prevention, the live
medium protected, keyboard suggestion selection (Down then Enter stores the
identifier), the network and AI steps, the AI gate refused without a model
with an inline error, and no bridge errors.
- `opencode` **18/18 PASS**
(`/var/tmp/phoebus-vm/gui-opencode-20260922T192457Z-01714c92/`): OpenCode
selected and driven through the UI, a real model response (Test connection),
a validated proposal (4 changes applied), and a regression asserting that
editing the model flips the validated state off.
- `gui-install` **24 PASS / 1 FAIL**
(`/var/tmp/phoebus-vm/gui-gui-install-20260922T151232Z-0ef19969/`): every
journey assertion passed — OpenCode connect/review/accept,
`back-nav-preserves-ai`, `readiness-refresh-preserves-wizard`,
`disk-survives-backtrack`, disk selection, account and encryption, ERASE and
`gui-install-erase-confirmed` — and the backend then reported the real stage
sequence (`storage_prepare`, `stage_install`, `fstab_generate`,
`portage_configure`, `packages_base`, `kernel_install`) with elapsed time and
no fabricated percentage. The single FAIL is `gui-install-completes`: after
four hours the install was still in `kernel_install`, because the
base-package stage took ~116 min and the AI-selected optimized kernel
compiled for more than 100 min on this host, so the harness timeout fired.
**The completed install + detached boot gate is BLOCKED on host build time**;
the deterministic noninteractive install + detached boot (above) remains the
proven boot path. No code defect is implicated.
- The new `PHOEBUS_GUI_CONFIG` / `/etc/phoebus/install.conf` hook lets a medium
preseed the wizard defaults. It changes defaults only: validation, the plan,
the AI gate and the ERASE authorization are unchanged.
## Known remaining work ## Known remaining work
- The graphical session was verified with the **headless** wlroots backend - The graphical session was verified with the **headless** wlroots backend
@ -610,13 +647,15 @@ against a deliberately unauthenticated LAN bind.
- Desktop USE still does not match the signed binhost, so the desktop - Desktop USE still does not match the signed binhost, so the desktop
transaction compiles a large amount from source (~26 minutes for the desktop transaction compiles a large amount from source (~26 minutes for the desktop
package set on 8 vCPUs in the test VM). package set on 8 vCPUs in the test VM).
- **The full graphical install past the AI step is NOT verified.** No live - **The complete graphical install and detached boot are BLOCKED on host build
provider key and no downloadable local model were available in this time.** The `gui-install` harness now drives the real controls and passes every
environment, and normal installation requires a connected model by design; journey assertion on a fresh qcow2 (AI connect/review/accept, disk, account,
the automated journey stops at (and verifies) the blocked AI prerequisite. ERASE, confirmation) and starts a real install, but on this host the
Two fresh-disk graphical installations from the final candidate remain base-package stage takes ~116 min and the AI-selected optimized kernel was
unrun. The deterministic noninteractive install + detached boot remains the still compiling after 100 min, so a four-hour harness timeout fired during
proven boot path. `kernel_install`. Two completed fresh-disk graphical installs + detached boot
therefore remain unrun here; the deterministic noninteractive install +
detached boot is the proven boot path.
- **A separate physical computer for the OpenCode transport test is NOT - **A separate physical computer for the OpenCode transport test is NOT
available**; that check is BLOCKED. The forwarded-hop and available**; that check is BLOCKED. The forwarded-hop and
unauthenticated-LAN-refusal tests are host-local. unauthenticated-LAN-refusal tests are host-local.

View file

@ -258,6 +258,7 @@ impl Bridge {
let op = request.op.clone(); let op = request.op.clone();
let result = match request.op.as_str() { let result = match request.op.as_str() {
"handshake" => self.handshake(), "handshake" => self.handshake(),
"readiness" => self.readiness(),
"options" => self.options(), "options" => self.options(),
"ai_catalog" => self.ai_catalog(), "ai_catalog" => self.ai_catalog(),
"disks" => self.disks(), "disks" => self.disks(),
@ -283,10 +284,22 @@ impl Bridge {
out, out,
&json!({ "id": id, "ok": true, "op": op, "data": data }), &json!({ "id": id, "ok": true, "op": op, "data": data }),
), ),
Err(error) => write_json( Err(error) => {
out, // AI connection failures carry a stable, machine-readable kind
&json!({ "id": id, "ok": false, "op": op, "error": error }), // so the frontend can distinguish an authentication failure
), // from an unreachable server, a missing model or bad transport.
// The human message stays authoritative and redacted.
let mut payload = json!({ "id": id, "ok": false, "op": op, "error": error });
if matches!(
op.as_str(),
"ai_catalog" | "ai_check" | "ai_test" | "readiness"
) {
payload["error_kind"] = json!(connection_error_kind(
payload["error"].as_str().unwrap_or("")
));
}
write_json(out, &payload)
}
} }
} }
@ -309,19 +322,44 @@ impl Bridge {
"cpu_cores": self.installer.hardware.cpu.cores, "cpu_cores": self.installer.hardware.cpu.cores,
"cpu_model": self.installer.hardware.cpu.model, "cpu_model": self.installer.hardware.cpu.model,
"desktop": self.installer.config.desktop.profile.as_str(), "desktop": self.installer.config.desktop.profile.as_str(),
"keymap_live": live_keymap(),
}, },
"facts": facts, "facts": facts,
})) }))
} }
/// A deeper, on-demand readiness probe. Unlike [`Self::handshake`] this may
/// make one bounded network request, so the frontend calls it when the
/// network step is shown or the user asks to re-check. It never changes
/// configuration or state, so refreshing readiness cannot reset the wizard.
fn readiness(&self) -> Result<Value, String> {
let link = network_ready();
let services = service_reachability(&self.installer);
Ok(json!({
"network": link,
"network_services": services.reachable,
"network_detail": services.detail,
"network_target": services.target,
"firmware": self.installer.hardware.firmware_str(),
"memory_mib": self.installer.hardware.memory_mib,
"cpu_cores": self.installer.hardware.cpu.cores,
"cpu_model": self.installer.hardware.cpu.model,
"desktop": self.installer.config.desktop.profile.as_str(),
"keymap_live": live_keymap(),
}))
}
/// Selectable options for the language/region step. Reading these from the /// Selectable options for the language/region step. Reading these from the
/// live system means the user picks from the real timezones, locales and /// live system means the user picks from the real timezones, locales and
/// keymaps instead of typing them from memory. /// keymaps instead of typing them from memory.
fn options(&self) -> Result<Value, String> { fn options(&self) -> Result<Value, String> {
Ok(json!({ Ok(json!({
"timezones": system_timezones(), "timezones": labeled_options(system_timezones(), humanize_timezone),
"locales": system_locales(), "locales": labeled_options(system_locales(), humanize_locale),
"keymaps": system_keymaps(), "keymaps": labeled_options(system_keymaps(), humanize_keymap),
// The live session's own layout, so the frontend can be truthful
// about whether a selection affects the running graphical session.
"keymap_live": live_keymap(),
})) }))
} }
@ -949,6 +987,337 @@ fn network_ready() -> bool {
}) })
} }
/// The result of a bounded reachability check against the configured
/// installation source. A default route proves a local link; only a completed
/// request proves the installation services are actually reachable.
struct ServiceReachability {
reachable: bool,
detail: String,
target: String,
}
fn service_reachability(installer: &Installer) -> ServiceReachability {
use phoebus_executor::opencode_client::{CurlHttpClient, HttpClient, HttpRequest};
let config = &installer.config;
let target = if !config.stage3.url.trim().is_empty() {
config.stage3.url.trim().to_string()
} else {
config.stage3.mirror.trim().to_string()
};
if target.is_empty() {
return ServiceReachability {
reachable: false,
detail: "No installation source is configured.".into(),
target,
};
}
let mut request = HttpRequest::get(target.clone());
// Keep the check snappy: the user is waiting on it.
request.timeout = std::time::Duration::from_secs(8);
request.connect_timeout = std::time::Duration::from_secs(5);
request.max_body = 64 * 1024;
let http = CurlHttpClient::new(&installer.exec);
match http.request(&request) {
Ok(_) => ServiceReachability {
reachable: true,
detail: "Installation services are reachable.".into(),
target,
},
Err(e) => ServiceReachability {
reachable: false,
detail: installer.exec.redactor().redact(&e.to_string()),
target,
},
}
}
/// The live medium's console keymap, read without privileges. Used to tell the
/// truth about whether choosing a layout changes the running session.
fn live_keymap() -> String {
if let Ok(text) = std::fs::read_to_string("/etc/vconsole.conf") {
for line in text.lines() {
if let Some(value) = line.trim().strip_prefix("KEYMAP=") {
let value = value.trim().trim_matches('"');
if !value.is_empty() {
return value.to_string();
}
}
}
}
std::env::var("XKB_DEFAULT_LAYOUT")
.ok()
.filter(|v| !v.trim().is_empty())
.unwrap_or_else(|| "us".into())
}
/// Classify a connection error into a stable kind. The frontend uses this to
/// show an actionable recovery instead of a raw transport string.
fn connection_error_kind(message: &str) -> &'static str {
let m = message.to_ascii_lowercase();
if m.contains("authentication required")
|| m.contains("requires authentication")
|| m.contains("no api key")
|| m.contains("requires an api key")
{
"authentication_required"
} else if m.contains("authentication rejected")
|| m.contains("rejected the supplied")
|| m.contains("http 401")
|| m.contains("http 403")
{
"authentication_rejected"
} else if m.contains("insecure_transport")
|| m.contains("plain http")
|| m.contains("must use https")
{
"insecure_transport"
} else if m.contains("http 404")
|| m.contains("model not found")
|| m.contains("unknown model")
|| m.contains("no such model")
{
"model_unavailable"
} else if m.contains("timed out")
|| m.contains("timeout")
|| m.contains("connection refused")
|| m.contains("could not connect")
|| m.contains("failed to connect")
|| m.contains("transport")
|| m.contains("unreachable")
{
"unreachable"
} else {
"error"
}
}
/// Turn a plain value list into `{value, label}` pairs so the frontend can show
/// human-readable names while the backend keeps validating the real identifier.
fn labeled_options(values: Vec<String>, label: fn(&str) -> String) -> Vec<Value> {
values
.into_iter()
.map(|value| {
let text = label(&value);
json!({ "value": value, "label": text })
})
.collect()
}
fn humanize_timezone(zone: &str) -> String {
match zone {
"UTC" => "UTC — Coordinated Universal Time".to_string(),
_ => zone.replace('_', " ").replace('/', " / "),
}
}
/// A friendly language (and region, when known) name for a POSIX locale, with
/// the technical identifier kept at the end for advanced users.
fn humanize_locale(locale: &str) -> String {
let base = locale.split('.').next().unwrap_or(locale);
let mut parts = base.split('_');
let language = parts.next().unwrap_or("");
let region = parts.next();
match (language_name(language), region.and_then(region_name)) {
(Some(lang), Some(region)) => format!("{lang} ({region}) — {locale}"),
(Some(lang), None) => format!("{lang} — {locale}"),
_ => locale.to_string(),
}
}
fn language_name(code: &str) -> Option<&'static str> {
Some(match code {
"en" => "English",
"de" => "German",
"fr" => "French",
"es" => "Spanish",
"it" => "Italian",
"pt" => "Portuguese",
"nl" => "Dutch",
"pl" => "Polish",
"ru" => "Russian",
"uk" => "Ukrainian",
"cs" => "Czech",
"sk" => "Slovak",
"sv" => "Swedish",
"nb" | "no" => "Norwegian",
"da" => "Danish",
"fi" => "Finnish",
"el" => "Greek",
"tr" => "Turkish",
"hu" => "Hungarian",
"ro" => "Romanian",
"bg" => "Bulgarian",
"hr" => "Croatian",
"sr" => "Serbian",
"sl" => "Slovenian",
"et" => "Estonian",
"lv" => "Latvian",
"lt" => "Lithuanian",
"ja" => "Japanese",
"ko" => "Korean",
"zh" => "Chinese",
"hi" => "Hindi",
"bn" => "Bengali",
"ar" => "Arabic",
"he" => "Hebrew",
"fa" => "Persian",
"th" => "Thai",
"vi" => "Vietnamese",
"id" => "Indonesian",
"ms" => "Malay",
"sw" => "Swahili",
"ca" => "Catalan",
"gl" => "Galician",
"eu" => "Basque",
"is" => "Icelandic",
"ga" => "Irish",
"cy" => "Welsh",
"sq" => "Albanian",
"mk" => "Macedonian",
"be" => "Belarusian",
"az" => "Azerbaijani",
"kk" => "Kazakh",
"uz" => "Uzbek",
"ka" => "Georgian",
"hy" => "Armenian",
"af" => "Afrikaans",
_ => return None,
})
}
fn region_name(code: &str) -> Option<&'static str> {
Some(match code.to_ascii_uppercase().as_str() {
"US" => "United States",
"GB" => "United Kingdom",
"DE" => "Germany",
"FR" => "France",
"ES" => "Spain",
"IT" => "Italy",
"PT" => "Portugal",
"BR" => "Brazil",
"NL" => "Netherlands",
"BE" => "Belgium",
"AT" => "Austria",
"CH" => "Switzerland",
"PL" => "Poland",
"RU" => "Russia",
"UA" => "Ukraine",
"CZ" => "Czechia",
"SK" => "Slovakia",
"SE" => "Sweden",
"NO" => "Norway",
"DK" => "Denmark",
"FI" => "Finland",
"GR" => "Greece",
"TR" => "Türkiye",
"HU" => "Hungary",
"RO" => "Romania",
"BG" => "Bulgaria",
"HR" => "Croatia",
"RS" => "Serbia",
"SI" => "Slovenia",
"EE" => "Estonia",
"LV" => "Latvia",
"LT" => "Lithuania",
"JP" => "Japan",
"KR" => "South Korea",
"CN" => "China",
"TW" => "Taiwan",
"IN" => "India",
"SG" => "Singapore",
"AU" => "Australia",
"NZ" => "New Zealand",
"CA" => "Canada",
"MX" => "Mexico",
"AR" => "Argentina",
"ZA" => "South Africa",
"IE" => "Ireland",
"IL" => "Israel",
"AE" => "United Arab Emirates",
"SA" => "Saudi Arabia",
"TH" => "Thailand",
"VN" => "Vietnam",
"ID" => "Indonesia",
"MY" => "Malaysia",
"PH" => "Philippines",
_ => return None,
})
}
/// A friendly keyboard name for a console keymap identifier, with the technical
/// name kept so an advanced user can still see exactly what will be set.
fn humanize_keymap(name: &str) -> String {
let base = name.split('-').next().unwrap_or(name);
let language = match base {
"us" => "English (US)",
"gb" | "uk" => "English (UK)",
"de" => "German",
"fr" => "French",
"es" => "Spanish",
"it" => "Italian",
"pt" => "Portuguese",
"br" | "br-abnt2" => "Portuguese (Brazil)",
"latam" => "Spanish (Latin America)",
"nl" => "Dutch",
"be" => "Belgian",
"dk" => "Danish",
"no" => "Norwegian",
"se" => "Swedish",
"fi" => "Finnish",
"is" => "Icelandic",
"pl" => "Polish",
"cz" => "Czech",
"sk" => "Slovak",
"hu" => "Hungarian",
"ro" => "Romanian",
"bg" => "Bulgarian",
"gr" => "Greek",
"ru" => "Russian",
"ua" => "Ukrainian",
"tr" => "Turkish",
"il" => "Hebrew",
"ara" => "Arabic",
"in" => "Indian",
"jp106" => "Japanese",
"kr" => "Korean",
"cn" => "Chinese",
"tw" => "Chinese (Taiwan)",
"ca" => "Canadian",
"cf" => "Canadian (French)",
"ch" => "Swiss",
"at" => "German (Austria)",
"ie" => "Irish",
"si" => "Slovenian",
"hr" => "Croatian",
"ee" => "Estonian",
"lt" => "Lithuanian",
"lv" => "Latvian",
"mk" => "Macedonian",
"rs" => "Serbian",
"by" => "Belarusian",
"kz" => "Kazakh",
"us-dvorak" | "dvorak" => "Dvorak",
"colemak" => "Colemak",
"mac-us" => "Mac (US)",
"sg" => "Swiss German",
"th" => "Thai",
"vn" => "Vietnamese",
"fa" => "Persian",
"az" => "Azerbaijani",
"ge" => "Georgian",
"am" => "Armenian",
_ => "",
};
if language.is_empty() {
name.to_string()
} else if language == name {
language.to_string()
} else {
format!("{language} — {name}")
}
}
fn iso_version() -> String { fn iso_version() -> String {
if let Ok(text) = std::fs::read_to_string("/etc/phoebus/version") { if let Ok(text) = std::fs::read_to_string("/etc/phoebus/version") {
let t = text.trim(); let t = text.trim();
@ -1378,7 +1747,33 @@ fn review_proposal(
/// The stdio entry point used by `--gui-bridge`. /// The stdio entry point used by `--gui-bridge`.
pub fn run_stdio() -> io::Result<()> { pub fn run_stdio() -> io::Result<()> {
let mut config = InstallConfig::default(); // The live medium may preseed the wizard's starting configuration. The
// deterministic CLI already honours `/etc/phoebus/install.conf`; the
// graphical wizard uses the same file so the two paths agree. A test or
// automation caller can point at another file with `PHOEBUS_GUI_CONFIG`.
// Only the defaults change: validation, the plan, the AI gate and the
// ERASE authorization are all unchanged.
let explicit = std::env::var("PHOEBUS_GUI_CONFIG")
.ok()
.filter(|p| !p.trim().is_empty());
let mut config = if let Some(path) = explicit {
InstallConfig::load_from_path(std::path::Path::new(path.trim())).map_err(|e| {
io::Error::new(
io::ErrorKind::InvalidInput,
format!("cannot load PHOEBUS_GUI_CONFIG: {e}"),
)
})?
} else {
let default = std::path::Path::new("/etc/phoebus/install.conf");
if default.is_file() {
InstallConfig::load_from_path(default).unwrap_or_else(|e| {
eprintln!("ignoring /etc/phoebus/install.conf: {e}");
InstallConfig::default()
})
} else {
InstallConfig::default()
}
};
// Test/automation hook: a dry run is non-destructive, so it is safe to // Test/automation hook: a dry run is non-destructive, so it is safe to
// expose through the environment for the harness. It never changes the // expose through the environment for the harness. It never changes the
// authorization requirements. // authorization requirements.
@ -2098,4 +2493,92 @@ mod tests {
resp["error"] resp["error"]
); );
} }
#[test]
fn connection_error_kind_classifies_common_failures() {
assert_eq!(
connection_error_kind("server requires authentication (HTTP 401)"),
"authentication_required"
);
assert_eq!(
connection_error_kind("server rejected the supplied authentication (HTTP 403)"),
"authentication_rejected"
);
assert_eq!(
connection_error_kind("model list returned HTTP 401"),
"authentication_rejected"
);
assert_eq!(
connection_error_kind("plain http to a non-loopback address is refused"),
"insecure_transport"
);
assert_eq!(
connection_error_kind("could not connect to the model server"),
"unreachable"
);
assert_eq!(
connection_error_kind("transport response had no status"),
"unreachable"
);
assert_eq!(connection_error_kind("something unexpected"), "error");
}
#[test]
fn humanized_labels_keep_the_identifier_and_add_a_name() {
assert!(humanize_locale("en_US.UTF-8").contains("English"));
assert!(humanize_locale("de_DE.UTF-8").contains("German"));
assert!(humanize_locale("en_US.UTF-8").contains("en_US.UTF-8"));
assert_eq!(humanize_locale("xx_YY.UTF-8"), "xx_YY.UTF-8");
assert!(humanize_keymap("de").contains("German"));
assert!(humanize_keymap("de-nodeadkeys").contains("German"));
assert!(humanize_keymap("us").contains("English (US)"));
assert_eq!(humanize_keymap("zzz"), "zzz");
assert!(humanize_timezone("Europe/Berlin").contains("Europe"));
}
#[test]
fn options_carry_labels_and_the_live_keymap() {
let mut bridge = test_bridge();
let lines = call(&mut bridge, r#"{"id":70,"op":"options"}"#);
let data = &response(&lines)["data"];
for key in ["timezones", "locales", "keymaps"] {
let entries = data[key].as_array().unwrap();
assert!(!entries.is_empty(), "{key} was empty");
assert!(
entries
.iter()
.all(|o| o.get("value").is_some() && o.get("label").is_some()),
"{key} entries need a value and a label"
);
}
assert!(data["keymap_live"].is_string());
}
#[test]
fn readiness_reports_link_and_service_reachability_separately() {
let mut bridge = test_bridge();
let lines = call(&mut bridge, r#"{"id":71,"op":"readiness"}"#);
let resp = response(&lines);
assert_eq!(resp["ok"], json!(true), "response: {resp}");
let data = &resp["data"];
assert!(data["network"].is_boolean());
assert!(
data["network_services"].is_boolean(),
"service reachability must be its own fact, not inferred from the link"
);
assert!(data["network_detail"].is_string());
assert!(data["keymap_live"].is_string());
}
#[test]
fn ai_catalog_errors_are_machine_readable() {
let mut bridge = test_bridge();
let lines = call(&mut bridge, r#"{"id":72,"op":"ai_catalog"}"#);
let resp = response(&lines);
assert_eq!(resp["ok"], json!(false));
assert!(
resp["error_kind"].is_string(),
"an AI connection error must carry a kind: {resp}"
);
}
} }

View file

@ -16,6 +16,7 @@ Singleton {
property string lastError: "" property string lastError: ""
property var handshake: null property var handshake: null
property var config: null property var config: null
property bool restarting: false
property var pending: ({}) property var pending: ({})
property int nextId: 1 property int nextId: 1
@ -23,6 +24,10 @@ Singleton {
signal event(string name, var data) signal event(string name, var data)
signal availabilityChanged signal availabilityChanged
signal handshakeReady signal handshakeReady
// Emitted when the backend exits while the frontend is still using it. The
// frontend must reset any state that depended on the backend (notably AI
// validation) and offer a recovery.
signal backendLost(string message)
readonly property var bridgeCommand: { readonly property var bridgeCommand: {
const override = Quickshell.env("PHOEBUS_BRIDGE_CMD"); const override = Quickshell.env("PHOEBUS_BRIDGE_CMD");
@ -42,6 +47,16 @@ Singleton {
onTriggered: root.refreshHandshake(null) onTriggered: root.refreshHandshake(null)
} }
Timer {
id: restartTimer
interval: 500
repeat: false
onTriggered: {
root.start();
root.restarting = false;
}
}
function start() { function start() {
if (!proc.running) if (!proc.running)
proc.running = true; proc.running = true;
@ -51,6 +66,33 @@ Singleton {
proc.running = false; proc.running = false;
} }
// Restart the backend after a crash. The bridge keeps no privileged state,
// so this is safe; the frontend re-pushes its configuration on the next
// action and must revalidate the AI connection.
function restart() {
if (root.restarting)
return;
root.restarting = true;
root.handshake = null;
root.stop();
restartTimer.start();
}
// Complete every outstanding request when the process dies, so no caller is
// left waiting and no busy indicator can stay stuck forever.
function failPending(message) {
const ids = Object.keys(root.pending);
for (let i = 0; i < ids.length; i++) {
const cb = root.pending[ids[i]];
delete root.pending[ids[i]];
try {
cb({ ok: false, error: message, error_kind: "backend_gone" });
} catch (e) {
console.log("bridge: pending callback failed: " + e);
}
}
}
function call(op, payload, onDone) { function call(op, payload, onDone) {
const id = root.nextId++; const id = root.nextId++;
if (onDone) if (onDone)
@ -63,7 +105,7 @@ Singleton {
delete root.pending[id]; delete root.pending[id];
root.lastError = "backend not running"; root.lastError = "backend not running";
if (onDone) if (onDone)
onDone({ ok: false, error: "the installer backend is not running" }); onDone({ ok: false, error: "the installer backend is not running", error_kind: "backend_gone" });
return; return;
} }
proc.write(line); proc.write(line);
@ -105,6 +147,9 @@ Singleton {
function listDisks(cb) { function listDisks(cb) {
call("disks", {}, cb); call("disks", {}, cb);
} }
function readiness(cb) {
call("readiness", {}, cb);
}
function options(cb) { function options(cb) {
call("options", {}, cb); call("options", {}, cb);
} }
@ -164,10 +209,14 @@ Singleton {
root.availabilityChanged(); root.availabilityChanged();
} }
onExited: exitCode => { onExited: exitCode => {
const wasRunning = root.ready;
root.ready = false; root.ready = false;
root.crashed = true; root.crashed = true;
root.crashMessage = "The installer backend stopped (exit " + exitCode + ")."; root.crashMessage = "The installer backend stopped (exit " + exitCode + ").";
root.failPending("the installer backend stopped before answering");
root.availabilityChanged(); root.availabilityChanged();
if (wasRunning && !root.restarting)
root.backendLost(root.crashMessage);
} }
stdout: SplitParser { stdout: SplitParser {
onRead: line => root.handleLine(line) onRead: line => root.handleLine(line)

View file

@ -21,7 +21,7 @@ Rectangle {
return hovered ? Theme.surfaceRaised : Theme.surface; return hovered ? Theme.surfaceRaised : Theme.surface;
} }
implicitHeight: compact ? 34 : 46 implicitHeight: compact ? Theme.controlHeightCompact : Theme.controlHeightLarge
implicitWidth: Math.max(compact ? 80 : 120, labelText.implicitWidth + (compact ? 28 : 48)) implicitWidth: Math.max(compact ? 80 : 120, labelText.implicitWidth + (compact ? 28 : 48))
radius: Theme.radiusSmall radius: Theme.radiusSmall
color: actionEnabled ? baseBg : Theme.surface color: actionEnabled ? baseBg : Theme.surface

View file

@ -10,10 +10,16 @@ Flow {
property bool compact: true property bool compact: true
signal selected(string value) signal selected(string value)
function focusFirst() {
if (repeater.count > 0)
repeater.itemAt(0).forceActiveFocus();
}
spacing: 8 spacing: 8
width: parent ? parent.width : implicitWidth width: parent ? parent.width : implicitWidth
Repeater { Repeater {
id: repeater
model: choice.options model: choice.options
delegate: PhoebusButton { delegate: PhoebusButton {

View file

@ -1,10 +1,12 @@
import QtQuick import QtQuick
// A labelled input with an inline, filtered suggestion list. The user can type // A labelled input with an inline, filtered suggestion list. The user can type
// to narrow the list or click an entry to choose it, and a custom value is // to narrow the list, click an entry, or use the arrow keys: Up/Down move a
// still allowed. Used for timezone, locale, keymap, provider and model so the // visible highlight, Enter selects it, Escape closes the list. A custom value
// user picks from what the system actually offers instead of typing from // is still allowed. Used for timezone, locale, keymap, provider and model so
// memory. // the user picks from what the system actually offers instead of typing from
// memory. `options` may be strings or `{value,label}` pairs; the value is the
// identifier the backend validates, the label is what the user reads.
Column { Column {
id: combo id: combo
@ -13,10 +15,14 @@ Column {
property string error: "" property string error: ""
property var options: [] property var options: []
property int maxVisible: 8 property int maxVisible: 8
property string hint: "Type to filter, click to choose" property string hint: "Type to filter · ↑ ↓ to choose · Enter to select"
property alias text: field.text property alias text: field.text
property alias inputItem: field.inputItem property alias inputItem: field.inputItem
property var suggestions: [] property var suggestions: []
property int highlightIndex: -1
property bool dismissed: false
readonly property bool open: field.inputItem.activeFocus && !combo.dismissed
&& combo.suggestions.length > 0
signal edited(string value) signal edited(string value)
signal selected(string value) signal selected(string value)
@ -24,16 +30,53 @@ Column {
width: parent ? parent.width : implicitWidth width: parent ? parent.width : implicitWidth
spacing: 4 spacing: 4
function optionValue(option) {
return (option !== null && typeof option === "object") ? ("" + option.value) : ("" + option);
}
function optionLabel(option) {
return (option !== null && typeof option === "object" && option.label !== undefined)
? ("" + option.label) : ("" + option);
}
function refresh() { function refresh() {
const query = (field.text || "").toLowerCase(); const query = (field.text || "").toLowerCase();
const all = combo.options || []; const all = combo.options || [];
const out = []; const out = [];
for (let i = 0; i < all.length && out.length < combo.maxVisible; i++) { for (let i = 0; i < all.length && out.length < combo.maxVisible; i++) {
const option = "" + all[i]; const value = combo.optionValue(all[i]);
if (query.length === 0 || option.toLowerCase().indexOf(query) !== -1) const label = combo.optionLabel(all[i]);
out.push(option); if (query.length === 0
|| value.toLowerCase().indexOf(query) !== -1
|| label.toLowerCase().indexOf(query) !== -1)
out.push({ value: value, label: label });
} }
combo.suggestions = out; combo.suggestions = out;
if (combo.highlightIndex >= out.length)
combo.highlightIndex = out.length - 1;
}
function choose(index) {
if (index < 0 || index >= combo.suggestions.length)
return;
const chosen = combo.suggestions[index];
field.inputItem.text = chosen.value;
combo.suggestions = [];
combo.highlightIndex = -1;
combo.dismissed = false;
combo.selected(chosen.value);
}
function commit() {
if (combo.open && combo.highlightIndex >= 0)
combo.choose(combo.highlightIndex);
else {
combo.suggestions = [];
combo.dismissed = true;
}
}
function forceFocus() {
field.inputItem.forceActiveFocus();
} }
onOptionsChanged: combo.refresh() onOptionsChanged: combo.refresh()
@ -45,40 +88,78 @@ Column {
label: combo.label label: combo.label
placeholder: combo.placeholder placeholder: combo.placeholder
error: combo.error error: combo.error
onEdited: value => { combo.edited(value); combo.refresh(); } escapeConsumed: combo.open
returnConsumed: combo.open
onEdited: value => {
combo.dismissed = false;
combo.refresh();
combo.edited(value);
}
onKeyUp: {
if (combo.suggestions.length === 0)
return;
combo.dismissed = false;
combo.highlightIndex = combo.highlightIndex < 0
? combo.suggestions.length - 1
: (combo.highlightIndex <= 0
? combo.suggestions.length - 1 : combo.highlightIndex - 1);
}
onKeyDown: {
if (combo.suggestions.length === 0)
return;
combo.dismissed = false;
combo.highlightIndex = combo.highlightIndex < 0
? 0
: (combo.highlightIndex >= combo.suggestions.length - 1
? 0 : combo.highlightIndex + 1);
}
onKeyEscape: combo.dismissed = true
onAccepted: combo.commit()
} }
// Show the first suggestions as soon as the field takes focus. // Show suggestions as soon as the field takes focus, and clear the
// highlight when it loses focus.
Connections { Connections {
target: field.inputItem target: field.inputItem
function onActiveFocusChanged() { function onActiveFocusChanged() {
if (field.inputItem.activeFocus) if (field.inputItem.activeFocus) {
combo.dismissed = false;
combo.refresh(); combo.refresh();
} else {
combo.dismissed = false;
combo.highlightIndex = -1;
}
} }
} }
Column { Column {
width: parent.width width: parent.width
spacing: 0 spacing: 0
visible: field.inputItem.activeFocus && combo.suggestions.length > 0 visible: combo.open
Repeater { Repeater {
model: field.inputItem.activeFocus ? combo.suggestions : [] model: combo.open ? combo.suggestions : []
delegate: Rectangle { delegate: Rectangle {
id: row
required property var modelData required property var modelData
required property int index
width: parent.width width: parent.width
height: 30 height: 30
color: hover.containsMouse ? Theme.surfaceRaised : Theme.surface color: index === combo.highlightIndex ? Theme.amberDeep
: (hover.containsMouse ? Theme.surfaceRaised : Theme.surface)
border.width: 1 border.width: 1
border.color: Theme.border border.color: index === combo.highlightIndex ? Theme.amber : Theme.border
Accessible.role: Accessible.ListItem
Accessible.name: row.modelData.label
Accessible.selected: index === combo.highlightIndex
Text { Text {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 12 anchors.leftMargin: 12
anchors.rightMargin: 12 anchors.rightMargin: 12
text: modelData text: row.modelData.label
elide: Text.ElideRight elide: Text.ElideRight
color: Theme.warmWhite color: index === combo.highlightIndex ? Theme.charcoal : Theme.warmWhite
font.family: Theme.family font.family: Theme.family
font.pixelSize: Theme.fontSmall font.pixelSize: Theme.fontSmall
} }
@ -87,11 +168,7 @@ Column {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: combo.choose(index)
field.inputItem.text = modelData;
combo.selected(modelData);
combo.suggestions = [];
}
} }
} }
} }

View file

@ -1,6 +1,9 @@
import QtQuick import QtQuick
// A labelled single-line input with an inline error and optional secret echo. // A labelled single-line input with an inline error and optional secret echo.
//
// It forwards the arrow/Escape keys as signals so a wrapping combo box can
// implement keyboard selection without the field knowing about suggestions.
Column { Column {
id: field id: field
@ -9,15 +12,29 @@ Column {
property string error: "" property string error: ""
property bool secret: false property bool secret: false
property bool showSecret: false property bool showSecret: false
// When true, an Escape key is consumed here (used to close a suggestion
// list). Otherwise it bubbles so the window can react to it.
property bool escapeConsumed: false
// When true, Return/Enter is consumed here (used to select a highlighted
// suggestion). Otherwise it bubbles so the page can advance.
property bool returnConsumed: false
property alias text: input.text property alias text: input.text
property alias inputItem: input property alias inputItem: input
property int maxLength: 256 property int maxLength: 256
signal edited(string value) signal edited(string value)
signal accepted signal accepted
signal keyUp
signal keyDown
signal keyEscape
width: parent ? parent.width : implicitWidth width: parent ? parent.width : implicitWidth
spacing: 6 spacing: 6
function forceFocus() {
input.forceActiveFocus();
}
Text { Text {
width: parent.width width: parent.width
text: field.label text: field.label
@ -30,7 +47,7 @@ Column {
Rectangle { Rectangle {
width: parent.width width: parent.width
height: 42 height: Theme.controlHeight
radius: Theme.radiusSmall radius: Theme.radiusSmall
color: Theme.charcoal color: Theme.charcoal
border.width: input.activeFocus ? 2 : 1 border.width: input.activeFocus ? 2 : 1
@ -42,7 +59,7 @@ Column {
id: input id: input
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 12 anchors.leftMargin: 12
anchors.rightMargin: 44 anchors.rightMargin: field.secret ? 52 : 12
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
color: Theme.warmWhite color: Theme.warmWhite
font.family: Theme.family font.family: Theme.family
@ -55,8 +72,34 @@ Column {
activeFocusOnTab: true activeFocusOnTab: true
maximumLength: field.maxLength maximumLength: field.maxLength
clip: true clip: true
Accessible.role: Accessible.EditableText
Accessible.name: field.label.length > 0 ? field.label : field.placeholder
Accessible.description: field.error
onTextEdited: field.edited(text) onTextEdited: field.edited(text)
onAccepted: field.accepted()
Keys.onReturnPressed: event => {
const consumed = field.returnConsumed;
field.accepted();
event.accepted = consumed;
}
Keys.onEnterPressed: event => {
const consumed = field.returnConsumed;
field.accepted();
event.accepted = consumed;
}
Keys.onUpPressed: event => {
event.accepted = true;
field.keyUp();
}
Keys.onDownPressed: event => {
event.accepted = true;
field.keyDown();
}
Keys.onEscapePressed: event => {
const consumed = field.escapeConsumed;
field.keyEscape();
event.accepted = consumed;
}
Text { Text {
anchors.fill: parent anchors.fill: parent
@ -69,20 +112,51 @@ Column {
} }
} }
Text { // The show/hide control is a real focus stop, reachable with Tab and
// operable with Space/Enter, so revealing a password never requires a
// mouse.
Item {
id: reveal
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 12 anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: 40
height: 26
visible: field.secret visible: field.secret
text: field.showSecret ? "hide" : "show" activeFocusOnTab: field.secret
color: Theme.amber Accessible.role: Accessible.Button
font.family: Theme.family Accessible.name: field.showSecret ? "Hide " + field.label : "Show " + field.label
font.pixelSize: Theme.fontSmall Accessible.onPressAction: reveal.toggle()
function toggle() {
field.showSecret = !field.showSecret;
}
Keys.onReturnPressed: reveal.toggle()
Keys.onEnterPressed: reveal.toggle()
Keys.onSpacePressed: reveal.toggle()
Rectangle {
anchors.fill: parent
radius: Theme.radiusSmall
color: "transparent"
border.width: 2
border.color: Theme.focusRing
visible: reveal.activeFocus
}
Text {
anchors.centerIn: parent
text: field.showSecret ? "hide" : "show"
color: Theme.amber
font.family: Theme.family
font.pixelSize: Theme.fontSmall
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
anchors.margins: -6
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: field.showSecret = !field.showSecret onClicked: reveal.toggle()
} }
} }
} }

View file

@ -16,12 +16,19 @@ Item {
Accessible.name: label Accessible.name: label
Accessible.checked: checked Accessible.checked: checked
Keys.onSpacePressed: { Keys.onPressed: event => {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter
|| event.key === Qt.Key_Space) {
toggle.checked = !toggle.checked;
toggle.toggled(toggle.checked);
event.accepted = true;
}
}
function toggleValue() {
toggle.checked = !toggle.checked; toggle.checked = !toggle.checked;
toggle.toggled(toggle.checked); toggle.toggled(toggle.checked);
} }
Keys.onReturnPressed: Keys.onSpacePressed(event)
Keys.onEnterPressed: Keys.onSpacePressed(event)
Column { Column {
anchors.left: parent.left anchors.left: parent.left

View file

@ -1,5 +1,6 @@
pragma Singleton pragma Singleton
import QtQuick import QtQuick
import Quickshell
// Phoebus brand tokens. Kept in sync with phoebus_core::brand::PALETTE by a // Phoebus brand tokens. Kept in sync with phoebus_core::brand::PALETTE by a
// Rust test, so the QML frontend and the backend cannot drift. // Rust test, so the QML frontend and the backend cannot drift.
@ -22,6 +23,14 @@ QtObject {
readonly property color focusRing: amber readonly property color focusRing: amber
readonly property color overlay: Qt.rgba(0.09, 0.09, 0.10, 0.72) readonly property color overlay: Qt.rgba(0.09, 0.09, 0.10, 0.72)
// Text scale. `PHOEBUS_UI_SCALE` lets a display or accessibility setup
// enlarge everything; the content areas scroll, so a larger scale still
// fits at 1024x768.
readonly property real scale: {
const value = parseFloat(Quickshell.env("PHOEBUS_UI_SCALE"));
return (isNaN(value) || value < 0.5 || value > 4) ? 1.0 : value;
}
// Layout. // Layout.
readonly property int radius: 12 readonly property int radius: 12
readonly property int radiusSmall: 8 readonly property int radiusSmall: 8
@ -29,12 +38,18 @@ QtObject {
readonly property int pad: 16 readonly property int pad: 16
readonly property int padLarge: 28 readonly property int padLarge: 28
// Control sizing follows the text scale so labels never clip.
readonly property int controlHeight: Math.round(42 * scale)
readonly property int controlHeightLarge: Math.round(46 * scale)
readonly property int controlHeightCompact: Math.round(34 * scale)
readonly property int rowHeight: Math.round(30 * scale)
// Type scale. // Type scale.
readonly property int fontDisplay: 30 readonly property int fontDisplay: Math.round(30 * scale)
readonly property int fontTitle: 22 readonly property int fontTitle: Math.round(22 * scale)
readonly property int fontHeading: 17 readonly property int fontHeading: Math.round(17 * scale)
readonly property int fontBody: 14 readonly property int fontBody: Math.round(14 * scale)
readonly property int fontSmall: 12 readonly property int fontSmall: Math.round(12 * scale)
readonly property string family: "DejaVu Sans, Noto Sans, sans-serif" readonly property string family: "DejaVu Sans, Noto Sans, sans-serif"
// Branding assets installed by the live build. // Branding assets installed by the live build.

File diff suppressed because it is too large Load diff

View file

@ -11,6 +11,10 @@ Modes:
gui : boot, log in on serial, verify the welcome/branding payload, open gui : boot, log in on serial, verify the welcome/branding payload, open
the installer from the welcome action, prove duplicate prevention, the installer from the welcome action, prove duplicate prevention,
walk the wizard steps and capture screenshots. walk the wizard steps and capture screenshots.
opencode: drive the OpenCode AI step through the real graphical UI and
validate a model response and proposal.
gui-install: complete a full installation through the visible wizard (AI
connection, disk, account, ERASE, install) on a disposable disk.
install : boot, log in on serial, fetch a non-interactive config and 0600 install : boot, log in on serial, fetch a non-interactive config and 0600
secrets over QEMU user networking, run the deterministic install secrets over QEMU user networking, run the deterministic install
with the static binary, scan the log for a secret leak, power off. with the static binary, scan the log for a secret leak, power off.
@ -59,12 +63,13 @@ BOOT_TIMEOUT = int(os.environ.get("BOOT_TIMEOUT", "900"))
INSTALL_TIMEOUT = int(os.environ.get("INSTALL_TIMEOUT", "10800")) INSTALL_TIMEOUT = int(os.environ.get("INSTALL_TIMEOUT", "10800"))
SESSION_SETTLE = int(os.environ.get("SESSION_SETTLE", "20")) SESSION_SETTLE = int(os.environ.get("SESSION_SETTLE", "20"))
BACKEND_SETTLE = int(os.environ.get("BACKEND_SETTLE", "30")) BACKEND_SETTLE = int(os.environ.get("BACKEND_SETTLE", "30"))
# OpenCode GUI-driving knobs (test-only). Tab counts assume the focus order: # OpenCode GUI-driving knobs (test-only). The wizard focuses the first AI
# Close, DeepSeek, OpenAI, Local, OpenCode, server, password, provider, model, # provider chip when the AI step opens, so three Tabs reach the OpenCode chip.
# Test, Connect, Back, Next. # After selecting it, the field order is server, password (with a keyboard
# reveal control), provider, model, load, Test, Connect.
OC_PORT = int(os.environ.get("OC_PORT", "4096")) OC_PORT = int(os.environ.get("OC_PORT", "4096"))
OC_TARGET_PORT = int(os.environ.get("OC_TARGET_PORT", "41999")) OC_TARGET_PORT = int(os.environ.get("OC_TARGET_PORT", "41999"))
OC_TAB_TO_CHIP = int(os.environ.get("OC_TAB_TO_CHIP", "5")) OC_TAB_TO_CHIP = int(os.environ.get("OC_TAB_TO_CHIP", "3"))
OC_PROVIDER = os.environ.get("OC_PROVIDER", "deepseek") OC_PROVIDER = os.environ.get("OC_PROVIDER", "deepseek")
OC_MODEL = os.environ.get("OC_MODEL", "deepseek-v4-flash") OC_MODEL = os.environ.get("OC_MODEL", "deepseek-v4-flash")
OC_USE_PASSWORD = os.environ.get("OC_USE_PASSWORD", "0") in ("1", "yes", "true") OC_USE_PASSWORD = os.environ.get("OC_USE_PASSWORD", "0") in ("1", "yes", "true")
@ -304,6 +309,8 @@ class Driver:
self.do_gui() self.do_gui()
elif self.mode == "opencode": elif self.mode == "opencode":
self.do_opencode() self.do_opencode()
elif self.mode == "gui-install":
self.do_gui_install()
elif self.mode == "install": elif self.mode == "install":
self.do_install() self.do_install()
elif self.mode == "boot": elif self.mode == "boot":
@ -492,10 +499,36 @@ class Driver:
f"n1={n1} n2={n2}", f"n1={n1} n2={n2}",
) )
# Keyboard-walk the wizard, capturing each step. # Keyboard-walk the wizard, capturing each step. The welcome step's
# primary action is focused, so Return starts the journey; Ctrl+Right
# then advances through the deterministic steps.
self.sendkey("ret")
time.sleep(2)
self.shot("03-language", "language and keyboard", "Return on Get started",
"the language and keyboard step is shown")
# Regression: the suggestion list supports arrow-key navigation and
# Enter selection, with the value stored being the identifier.
self.sendkey("ctrl-a")
time.sleep(0.3)
self.shell("wtype 'de_DE' >/dev/null 2>&1; echo TYPED", "TYPED",
timeout=30, label="type-locale")
time.sleep(1.0)
self.sendkey("down")
time.sleep(0.5)
self.sendkey("ret")
time.sleep(1.0)
picked = self._frontend_state()
self.results.assert_true(
"keyboard-suggestion-select",
picked is not None and picked["step"] == 1
and picked["locale"].startswith("de_DE"),
f"Down/Enter did not select the highlighted suggestion: {picked}",
)
self.shot("03b-locale-selected", "locale selected", "Down then Enter",
"the highlighted locale is selected")
for slug, state in [ for slug, state in [
("03-network", "network and prerequisites"), ("04-network", "network and prerequisites"),
("04-ai-model", "AI model connection"), ("05-ai-model", "AI model connection"),
]: ]:
self.sendkey("ctrl-right") self.sendkey("ctrl-right")
time.sleep(2) time.sleep(2)
@ -515,7 +548,7 @@ class Driver:
"the AI step allowed advancement without a connected model", "the AI step allowed advancement without a connected model",
) )
# Behavioral evidence from the frontend's own state lines: the wizard is # Behavioral evidence from the frontend's own state lines: the wizard is
# still on the AI step (index 2) and has not reported a connection, and # still on the AI step (index 3) and has not reported a connection, and
# it shows an inline error. A surviving process or a screenshot would # it shows an inline error. A surviving process or a screenshot would
# not prove any of this. # not prove any of this.
state = self._frontend_state() state = self._frontend_state()
@ -523,7 +556,7 @@ class Driver:
self.results.fail("ai-page-remains", "no frontend state line found") self.results.fail("ai-page-remains", "no frontend state line found")
else: else:
self.results.assert_true( self.results.assert_true(
"ai-page-remains", state["step"] == 2 and not state["aiConnected"], "ai-page-remains", state["step"] == 3 and not state["aiConnected"],
f"last state: {state}", f"last state: {state}",
) )
self.results.assert_true( self.results.assert_true(
@ -548,8 +581,14 @@ class Driver:
self.child.expect("STATE-END", timeout=30) self.child.expect("STATE-END", timeout=30)
except (pexpect.TIMEOUT, pexpect.EOF): except (pexpect.TIMEOUT, pexpect.EOF):
return None return None
step = ai = tested = None step = ai = tested = review = None
applied = 0 applied = 0
disk = ""
locale = ""
keymap = ""
phase = ""
confirmed = False
focus = ""
err = "" err = ""
for line in (self.child.before or "").splitlines(): for line in (self.child.before or "").splitlines():
if "phoebus-state" not in line: if "phoebus-state" not in line:
@ -557,15 +596,36 @@ class Driver:
match = re.search(r"step=(\d+)", line) match = re.search(r"step=(\d+)", line)
if match: if match:
step = int(match.group(1)) step = int(match.group(1))
match = re.search(r"phase=(\w+)", line)
if match:
phase = match.group(1)
match = re.search(r"aiConnected=(true|false)", line) match = re.search(r"aiConnected=(true|false)", line)
if match: if match:
ai = match.group(1) == "true" ai = match.group(1) == "true"
match = re.search(r"aiTested=(true|false)", line) match = re.search(r"aiTested=(true|false)", line)
if match: if match:
tested = match.group(1) == "true" tested = match.group(1) == "true"
match = re.search(r"aiReview=(true|false)", line)
if match:
review = match.group(1) == "true"
match = re.search(r"aiApplied=(\d+)", line) match = re.search(r"aiApplied=(\d+)", line)
if match: if match:
applied = int(match.group(1)) applied = int(match.group(1))
match = re.search(r"disk=(\S*)", line)
if match:
disk = match.group(1)
match = re.search(r"locale=(\S*)", line)
if match:
locale = match.group(1)
match = re.search(r"keymap=(\S*)", line)
if match:
keymap = match.group(1)
match = re.search(r"confirm=(true|false)", line)
if match:
confirmed = match.group(1) == "true"
match = re.search(r"focus=(\S*)", line)
if match:
focus = match.group(1)
match = re.search(r"aiError=(.*?) aiTest=", line) match = re.search(r"aiError=(.*?) aiTest=", line)
if match: if match:
err = match.group(1).strip() err = match.group(1).strip()
@ -573,9 +633,16 @@ class Driver:
return None return None
return { return {
"step": step, "step": step,
"phase": phase,
"aiConnected": bool(ai), "aiConnected": bool(ai),
"aiTested": bool(tested), "aiTested": bool(tested),
"aiApplied": applied, "aiApplied": applied,
"aiReview": bool(review),
"disk": disk,
"locale": locale,
"keymap": keymap,
"confirm": confirmed,
"focus": focus,
"aiError": err, "aiError": err,
} }
@ -639,19 +706,22 @@ class Driver:
"CLOSED", timeout=30, label="close-welcome", "CLOSED", timeout=30, label="close-welcome",
) )
# Navigate to the AI step (0 -> 1 -> 2). # Navigate to the AI step (welcome -> language -> network -> AI).
self.sendkey("ret")
time.sleep(2)
self.sendkey("ctrl-right") self.sendkey("ctrl-right")
time.sleep(2) time.sleep(2)
self.sendkey("ctrl-right") self.sendkey("ctrl-right")
time.sleep(2) time.sleep(2)
state = self._frontend_state() state = self._frontend_state()
self.results.assert_true( self.results.assert_true(
"ai-step-reached", state is not None and state["step"] == 2, "ai-step-reached", state is not None and state["step"] == 3,
f"frontend state: {state}", f"frontend state: {state}",
) )
self.shot("oc-01-ai", "AI step", "Ctrl+Right twice", "the AI model step is shown") self.shot("oc-01-ai", "AI step", "Return + Ctrl+Right twice", "the AI model step is shown")
# Select the "OpenCode agent" chip with the keyboard. # Select the "OpenCode agent" chip with the keyboard. The AI step opens
# with the first provider chip focused.
for _ in range(OC_TAB_TO_CHIP): for _ in range(OC_TAB_TO_CHIP):
self.sendkey("tab") self.sendkey("tab")
time.sleep(0.3) time.sleep(0.3)
@ -661,8 +731,8 @@ class Driver:
"server, password, provider and model fields appear") "server, password, provider and model fields appear")
# Enter the connection through the UI. Focus is on the chip after # Enter the connection through the UI. Focus is on the chip after
# selection; Tab order is server, password, provider, model, Test, # selection; Tab order is server, password (input + reveal), provider,
# Connect. Ctrl+A selects the existing default before typing. # model, load, Test. Ctrl+A selects the existing default before typing.
def type_field(tabs: int, value: str, secret_file: str | None = None) -> None: def type_field(tabs: int, value: str, secret_file: str | None = None) -> None:
# `wtype` (Wayland) and QEMU `sendkey` (hardware) are two input # `wtype` (Wayland) and QEMU `sendkey` (hardware) are two input
# paths; settle between them or the next key can truncate the text. # paths; settle between them or the next key can truncate the text.
@ -695,14 +765,19 @@ class Driver:
"PW-LOADED", timeout=30, label="fetch-password", "PW-LOADED", timeout=30, label="fetch-password",
) )
type_field(1, "", secret_file="/tmp/oc.pw") type_field(1, "", secret_file="/tmp/oc.pw")
self.sendkey("tab") # the keyboard reveal control
else: else:
self.sendkey("tab") # skip the empty password field self.sendkey("tab") # the empty password field
time.sleep(0.25)
self.sendkey("tab") # the keyboard reveal control
time.sleep(0.25) time.sleep(0.25)
type_field(1, OC_PROVIDER) type_field(1, OC_PROVIDER)
type_field(1, OC_MODEL) type_field(1, OC_MODEL)
self.shot("oc-02b-fields", "OpenCode fields", "typed server/provider/model", self.shot("oc-02b-fields", "OpenCode fields", "typed server/provider/model",
"the fields hold the entered values") "the fields hold the entered values")
self.sendkey("tab") # model -> Test self.sendkey("tab") # model -> load
time.sleep(0.3)
self.sendkey("tab") # load -> Test
time.sleep(0.3) time.sleep(0.3)
self.sendkey("ret") self.sendkey("ret")
time.sleep(3) time.sleep(3)
@ -732,8 +807,310 @@ class Driver:
"opencode-proposal-applied", "opencode-proposal-applied",
f"applied={connected['aiApplied']} change(s)", f"applied={connected['aiApplied']} change(s)",
) )
# Regression: editing the model must invalidate the green "validated"
# indicator, because the backend would require revalidation. Focus is
# on Connect; Shift+Tab walks back over Test and Load to the model.
for _ in range(3):
self.sendkey("shift-tab")
time.sleep(0.4)
self._gui_type(OC_MODEL + "-changed")
edited = self.wait_state(lambda s: not s["aiConnected"], timeout=30)
self.results.assert_true(
"ai-invalidated-on-model-edit", edited is not None,
"editing the model left the AI connection green",
)
self.results.pass_("opencode-gui-completed") self.results.pass_("opencode-gui-completed")
# -- full graphical installation --------------------------------------
_PLAIN_KEYS = {
" ": "spc", "-": "minus", "=": "equal", "[": "bracketleft",
"]": "bracketright", "\\": "backslash", ";": "semicolon",
"'": "apostrophe", ",": "comma", ".": "dot", "/": "slash", "`": "grave",
}
_SHIFT_KEYS = {
"_": "minus", "+": "equal", ":": "semicolon", '"': "apostrophe",
"<": "comma", ">": "dot", "?": "slash", "{": "bracketleft",
"}": "bracketright", "|": "backslash", "~": "grave",
}
def _tabs(self, count: int) -> None:
for _ in range(count):
self.sendkey("tab")
time.sleep(0.4)
def _send_chars(self, text: str) -> None:
"""Type text as hardware key events.
The QEMU/HMP `wtype` path used by `opencode` mode can leave the
compositor focus ambiguous. The full-install journey types every field
with real key events so focus is always exactly the focused control.
"""
for ch in text:
if ch.isalpha():
self.sendkey(ch if ch.islower() else "shift-" + ch.lower())
elif ch.isdigit():
self.sendkey(ch)
elif ch in self._PLAIN_KEYS:
self.sendkey(self._PLAIN_KEYS[ch])
elif ch in self._SHIFT_KEYS:
self.sendkey("shift-" + self._SHIFT_KEYS[ch])
else:
raise HarnessError(f"no QEMU key for character {ch!r}")
time.sleep(0.1)
def _gui_type(self, value: str) -> None:
self.sendkey("ctrl-a")
time.sleep(0.3)
self._send_chars(value)
time.sleep(1.0)
def _accept_ai_review(self, applied: int):
"""Accept a proposed-change review if one was applied.
The Accept button follows Connect (and possibly the conditional Retry
button), so try a few Tab/Return pairs and stop as soon as the review
is accepted.
"""
if applied <= 0:
return True
for _ in range(4):
self.sendkey("tab")
time.sleep(0.4)
self.sendkey("ret")
time.sleep(1.5)
state = self._frontend_state()
if state is not None and state["aiReview"]:
return True
return False
def do_gui_install(self) -> None:
"""Complete installation through the visible wizard.
`appliance-guest-gui.sh` installs non-interactively, which does not
prove the graphical journey. This mode presses the real controls: it
connects OpenCode through the UI, accepts the reviewed AI changes,
selects a disk, sets the account, types ERASE, installs, and checks the
frontend reports completion. The disk must be a disposable qcow2.
"""
if not self.disks:
self.results.blocked("gui-install-disk", "no writable disk configured")
return
self.spawn(attach_iso=True, boot_disk=False)
self.login_live()
welcome = self.poll_shell(
"echo WELCOME=$(pgrep -fc 'quickshell.*phoebus-welcome' 2>/dev/null || echo 0)",
r"WELCOME=([1-9][0-9]*)",
timeout=int(os.environ.get("WELCOME_TIMEOUT", "180")),
label="welcome-window",
)
self.results.assert_true("welcome-autostarted", welcome is not None, "welcome did not appear")
self.set_wayland()
# Preseed the wizard defaults so the run is bounded (safe kernel, no
# desktop) while the wizard, validation, AI gate and ERASE confirmation
# remain the real graphical path.
self.shell(
f"curl -fsSL {SERVE_URL}/test.conf -o /tmp/gui-install.conf && "
"sudo -n install -D -m 0644 /tmp/gui-install.conf /etc/phoebus/install.conf && "
"echo PRESEED-$(printf DONE)",
"PRESEED-DONE", timeout=60, label="preseed-config",
)
# Start the loopback relay to the host OpenCode server.
self.shell(
f"curl -fsSL {SERVE_URL}/oc-forward.py -o /tmp/oc-forward.py && "
f"chmod 755 /tmp/oc-forward.py && "
f"setsid python3 /tmp/oc-forward.py {OC_PORT} 10.0.2.2 {OC_TARGET_PORT} "
f">/tmp/oc-forward.log 2>&1 < /dev/null & echo FWD-$(printf START)",
"FWD-START", timeout=60, label="forwarder-start",
)
ready = self.poll_shell(
f"curl -s -m 5 -o /dev/null -w 'HEALTH=%{{http_code}}' "
f"http://127.0.0.1:{OC_PORT}/global/health",
r"HEALTH=(200|401)", timeout=60, label="forwarder-ready",
)
self.results.assert_true(
"opencode-reachable-from-guest", ready is not None,
"the guest relay could not reach the OpenCode server",
)
# Launch the installer from the welcome action.
self.sendkey("ret")
opened = self.poll_shell(
"echo INST=$(pgrep -fc 'quickshell.*phoebus-install' 2>/dev/null || echo 0)",
r"INST=([1-9][0-9]*)", timeout=int(os.environ.get("INSTALLER_OPEN_TIMEOUT", "90")),
label="launcher-opens-installer",
)
self.results.assert_true("launcher-opens-installer", opened is not None,
"welcome action did not open the installer")
time.sleep(BACKEND_SETTLE)
self.shell(
"pkill -f 'quickshell.*phoebus-wel[c]ome' || true; sleep 2; echo CLOSED",
"CLOSED", timeout=30, label="close-welcome",
)
# Welcome -> language -> network -> AI.
self.sendkey("ret")
time.sleep(2)
self.sendkey("ctrl-right")
time.sleep(2)
self.sendkey("ctrl-right")
time.sleep(3)
state = self._frontend_state()
self.results.assert_true("gui-install-ai-step", state is not None and state["step"] == 3,
f"AI step not reached: {state}")
self.shot("gi-01-ai", "AI step", "Return, Ctrl+Right twice", "AI connection step")
# Select OpenCode and connect through the UI.
for _ in range(OC_TAB_TO_CHIP):
self.sendkey("tab")
time.sleep(0.3)
self.sendkey("ret")
time.sleep(1)
self._tabs(1) # chip -> server
self._gui_type(f"http://127.0.0.1:{OC_PORT}")
self.sendkey("tab") # server -> password
self.sendkey("tab") # password -> reveal
self._tabs(1) # reveal -> provider
self._gui_type(OC_PROVIDER)
self._tabs(1) # provider -> model
self._gui_type(OC_MODEL)
self.sendkey("tab") # model -> load
self.sendkey("tab") # load -> Test
self.sendkey("ret")
tested = self.wait_state(lambda s: s["aiTested"], timeout=300)
self.results.assert_true("gui-install-ai-tested", tested is not None,
"Test connection did not succeed")
self.sendkey("tab") # Test -> Connect
self.sendkey("ret")
connected = self.wait_state(lambda s: s["aiConnected"], timeout=240)
self.results.assert_true("gui-install-ai-connected", connected is not None,
f"Connect and validate failed: {connected}")
applied = connected["aiApplied"] if connected else 0
self.results.assert_true(
"gui-install-ai-reviewed", self._accept_ai_review(applied),
"the AI review could not be accepted",
)
self.shot("gi-02-ai-reviewed", "AI reviewed", "Accept changes", "review accepted")
# Destination disk: pick the first selectable disk.
self.sendkey("ctrl-right")
time.sleep(3)
self.sendkey("tab")
time.sleep(0.5)
self.sendkey("ret")
time.sleep(1)
state = self._frontend_state()
self.results.assert_true(
"gui-install-disk-selected", state is not None and state["disk"] != "",
f"no destination disk was selected: {state}",
)
self.shot("gi-03-disk", "disk selected", "Tab and Return on the first disk",
"a destination disk is selected")
# Regression: re-checking network readiness from the network step must
# not reset the wizard or clear the chosen disk, and unrelated
# navigation must preserve the validated AI connection.
selected = state["disk"]
self.sendkey("ctrl-left") # disk -> AI
time.sleep(1.5)
self.sendkey("ctrl-left") # AI -> network
time.sleep(1.5)
before = self._frontend_state()
self.results.assert_true(
"back-nav-preserves-ai", before is not None and before["aiConnected"],
f"back-navigation lost the AI validation: {before}",
)
self.sendkey("ret") # Re-check (focused when the network step opens)
time.sleep(4)
after = self._frontend_state()
self.results.assert_true(
"readiness-refresh-preserves-wizard",
after is not None and after["step"] == 2 and after["disk"] == selected,
f"re-check reset the wizard or cleared the disk: before={before} after={after}",
)
# Walk forward again; the disk selection must still be present.
self.sendkey("ctrl-right") # network -> AI
time.sleep(2)
self.sendkey("ctrl-right") # AI -> disk
time.sleep(3)
state = self._frontend_state()
self.results.assert_true(
"disk-survives-backtrack",
state is not None and state["step"] == 4 and state["disk"] == selected,
f"the disk selection did not survive backtracking: {state}",
)
# Account and encryption.
self.sendkey("ctrl-right")
time.sleep(2)
state = self._frontend_state()
self.results.assert_true("gui-install-account-step", state is not None and state["step"] == 5,
f"account step not reached: {state}")
self._tabs(3) # full name -> username -> computer name -> password
self._gui_type(USER_PW)
self._tabs(2) # reveal -> confirm password
self._gui_type(USER_PW)
self._tabs(2) # reveal -> passphrase
self._gui_type(LUKS_PW)
self._tabs(2) # reveal -> confirm passphrase
self._gui_type(LUKS_PW)
self.shot("gi-04-account", "account and encryption", "typed credentials",
"password and passphrase entered")
# Review and ERASE. The review step focuses the ERASE field.
self.sendkey("ctrl-right")
time.sleep(4)
state = self._frontend_state()
self.results.assert_true("gui-install-review-step", state is not None and state["step"] == 6,
f"review step not reached: {state}")
self.shot("gi-05-review", "review and confirmation", "review shown",
"backend facts, plan and ERASE confirmation")
self._gui_type("ERASE")
self.sendkey("tab") # the confirmation toggle
time.sleep(0.4)
confirmed = self._frontend_state()
# The toggle responds to Return and Space; QEMU names Space `spc`.
for key in ("ret", "spc"):
if confirmed is not None and confirmed["confirm"]:
break
self.sendkey(key)
time.sleep(0.5)
confirmed = self._frontend_state()
if confirmed is None or not confirmed["confirm"]:
self.results.fail(
"gui-install-erase-confirmed",
f"the confirmation toggle was not ticked: {confirmed}",
)
return
self.results.pass_("gui-install-erase-confirmed")
self.sendkey("ctrl-right") # authorize and install
self.shot("gi-06-installing", "installing", "Ctrl+Right on review",
"the installation has started")
done = self.wait_state(
lambda s: s["phase"] in ("done", "failed"),
timeout=INSTALL_TIMEOUT,
)
if done is None:
self.results.fail("gui-install-completes", "the wizard did not report completion")
return
self.results.assert_true(
"gui-install-completes", done["phase"] == "done",
f"the installer reported failure: {done}",
)
self.shot("gi-07-complete", "completion", "installation finished",
"the completion screen is shown")
if done["phase"] == "done":
self.results.pass_("gui-install-journey")
# Power off cleanly so the installed disk is flushed for the boot mode.
self.shell("sudo -n systemctl poweroff >/dev/null 2>&1 || true; echo POW",
"POW", timeout=60, label="poweroff")
try:
self.child.expect(pexpect.EOF, timeout=300)
except (pexpect.TIMEOUT, pexpect.EOF):
pass
def _installer_alive(self) -> bool: def _installer_alive(self) -> bool:
assert self.child is not None assert self.child is not None
self.child.sendline( self.child.sendline(
@ -862,10 +1239,10 @@ class Driver:
def main() -> int: def main() -> int:
mode = sys.argv[1] if len(sys.argv) > 1 else "" mode = sys.argv[1] if len(sys.argv) > 1 else ""
if mode not in ("gui", "opencode", "install", "boot"): if mode not in ("gui", "opencode", "gui-install", "install", "boot"):
print(__doc__) print(__doc__)
return 2 return 2
if mode in ("install", "boot") and not DISKS: if mode in ("install", "boot", "gui-install") and not DISKS:
print("error: DISK/DISKS must name a disposable qcow2 image", file=sys.stderr) print("error: DISK/DISKS must name a disposable qcow2 image", file=sys.stderr)
return 2 return 2
try: try: