From 040181abc27cc3ca6e0e6fc08b757f9b3d21bb88 Mon Sep 17 00:00:00 2001 From: Phoebus Date: Tue, 22 Sep 2026 18:52:00 -0700 Subject: [PATCH] feat(install): enforce Flatpak non-removable invariant across AI and UI --- docs/CHANGELOG.md | 5 +++++ docs/HANDOFF.md | 3 ++- installer-rs/crates/phoebus-ai/src/lib.rs | 14 +++++++++++--- installer-rs/crates/phoebus-ai/src/provider.rs | 8 +++++--- installer-rs/crates/phoebus-core/src/validate.rs | 6 ++++++ .../crates/phoebus-installer/src/gui_bridge.rs | 1 + installer-rs/crates/phoebus-tui/src/lib.rs | 7 ++----- installer/live/desktop/phoebus-install/shell.qml | 13 ++++++++++--- 8 files changed, 42 insertions(+), 15 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index cd3f488..10b0ecd 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,11 @@ Format: Keep a Changelog. Dates are UTC. ## 2026-09-22 — Installer UX streamlining and DWM keybindings in Mango +- **Flatpak non-removable invariant:** Flatpak is a defining, required subsystem of + Phoebus OS. Removed `set_flatpak` from the AI advisor action prompt and examples so + models never propose toggling it; enforced in `fixed_policy_violation` and config + validation that Flatpak cannot be disabled or removed; filtered redundant Flatpak + proposals from the GUI review card; and locked Flatpak to 'yes (required)' in the TUI. - **DWM / DWL keybindings in Mango:** Packaged `MANGO_CONFIG_DEFAULT` now ships with standard dwm / dwl bindings for tiling and window management: `Mod+Shift+Return` (terminal), `Mod+Return` (zoom / promote to master), diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 0fb0614..9795860 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -13,7 +13,8 @@ commit it. It should be short and current; use `git log` for detail. 6. Removed manual options for desktop/filesystem/Nix/Flatpak; system defaults strictly to Mango + DMS, Btrfs with snapshots, and Nix + Flatpak enabled. 7. Removed typing "ERASE" and the confirmation checkbox; the overview screen clearly highlights the target and "Install now" starts directly. 8. Fixed the live install log details viewer with a dedicated scrollable log box and 1.5s refresh timer. - 9. Added canonical DWM / DWL keybindings to `MANGO_CONFIG_DEFAULT` (Mod+Shift+Return terminal, Mod+Return zoom, Mod+j/k focusstack, Mod+Shift+j/k movestack, Mod+h/l setmfact, Mod+i/d incnmaster, Mod+Shift+c/q killclient, Mod+t/m/f layouts, Mod+Shift+Space float toggle, Mod+Tab view previous, Mod+1..9 tags, Mod+Shift+1..9 movetotag, mouse window drag/resize). + 9. Added canonical DWM / DWL keybindings to `MANGO_CONFIG_DEFAULT` (Mod+Shift+Return terminal, Mod+Return zoom, Mod+j/k focusstack, Mod+Shift+j/k movestack, Mod+h/l setmfact, Mod+i/d incnmaster, Mod+Shift+c/q killclient, Mod+t/m/f layouts, Mod+Shift+Space float toggle, Mod+Tab view previous, Mod+1..9 tags, Mod+Shift+1..9 movetotag, mouse window drag/resize, Mod+Shift+r reload_config). + 10. Enforced Flatpak as an essential, non-removable invariant across the entire system: removed `set_flatpak` from the AI advisor action list and examples so models never propose toggling it; added `fixed_policy_violation` check rejecting any proposal to disable Flatpak; filtered redundant Flatpak proposals in the GUI bridge and shell; enforced Flatpak in `validate_config`; and locked Flatpak to 'yes (required)' in the TUI. - **Last verified (this session):** - `cargo fmt --all -- --check`, `cargo clippy --workspace --all-targets` (clean, 0 errors). - `cargo test --workspace` all tests passing (0 failures). diff --git a/installer-rs/crates/phoebus-ai/src/lib.rs b/installer-rs/crates/phoebus-ai/src/lib.rs index f27c561..afef493 100644 --- a/installer-rs/crates/phoebus-ai/src/lib.rs +++ b/installer-rs/crates/phoebus-ai/src/lib.rs @@ -338,6 +338,9 @@ fn fixed_policy_violation(change: &ProposedChange) -> Option { ProposedChange::SetKernelProfile { value: KernelProfile::Aggressive, } => Some("aggressive kernel profiles are not accepted".into()), + ProposedChange::SetFlatpak { value: false } => Some( + "Flatpak is a required workstation subsystem and cannot be disabled or removed".into(), + ), _ => None, } } @@ -393,17 +396,22 @@ pub fn review(config: &mut InstallConfig, proposal: &AiProposal) -> Result Vec { "ACCEPT_LICENSE must not be empty", )); } + if !config.desktop.flatpak { + issues.push(ValidationIssue::new( + "flatpak", + "Flatpak is a required Phoebus workstation subsystem and cannot be disabled", + )); + } if let Some(jobs) = config.packages.build_jobs { if jobs == 0 || jobs > 256 { issues.push(ValidationIssue::new( diff --git a/installer-rs/crates/phoebus-installer/src/gui_bridge.rs b/installer-rs/crates/phoebus-installer/src/gui_bridge.rs index 7beb8ce..5a3d95d 100644 --- a/installer-rs/crates/phoebus-installer/src/gui_bridge.rs +++ b/installer-rs/crates/phoebus-installer/src/gui_bridge.rs @@ -1631,6 +1631,7 @@ fn finish_review( let applied: Vec = outcome .applied .iter() + .filter(|c| !c.description.to_lowercase().starts_with("flatpak")) .map(|c| { json!({ "description": c.description, diff --git a/installer-rs/crates/phoebus-tui/src/lib.rs b/installer-rs/crates/phoebus-tui/src/lib.rs index 0342840..860f495 100644 --- a/installer-rs/crates/phoebus-tui/src/lib.rs +++ b/installer-rs/crates/phoebus-tui/src/lib.rs @@ -102,10 +102,7 @@ impl App { ("Kernel profile".into(), c.kernel.profile.to_string()), ("Package policy".into(), c.packages.policy.to_string()), ("Desktop".into(), c.desktop.profile.to_string()), - ( - "Flatpak".into(), - if c.desktop.flatpak { "yes" } else { "no" }.into(), - ), + ("Flatpak".into(), "yes (required)".into()), ( "Passphrase".into(), if self.passphrase.is_some() { @@ -194,7 +191,7 @@ impl App { 8 => self.mode = Mode::Choice(Choice::KernelProfile, 0), 9 => self.mode = Mode::Choice(Choice::PackagePolicy, 0), 10 => self.mode = Mode::Choice(Choice::DesktopProfile, 0), - 11 => self.config.desktop.flatpak = !self.config.desktop.flatpak, + 11 => self.config.desktop.flatpak = true, 12 => { self.mode = Mode::Edit(self.edit("Encryption passphrase", "", EditTarget::Passphrase, true)) diff --git a/installer/live/desktop/phoebus-install/shell.qml b/installer/live/desktop/phoebus-install/shell.qml index e6abc91..cfeb145 100644 --- a/installer/live/desktop/phoebus-install/shell.qml +++ b/installer/live/desktop/phoebus-install/shell.qml @@ -693,11 +693,13 @@ ShellRoot { Bridge.aiCheck(reply => { shell.aiChecking = false; if (reply.ok) { - shell.aiConnected = true; - shell.aiApplied = reply.data.applied || []; + const raw = reply.data.applied || []; + shell.aiApplied = raw.filter(item => !item.description.toLowerCase().startsWith("flatpak")); shell.aiReviewAccepted = shell.aiApplied.length === 0; - if (reply.data.config) + if (reply.data.config) { shell.cfg = clone(reply.data.config); + shell.cfg.desktop.flatpak = true; + } shell.status = ""; shell.logState("applied"); } else { @@ -862,6 +864,11 @@ ShellRoot { let log = shell.progressLog.slice(); log.push(event); shell.progressLog = log; + const desc = (event.label || event.stage) + " (" + event.status + ")"; + let lines = shell.logLines.slice(); + lines.push(desc); + shell.logLines = lines; + shell.lastActivity = desc; } function restartBackend() {