test(vm): record static-binary install and detached boot evidence

The committed harness now installs with the static Rust binary and boots the
disk detached: systemd PID1, running, 0 failed units, LUKS2 unlock, login and
networking. Also fixes the boot check marker so expect() does not match the
shell's echoed command.
This commit is contained in:
Phoebus 2026-09-20 03:54:53 -07:00
parent f984b01cfc
commit 54701bd1ef
4 changed files with 91 additions and 20 deletions

View file

@ -325,9 +325,9 @@ exit gate has been run and recorded.
| Phase | Scope | Status | Exit-gate evidence |
| ----- | ----- | ------ | ------------------ |
| 0 | Preserve and instrument | TODO | |
| 1 | Close product gaps (opencode) | TODO | |
| 2 | VM harness on the Rust binary | TODO | |
| 0 | Preserve and instrument | VERIFIED | tag `v0.1.0-bash-reference`; parity 1 passed; `cli_coverage` failed only on `--bootstrap-opencode` (`fb8bdfd`) |
| 1 | Close product gaps (opencode) | VERIFIED | `cargo test --workspace`: opencode 7 passed, `cli_coverage` 2 passed, clippy rc 0 (`4071c7d`) |
| 2 | VM harness on the Rust binary | VERIFIED | static-binary install `INSTALL-RC=0` + detached boot (systemd PID1, running, 0 failed units, LUKS, login) |
| 3 | Retire the tests | TODO | |
| 4 | Delete the Bash tree | TODO | |
| 5 | Developer tooling (optional) | TODO | |
@ -336,21 +336,21 @@ exit gate has been run and recorded.
| ID | Task | Status | Blocker (if any) | Evidence |
| -- | ---- | ------ | ---------------- | -------- |
| 0.1 | Tag `v0.1.0-bash-reference` | TODO | | |
| 0.2 | Parity test baseline | TODO | | |
| 0.3 | Rust CLI-coverage test | TODO | | |
| 0.4 | Relocate `opencode.manifest` | TODO | | |
| 1.1 | `phoebus-executor::opencode` | TODO | | |
| 1.2 | Opencode unit tests | TODO | | |
| 1.3 | `--bootstrap-opencode` flag | TODO | | |
| 1.4 | Port/justify remaining CLI surface | TODO | | |
| 1.5 | Confirm `sys` covers `ai.sh` | TODO | | |
| 2.1 | Static binary build | TODO | | |
| 2.2 | Guest script uses Rust binary | TODO | | |
| 2.3 | Harness docs updated | TODO | | |
| 2.4 | VM install with Rust binary | TODO | | |
| 2.5 | VM detached boot | TODO | | |
| 2.6 | Boot evidence recorded | TODO | | |
| 0.1 | Tag `v0.1.0-bash-reference` | VERIFIED | | `git tag --list 'v0.1.0-bash-reference'` -> the tag (`ec88d65`) |
| 0.2 | Parity test baseline | VERIFIED | | `cargo test -p phoebus-installer --test parity` -> 1 passed (`fb8bdfd`) |
| 0.3 | Rust CLI-coverage test | VERIFIED | | before: failed only `--bootstrap-opencode` (assert at `cli_coverage.rs:57`); after 1.3: 2 passed (`4071c7d`) |
| 0.4 | Relocate `opencode.manifest` | VERIFIED | | `crates/phoebus-installer/resources/opencode.manifest`; `relocated_opencode_manifest... ok` (`fb8bdfd`) |
| 1.1 | `phoebus-executor::opencode` | VERIFIED | | `crates/phoebus-executor/src/opencode.rs` (`4071c7d`) |
| 1.2 | Opencode unit tests | VERIFIED | | `cargo test -p phoebus-executor opencode` -> 7 passed (`4071c7d`) |
| 1.3 | `--bootstrap-opencode` flag | VERIFIED | | `cli_coverage` 2 passed; CLI smoke: `OpenCode ready at .../opencode` (`4071c7d`) |
| 1.4 | Port/justify remaining CLI surface | VERIFIED | | `--backend`/`--ui` recorded as intentionally dropped in `tests/cli_coverage.rs` (`fb8bdfd`) |
| 1.5 | Confirm `sys` covers `ai.sh` | VERIFIED | | Gap recorded (below) (`4071c7d`) |
| 2.1 | Static binary build | VERIFIED | | `target/x86_64-unknown-linux-gnu/release/phoebus-installer` 3.4M, `statically linked` (`f984b01`) |
| 2.2 | Guest script uses Rust binary | VERIFIED | | `installer/tests/vm/install.sh` fetches `phoebus-installer` (`f984b01`) |
| 2.3 | Harness docs updated | VERIFIED | | `installer/tests/vm/README.md`, `run-vm.sh` (`f984b01`) |
| 2.4 | VM install with Rust binary | VERIFIED | | serial log: `phoebus-installer 0.1.0`, `===INSTALL-RC=0===`, `NO_SECRET_LEAK`, `===POWEROFF===` (commit `TBD2`) |
| 2.5 | VM detached boot | VERIFIED | | `systemd-boot` -> LUKS unlock -> login -> `running`, `0 loaded units listed`, `enp0s2 10.0.2.15/24` (commit `TBD2`) |
| 2.6 | Boot evidence recorded | VERIFIED | | `installer/doc/VM-BOOT-VERIFICATION.md` "Official harness on the static binary" (commit `TBD2`) |
| 3.1 | Bash-test coverage mapping | TODO | | |
| 3.2 | Golden plan tests; remove `parity.rs` | TODO | | |
| 3.3 | CI updated | TODO | | |
@ -361,6 +361,17 @@ exit gate has been run and recorded.
| 4.3 | Update all references | TODO | | |
| 4.4 | No dangling references | TODO | | |
### Recorded gaps (from task 1.5)
`sys` is the runtime typed-action broker (`enable/disable` service, `inspect`,
`install`, `history`, updates); the Bash `ai.sh` was installer-time AI
assistance. The overlap is covered: proposal parsing/validation lives in
`phoebus-ai` (fail-closed, `deny_unknown_fields`) and OpenCode provisioning in
`phoebus-executor::opencode`. **Not ported:** interactive provider onboarding
and 0600 API-credential storage (`ai_store_api_key`), and the
keyword-based offline explainer. These belong to the installer/TUI surface, not
`sys`; record as separate future work rather than silently dropping them.
---
## 11. Session protocol
@ -409,3 +420,9 @@ detail.
- `YYYY-MM-DD` — (agent/session) phase worked, tasks moved, verification run,
blocker, commit hash.
- `2026-09-20` — Phases 0–2. Tagged `v0.1.0-bash-reference`; baseline cleanup
(`ec88d65`); CLI-coverage gate (`fb8bdfd`); OpenCode executor + 7 tests and
`--bootstrap-opencode` (`4071c7d`); harness moved to the static binary
(`f984b01`); full VM install `INSTALL-RC=0` + detached boot (systemd PID1,
`running`, 0 failed units, LUKS, login) recorded in
`installer/doc/VM-BOOT-VERIFICATION.md`. No blockers.

View file

@ -27,6 +27,11 @@ systemctl is-system-running = running; 0 failed units
Boot timing (Rust installer): 1.378 s kernel + 5.238 s initrd + 4.114 s
userspace = 10.730 s.
The committed VM harness (`installer/tests/vm/serial-driver.py` +
`install.sh`) drives the **static Rust binary**; the Bash installer is no longer
on the install path (Bash migration Phase 2, see
`installer/doc/VM-BOOT-VERIFICATION.md`).
## Matrix
| Area | Implemented | Unit tested | VM verified | Hardware verified |

View file

@ -162,6 +162,52 @@ The installer writes `/usr/local/bin/phoebus-session`, which starts waybar,
mako and swaybg and then execs dwl, with a software-render fallback when no
render node is present.
## Official harness on the static binary (Bash migration, Phase 2)
The committed harness (`installer/tests/vm/serial-driver.py` +
`installer/tests/vm/install.sh`) now drives the **static Rust binary** and no
longer runs the Bash installer. Re-verified end to end on a fresh disposable
qcow2 (24 GiB, virtio-blk `/dev/vda`):
```sh
# Build:
cd installer-rs && RUSTFLAGS="-C target-feature=+crt-static" \
cargo build --release -p phoebus-installer --target x86_64-unknown-linux-gnu
# Install in the disposable VM, then boot the disk detached:
python3 installer/tests/vm/serial-driver.py install
python3 installer/tests/vm/serial-driver.py boot
```
Install (`INSTALL-RC=0`):
- The guest fetched `/tmp/phoebus-installer` and printed
`phoebus-installer 0.1.0` (the Rust binary, not Bash).
- Stages completed in proven order: `storage_prepare`, `stage_install`,
`fstab_generate`, `portage_configure`, `packages_base`, `kernel_install`,
`boot_install`, `users_configure`, `services_configure`, `desktop_install`
(none), `finalize`.
- Policy matched Bash: `crypto`/`btrfs-progs` source build, `sudo`/
`networkmanager`/`polkit` binary.
- `NO_SECRET_LEAK`; the run powered off cleanly.
Boot with the ISO detached (`serial-driver.py boot`):
- UEFI firmware ran `\EFI\systemd\systemd-bootx64.efi` (Boot0002 "Linux Boot
Manager"); the BLS "Gentoo Linux" entry booted.
- `systemd-cryptsetup` prompted for the LUKS2 passphrase and unlocked
`phoebus-root (cryptroot)`.
- Login as `phoebus` succeeded.
- `cat /proc/1/comm` -> `systemd`.
- `systemctl is-system-running` -> **running**.
- `systemctl --failed` -> **0 loaded units listed**.
- Networking: `enp0s2 UP 10.0.2.15/24`.
- Mounts: `/` (btrfs `@`), `/home`, `/var`, `/.snapshots`, `/swap`, ESP
`/efi`; `vda2` is `crypto_LUKS`.
This satisfies the Phase 2 exit gate of `docs/BASH-MIGRATION.md`: the only
proven boot path no longer depends on `installer/bin/ai-installer`.
## Known remaining work
- The graphical session was verified with the **headless** wlroots backend

View file

@ -91,12 +91,15 @@ def do_install():
def do_boot():
env, args = base_args()
args += ["-boot", "order=c"]
# The end marker is built with a command substitution so the shell's echo of
# the typed line does not itself contain it; otherwise `expect` would match
# the echo and close the console before the checks ran.
checks = os.environ.get(
"BOOT_CHECKS",
"echo ===CHECKS-START===; "
"echo ===CHECKS-$(printf START)===; "
"cat /proc/1/comm; systemctl is-system-running; "
"systemctl --failed --no-pager; ip -brief addr; "
"lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS; echo ===CHECKS-END===",
"lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS; echo ===CHECKS-$(printf END)===",
)
log = open(SERIAL_LOG, "w")
child = spawn(args, env)