feat(install): enforce Flatpak non-removable invariant across AI and UI
Some checks are pending
ci / test (push) Waiting to run

This commit is contained in:
Phoebus 2026-09-22 18:52:00 -07:00
parent 10269f3c21
commit 040181abc2
8 changed files with 42 additions and 15 deletions

View file

@ -7,6 +7,11 @@ Format: Keep a Changelog. Dates are UTC.
## 2026-09-22 — Installer UX streamlining and DWM keybindings in Mango ## 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 - **DWM / DWL keybindings in Mango:** Packaged `MANGO_CONFIG_DEFAULT` now ships
with standard dwm / dwl bindings for tiling and window management: with standard dwm / dwl bindings for tiling and window management:
`Mod+Shift+Return` (terminal), `Mod+Return` (zoom / promote to master), `Mod+Shift+Return` (terminal), `Mod+Return` (zoom / promote to master),

View file

@ -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. 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. 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. 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):** - **Last verified (this session):**
- `cargo fmt --all -- --check`, `cargo clippy --workspace --all-targets` (clean, 0 errors). - `cargo fmt --all -- --check`, `cargo clippy --workspace --all-targets` (clean, 0 errors).
- `cargo test --workspace` all tests passing (0 failures). - `cargo test --workspace` all tests passing (0 failures).

View file

@ -338,6 +338,9 @@ fn fixed_policy_violation(change: &ProposedChange) -> Option<String> {
ProposedChange::SetKernelProfile { ProposedChange::SetKernelProfile {
value: KernelProfile::Aggressive, value: KernelProfile::Aggressive,
} => Some("aggressive kernel profiles are not accepted".into()), } => 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, _ => None,
} }
} }
@ -393,17 +396,22 @@ pub fn review(config: &mut InstallConfig, proposal: &AiProposal) -> Result<Revie
.changes .changes
.iter() .iter()
.zip(applied) .zip(applied)
.map(|(change, applied)| { .filter_map(|(change, applied)| {
// Flatpak is enabled by default and cannot be removed; do not clutter
// the proposed changes list with redundant no-op mentions.
if let ProposedChange::SetFlatpak { value: true } = change {
return None;
}
let rationale = proposal let rationale = proposal
.rationale .rationale
.iter() .iter()
.find(|r| r.action == change.action_name()) .find(|r| r.action == change.action_name())
.expect("reason checked above"); .expect("reason checked above");
ReviewedChange { Some(ReviewedChange {
description: applied.description, description: applied.description,
reason: rationale.reason.clone(), reason: rationale.reason.clone(),
evidence: rationale.evidence.clone(), evidence: rationale.evidence.clone(),
} })
}) })
.collect(); .collect();
Ok(ReviewOutcome { applied: reviewed }) Ok(ReviewOutcome { applied: reviewed })

View file

@ -226,7 +226,7 @@ this closed set of actions, each with a non-empty reason and optional evidence:
set_hostname, set_timezone, set_locale, set_keymap, set_username, set_target_disk, set_hostname, set_timezone, set_locale, set_keymap, set_username, set_target_disk,
set_filesystem (btrfs|ext4), set_encryption (none|luks2), set_kernel_profile set_filesystem (btrfs|ext4), set_encryption (none|luks2), set_kernel_profile
(safe|optimized|aggressive), set_package_policy (balanced|source_first|binary_first), (safe|optimized|aggressive), set_package_policy (balanced|source_first|binary_first),
set_desktop_profile (mango), set_flatpak (bool), set_desktop_profile (mango),
set_binary_packages (bool), set_build_jobs (1-256), set_package_use (atom, flag, set_binary_packages (bool), set_build_jobs (1-256), set_package_use (atom, flag,
enabled). enabled).
@ -237,13 +237,15 @@ Every change object has EXACTLY the two keys `action` and `value`. Put the chose
option in `value`; never use the action name as a key. Correct examples: option in `value`; never use the action name as a key. Correct examples:
{\"action\":\"set_kernel_profile\",\"value\":\"safe\"} {\"action\":\"set_kernel_profile\",\"value\":\"safe\"}
{\"action\":\"set_filesystem\",\"value\":\"btrfs\"} {\"action\":\"set_filesystem\",\"value\":\"btrfs\"}
{\"action\":\"set_flatpak\",\"value\":true} {\"action\":\"set_binary_packages\",\"value\":true}
{\"action\":\"set_build_jobs\",\"value\":4} {\"action\":\"set_build_jobs\",\"value\":4}
Rules: prefer stability and a proven boot over speculative performance; never Rules: prefer stability and a proven boot over speculative performance; never
propose disabling signature verification, enabling ~amd64 globally, weakening propose disabling signature verification, enabling ~amd64 globally, weakening
LUKS2/Btrfs/systemd/UEFI, or any shell/command action; do not invent package LUKS2/Btrfs/systemd/UEFI, or any shell/command action; do not invent package
atoms; keep required boot/encryption/filesystem/desktop (Mango + DMS) settings fixed. You do not have atoms; Flatpak, Nix, and the Mango + DMS desktop profile are required, non-removable
core subsystems of Phoebus OS (never propose disabling, toggling, or removing them);
keep required boot/encryption/filesystem/desktop settings fixed. You do not have
a shell and cannot execute anything."; a shell and cannot execute anything.";
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]

View file

@ -232,6 +232,12 @@ pub fn validate_config(config: &InstallConfig) -> Vec<ValidationIssue> {
"ACCEPT_LICENSE must not be empty", "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 let Some(jobs) = config.packages.build_jobs {
if jobs == 0 || jobs > 256 { if jobs == 0 || jobs > 256 {
issues.push(ValidationIssue::new( issues.push(ValidationIssue::new(

View file

@ -1631,6 +1631,7 @@ fn finish_review(
let applied: Vec<Value> = outcome let applied: Vec<Value> = outcome
.applied .applied
.iter() .iter()
.filter(|c| !c.description.to_lowercase().starts_with("flatpak"))
.map(|c| { .map(|c| {
json!({ json!({
"description": c.description, "description": c.description,

View file

@ -102,10 +102,7 @@ impl App {
("Kernel profile".into(), c.kernel.profile.to_string()), ("Kernel profile".into(), c.kernel.profile.to_string()),
("Package policy".into(), c.packages.policy.to_string()), ("Package policy".into(), c.packages.policy.to_string()),
("Desktop".into(), c.desktop.profile.to_string()), ("Desktop".into(), c.desktop.profile.to_string()),
( ("Flatpak".into(), "yes (required)".into()),
"Flatpak".into(),
if c.desktop.flatpak { "yes" } else { "no" }.into(),
),
( (
"Passphrase".into(), "Passphrase".into(),
if self.passphrase.is_some() { if self.passphrase.is_some() {
@ -194,7 +191,7 @@ impl App {
8 => self.mode = Mode::Choice(Choice::KernelProfile, 0), 8 => self.mode = Mode::Choice(Choice::KernelProfile, 0),
9 => self.mode = Mode::Choice(Choice::PackagePolicy, 0), 9 => self.mode = Mode::Choice(Choice::PackagePolicy, 0),
10 => self.mode = Mode::Choice(Choice::DesktopProfile, 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 => { 12 => {
self.mode = self.mode =
Mode::Edit(self.edit("Encryption passphrase", "", EditTarget::Passphrase, true)) Mode::Edit(self.edit("Encryption passphrase", "", EditTarget::Passphrase, true))

View file

@ -693,11 +693,13 @@ ShellRoot {
Bridge.aiCheck(reply => { Bridge.aiCheck(reply => {
shell.aiChecking = false; shell.aiChecking = false;
if (reply.ok) { if (reply.ok) {
shell.aiConnected = true; const raw = reply.data.applied || [];
shell.aiApplied = reply.data.applied || []; shell.aiApplied = raw.filter(item => !item.description.toLowerCase().startsWith("flatpak"));
shell.aiReviewAccepted = shell.aiApplied.length === 0; shell.aiReviewAccepted = shell.aiApplied.length === 0;
if (reply.data.config) if (reply.data.config) {
shell.cfg = clone(reply.data.config); shell.cfg = clone(reply.data.config);
shell.cfg.desktop.flatpak = true;
}
shell.status = ""; shell.status = "";
shell.logState("applied"); shell.logState("applied");
} else { } else {
@ -862,6 +864,11 @@ ShellRoot {
let log = shell.progressLog.slice(); let log = shell.progressLog.slice();
log.push(event); log.push(event);
shell.progressLog = log; 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() { function restartBackend() {