Compare commits

..

No commits in common. "1106bcaa0af9a1adb01859be1fc8da435eb989b4" and "4679f935e3f02ec2a25406c80b9f173ee52c9765" have entirely different histories.

15 changed files with 401 additions and 2207 deletions

View file

@ -5,88 +5,6 @@ this file is the curated, human-readable summary.
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
Correctness work on the deterministic `sys` broker and the assistant path that

View file

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

View file

@ -64,8 +64,8 @@ still not VM-verified.
| Locale/timezone/keymap/services | yes | yes | yes | n/a |
| Rust VM boot parity | yes | yes | yes | no |
| Rust TUI | yes | yes | smoke test | no |
| Typed GUI bridge (`--gui-bridge`) | yes | yes (dry-run) | live VM + full journey | n/a |
| Graphical welcome + install wizard (Quickshell) | yes | yes | live graphical VM + full GUI journey | no |
| Typed GUI bridge (`--gui-bridge`) | yes | yes (dry-run) | live VM | n/a |
| Graphical welcome + install wizard (Quickshell) | yes | guards tested | live graphical VM | no |
| Phoebus brand system (SVG + tokens) | yes | yes | live VM | n/a |
| Desktop profile (dwl/waybar/mako/swaybg) | yes | partial | headless only | no |
| Desktop session script (socket wait, polkit, cleanup) | yes | yes | functional test (stubs) | no |
@ -106,8 +106,7 @@ still not VM-verified.
| 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 in GUI / CLI / `sys ask` | yes | yes | GUI AI step + `sys ask` live | 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 |
| OpenCode full graphical install | yes | yes | AI gate passed; install not run | 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 |
| Release gates + atomic publish | yes | yes | no | n/a |
@ -152,25 +151,20 @@ still not VM-verified.
rootfs with Mango + DMS, live-only autologin, a branded welcome window and a
graphical installer frontend over the typed bridge. Its desktop-payload
guards are unit-tested. The rebuilt ISO
(`sha256 0c386a1b…`, 1.6 GiB, build id in `/etc/phoebus/build`) was booted in
a graphical, seat-providing VM. The `gui` journey passed **28/28** checks
(welcome autostart, launcher from the keyboard, duplicate prevention, the live
medium protected, keyboard suggestion selection, the network and AI steps,
the AI gate refused without a model and reported inline, no bridge errors) and
the `opencode` journey passed **18/18** (real model response, validated
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
(`sha256 428dbd75…`, 1.6 GiB, build id in `/etc/phoebus/build`) was booted in
a graphical, seat-providing VM and the automated `gui` journey passed
**23/23** checks: the welcome window opened automatically, "Install Phoebus
OS" launched the installer from the keyboard, a second launch created no
duplicate, the live medium was reported protected, keyboard navigation
reached the network and AI steps, and advancing without a connected model was
refused. An earlier appliance build of the same code path was installed
non-interactively (`INSTALL-RC=0`, `NO_SECRET_LEAK`) and booted **with the
ISO detached** (systemd running, 0 failed units, LUKS2, all Btrfs subvolumes,
network). The **installed** Mango system (GURU + compiled Quickshell/DMS) and
the dwl fallback in a VM are not yet verified.
network). A live AI provider call was **not** possible (no key and no local
model in this environment), so the **full graphical install past the AI step**
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
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

View file

@ -36,9 +36,8 @@ installer CLI and `sys ask`. Defects found while implementing and testing:
- **Test connection** obtained a real model response (green "Model responded");
- **Connect and validate** obtained and validated a proposal (green "Validated",
frontend state `aiConnected=true`);
- run `gui-opencode-20260922T192457Z-01714c92`: **18/18 PASS**, exit 0; the full
GUI regression `gui-gui-20260922T191954Z-876d5e91` was **28/28 PASS** (both on
the final ISO `sha256 0c386a1b…`).
- run `gui-opencode-20260922T102640Z-be168813`: **17/17 PASS**, exit 0; the full
GUI regression `gui-gui-20260922T102907Z-a9e5e824` was **25/25 PASS**.
- The model is reached through a guest-loopback relay to the host OpenCode
server (the SSH-tunnel shape), so the transport policy is satisfied.
- Authenticated server: the same harness with a password-protected server got
@ -46,31 +45,11 @@ installer CLI and `sys ask`. Defects found while implementing and testing:
was correctly rejected. Use `deepseek-flash` (reliable) over
`deepseek-v4-flash` (occasionally malformed).
### Graphical journey: interaction defects fixed (2026-09-22)
| ID | Defect | Fix | Test |
|----|--------|-----|------|
| 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.
Still **NOT RUN**: the full graphical installation (disk → account → review →
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
installation. Two fresh-disk graphical installs and a separate physical machine
remain unverified.
### User trial findings (interactive VM, 2026-09-22)

View file

@ -597,43 +597,6 @@ A host-local OpenCode transport test also ran: `phoebus-installer
forwarded second loopback endpoint, and `authentication_required` (exit 1)
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
- The graphical session was verified with the **headless** wlroots backend
@ -647,15 +610,13 @@ re-verified on the final ISO.
- Desktop USE still does not match the signed binhost, so the desktop
transaction compiles a large amount from source (~26 minutes for the desktop
package set on 8 vCPUs in the test VM).
- **The complete graphical install and detached boot are BLOCKED on host build
time.** The `gui-install` harness now drives the real controls and passes every
journey assertion on a fresh qcow2 (AI connect/review/accept, disk, account,
ERASE, confirmation) and starts a real install, but on this host the
base-package stage takes ~116 min and the AI-selected optimized kernel was
still compiling after 100 min, so a four-hour harness timeout fired during
`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.
- **The full graphical install past the AI step is NOT verified.** No live
provider key and no downloadable local model were available in this
environment, and normal installation requires a connected model by design;
the automated journey stops at (and verifies) the blocked AI prerequisite.
Two fresh-disk graphical installations from the final candidate remain
unrun. The deterministic noninteractive install + detached boot remains the
proven boot path.
- **A separate physical computer for the OpenCode transport test is NOT
available**; that check is BLOCKED. The forwarded-hop and
unauthenticated-LAN-refusal tests are host-local.

View file

@ -258,7 +258,6 @@ impl Bridge {
let op = request.op.clone();
let result = match request.op.as_str() {
"handshake" => self.handshake(),
"readiness" => self.readiness(),
"options" => self.options(),
"ai_catalog" => self.ai_catalog(),
"disks" => self.disks(),
@ -284,22 +283,10 @@ impl Bridge {
out,
&json!({ "id": id, "ok": true, "op": op, "data": data }),
),
Err(error) => {
// AI connection failures carry a stable, machine-readable kind
// 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)
}
Err(error) => write_json(
out,
&json!({ "id": id, "ok": false, "op": op, "error": error }),
),
}
}
@ -322,44 +309,19 @@ impl Bridge {
"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(),
},
"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
/// live system means the user picks from the real timezones, locales and
/// keymaps instead of typing them from memory.
fn options(&self) -> Result<Value, String> {
Ok(json!({
"timezones": labeled_options(system_timezones(), humanize_timezone),
"locales": labeled_options(system_locales(), humanize_locale),
"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(),
"timezones": system_timezones(),
"locales": system_locales(),
"keymaps": system_keymaps(),
}))
}
@ -987,337 +949,6 @@ 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 {
if let Ok(text) = std::fs::read_to_string("/etc/phoebus/version") {
let t = text.trim();
@ -1747,33 +1378,7 @@ fn review_proposal(
/// The stdio entry point used by `--gui-bridge`.
pub fn run_stdio() -> io::Result<()> {
// 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()
}
};
let mut config = InstallConfig::default();
// 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
// authorization requirements.
@ -2493,92 +2098,4 @@ mod tests {
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,7 +16,6 @@ Singleton {
property string lastError: ""
property var handshake: null
property var config: null
property bool restarting: false
property var pending: ({})
property int nextId: 1
@ -24,10 +23,6 @@ Singleton {
signal event(string name, var data)
signal availabilityChanged
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: {
const override = Quickshell.env("PHOEBUS_BRIDGE_CMD");
@ -47,16 +42,6 @@ Singleton {
onTriggered: root.refreshHandshake(null)
}
Timer {
id: restartTimer
interval: 500
repeat: false
onTriggered: {
root.start();
root.restarting = false;
}
}
function start() {
if (!proc.running)
proc.running = true;
@ -66,33 +51,6 @@ Singleton {
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) {
const id = root.nextId++;
if (onDone)
@ -105,7 +63,7 @@ Singleton {
delete root.pending[id];
root.lastError = "backend not running";
if (onDone)
onDone({ ok: false, error: "the installer backend is not running", error_kind: "backend_gone" });
onDone({ ok: false, error: "the installer backend is not running" });
return;
}
proc.write(line);
@ -147,9 +105,6 @@ Singleton {
function listDisks(cb) {
call("disks", {}, cb);
}
function readiness(cb) {
call("readiness", {}, cb);
}
function options(cb) {
call("options", {}, cb);
}
@ -209,14 +164,10 @@ Singleton {
root.availabilityChanged();
}
onExited: exitCode => {
const wasRunning = root.ready;
root.ready = false;
root.crashed = true;
root.crashMessage = "The installer backend stopped (exit " + exitCode + ").";
root.failPending("the installer backend stopped before answering");
root.availabilityChanged();
if (wasRunning && !root.restarting)
root.backendLost(root.crashMessage);
}
stdout: SplitParser {
onRead: line => root.handleLine(line)

View file

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

View file

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

View file

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

View file

@ -1,9 +1,6 @@
import QtQuick
// 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 {
id: field
@ -12,29 +9,15 @@ Column {
property string error: ""
property bool secret: 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 inputItem: input
property int maxLength: 256
signal edited(string value)
signal accepted
signal keyUp
signal keyDown
signal keyEscape
width: parent ? parent.width : implicitWidth
spacing: 6
function forceFocus() {
input.forceActiveFocus();
}
Text {
width: parent.width
text: field.label
@ -47,7 +30,7 @@ Column {
Rectangle {
width: parent.width
height: Theme.controlHeight
height: 42
radius: Theme.radiusSmall
color: Theme.charcoal
border.width: input.activeFocus ? 2 : 1
@ -59,7 +42,7 @@ Column {
id: input
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: field.secret ? 52 : 12
anchors.rightMargin: 44
verticalAlignment: TextInput.AlignVCenter
color: Theme.warmWhite
font.family: Theme.family
@ -72,34 +55,8 @@ Column {
activeFocusOnTab: true
maximumLength: field.maxLength
clip: true
Accessible.role: Accessible.EditableText
Accessible.name: field.label.length > 0 ? field.label : field.placeholder
Accessible.description: field.error
onTextEdited: field.edited(text)
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;
}
onAccepted: field.accepted()
Text {
anchors.fill: parent
@ -112,51 +69,20 @@ Column {
}
}
// 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
Text {
anchors.right: parent.right
anchors.rightMargin: 10
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
width: 40
height: 26
visible: field.secret
activeFocusOnTab: field.secret
Accessible.role: Accessible.Button
Accessible.name: field.showSecret ? "Hide " + field.label : "Show " + field.label
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
}
text: field.showSecret ? "hide" : "show"
color: Theme.amber
font.family: Theme.family
font.pixelSize: Theme.fontSmall
MouseArea {
anchors.fill: parent
anchors.margins: -6
cursorShape: Qt.PointingHandCursor
onClicked: reveal.toggle()
onClicked: field.showSecret = !field.showSecret
}
}
}

View file

@ -16,19 +16,12 @@ Item {
Accessible.name: label
Accessible.checked: checked
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() {
Keys.onSpacePressed: {
toggle.checked = !toggle.checked;
toggle.toggled(toggle.checked);
}
Keys.onReturnPressed: Keys.onSpacePressed(event)
Keys.onEnterPressed: Keys.onSpacePressed(event)
Column {
anchors.left: parent.left

View file

@ -1,6 +1,5 @@
pragma Singleton
import QtQuick
import Quickshell
// Phoebus brand tokens. Kept in sync with phoebus_core::brand::PALETTE by a
// Rust test, so the QML frontend and the backend cannot drift.
@ -23,14 +22,6 @@ QtObject {
readonly property color focusRing: amber
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.
readonly property int radius: 12
readonly property int radiusSmall: 8
@ -38,18 +29,12 @@ QtObject {
readonly property int pad: 16
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.
readonly property int fontDisplay: Math.round(30 * scale)
readonly property int fontTitle: Math.round(22 * scale)
readonly property int fontHeading: Math.round(17 * scale)
readonly property int fontBody: Math.round(14 * scale)
readonly property int fontSmall: Math.round(12 * scale)
readonly property int fontDisplay: 30
readonly property int fontTitle: 22
readonly property int fontHeading: 17
readonly property int fontBody: 14
readonly property int fontSmall: 12
readonly property string family: "DejaVu Sans, Noto Sans, sans-serif"
// Branding assets installed by the live build.

File diff suppressed because it is too large Load diff

View file

@ -11,10 +11,6 @@ Modes:
gui : boot, log in on serial, verify the welcome/branding payload, open
the installer from the welcome action, prove duplicate prevention,
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
secrets over QEMU user networking, run the deterministic install
with the static binary, scan the log for a secret leak, power off.
@ -63,13 +59,12 @@ BOOT_TIMEOUT = int(os.environ.get("BOOT_TIMEOUT", "900"))
INSTALL_TIMEOUT = int(os.environ.get("INSTALL_TIMEOUT", "10800"))
SESSION_SETTLE = int(os.environ.get("SESSION_SETTLE", "20"))
BACKEND_SETTLE = int(os.environ.get("BACKEND_SETTLE", "30"))
# OpenCode GUI-driving knobs (test-only). The wizard focuses the first AI
# provider chip when the AI step opens, so three Tabs reach the OpenCode chip.
# After selecting it, the field order is server, password (with a keyboard
# reveal control), provider, model, load, Test, Connect.
# OpenCode GUI-driving knobs (test-only). Tab counts assume the focus order:
# Close, DeepSeek, OpenAI, Local, OpenCode, server, password, provider, model,
# Test, Connect, Back, Next.
OC_PORT = int(os.environ.get("OC_PORT", "4096"))
OC_TARGET_PORT = int(os.environ.get("OC_TARGET_PORT", "41999"))
OC_TAB_TO_CHIP = int(os.environ.get("OC_TAB_TO_CHIP", "3"))
OC_TAB_TO_CHIP = int(os.environ.get("OC_TAB_TO_CHIP", "5"))
OC_PROVIDER = os.environ.get("OC_PROVIDER", "deepseek")
OC_MODEL = os.environ.get("OC_MODEL", "deepseek-v4-flash")
OC_USE_PASSWORD = os.environ.get("OC_USE_PASSWORD", "0") in ("1", "yes", "true")
@ -309,8 +304,6 @@ class Driver:
self.do_gui()
elif self.mode == "opencode":
self.do_opencode()
elif self.mode == "gui-install":
self.do_gui_install()
elif self.mode == "install":
self.do_install()
elif self.mode == "boot":
@ -499,36 +492,10 @@ class Driver:
f"n1={n1} n2={n2}",
)
# 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")
# Keyboard-walk the wizard, capturing each step.
for slug, state in [
("04-network", "network and prerequisites"),
("05-ai-model", "AI model connection"),
("03-network", "network and prerequisites"),
("04-ai-model", "AI model connection"),
]:
self.sendkey("ctrl-right")
time.sleep(2)
@ -548,7 +515,7 @@ class Driver:
"the AI step allowed advancement without a connected model",
)
# Behavioral evidence from the frontend's own state lines: the wizard is
# still on the AI step (index 3) and has not reported a connection, and
# still on the AI step (index 2) and has not reported a connection, and
# it shows an inline error. A surviving process or a screenshot would
# not prove any of this.
state = self._frontend_state()
@ -556,7 +523,7 @@ class Driver:
self.results.fail("ai-page-remains", "no frontend state line found")
else:
self.results.assert_true(
"ai-page-remains", state["step"] == 3 and not state["aiConnected"],
"ai-page-remains", state["step"] == 2 and not state["aiConnected"],
f"last state: {state}",
)
self.results.assert_true(
@ -581,14 +548,8 @@ class Driver:
self.child.expect("STATE-END", timeout=30)
except (pexpect.TIMEOUT, pexpect.EOF):
return None
step = ai = tested = review = None
step = ai = tested = None
applied = 0
disk = ""
locale = ""
keymap = ""
phase = ""
confirmed = False
focus = ""
err = ""
for line in (self.child.before or "").splitlines():
if "phoebus-state" not in line:
@ -596,36 +557,15 @@ class Driver:
match = re.search(r"step=(\d+)", line)
if match:
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)
if match:
ai = match.group(1) == "true"
match = re.search(r"aiTested=(true|false)", line)
if match:
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)
if match:
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)
if match:
err = match.group(1).strip()
@ -633,16 +573,9 @@ class Driver:
return None
return {
"step": step,
"phase": phase,
"aiConnected": bool(ai),
"aiTested": bool(tested),
"aiApplied": applied,
"aiReview": bool(review),
"disk": disk,
"locale": locale,
"keymap": keymap,
"confirm": confirmed,
"focus": focus,
"aiError": err,
}
@ -706,22 +639,19 @@ class Driver:
"CLOSED", timeout=30, label="close-welcome",
)
# Navigate to the AI step (welcome -> language -> network -> AI).
self.sendkey("ret")
time.sleep(2)
# Navigate to the AI step (0 -> 1 -> 2).
self.sendkey("ctrl-right")
time.sleep(2)
self.sendkey("ctrl-right")
time.sleep(2)
state = self._frontend_state()
self.results.assert_true(
"ai-step-reached", state is not None and state["step"] == 3,
"ai-step-reached", state is not None and state["step"] == 2,
f"frontend state: {state}",
)
self.shot("oc-01-ai", "AI step", "Return + Ctrl+Right twice", "the AI model step is shown")
self.shot("oc-01-ai", "AI step", "Ctrl+Right twice", "the AI model step is shown")
# Select the "OpenCode agent" chip with the keyboard. The AI step opens
# with the first provider chip focused.
# Select the "OpenCode agent" chip with the keyboard.
for _ in range(OC_TAB_TO_CHIP):
self.sendkey("tab")
time.sleep(0.3)
@ -731,8 +661,8 @@ class Driver:
"server, password, provider and model fields appear")
# Enter the connection through the UI. Focus is on the chip after
# selection; Tab order is server, password (input + reveal), provider,
# model, load, Test. Ctrl+A selects the existing default before typing.
# selection; Tab order is server, password, provider, model, Test,
# Connect. Ctrl+A selects the existing default before typing.
def type_field(tabs: int, value: str, secret_file: str | None = None) -> None:
# `wtype` (Wayland) and QEMU `sendkey` (hardware) are two input
# paths; settle between them or the next key can truncate the text.
@ -765,19 +695,14 @@ class Driver:
"PW-LOADED", timeout=30, label="fetch-password",
)
type_field(1, "", secret_file="/tmp/oc.pw")
self.sendkey("tab") # the keyboard reveal control
else:
self.sendkey("tab") # the empty password field
time.sleep(0.25)
self.sendkey("tab") # the keyboard reveal control
self.sendkey("tab") # skip the empty password field
time.sleep(0.25)
type_field(1, OC_PROVIDER)
type_field(1, OC_MODEL)
self.shot("oc-02b-fields", "OpenCode fields", "typed server/provider/model",
"the fields hold the entered values")
self.sendkey("tab") # model -> load
time.sleep(0.3)
self.sendkey("tab") # load -> Test
self.sendkey("tab") # model -> Test
time.sleep(0.3)
self.sendkey("ret")
time.sleep(3)
@ -807,310 +732,8 @@ class Driver:
"opencode-proposal-applied",
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")
# -- 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:
assert self.child is not None
self.child.sendline(
@ -1239,10 +862,10 @@ class Driver:
def main() -> int:
mode = sys.argv[1] if len(sys.argv) > 1 else ""
if mode not in ("gui", "opencode", "gui-install", "install", "boot"):
if mode not in ("gui", "opencode", "install", "boot"):
print(__doc__)
return 2
if mode in ("install", "boot", "gui-install") and not DISKS:
if mode in ("install", "boot") and not DISKS:
print("error: DISK/DISKS must name a disposable qcow2 image", file=sys.stderr)
return 2
try: