From a71ecdcd0beadb7d010ffd809dca9bc5db0ce840 Mon Sep 17 00:00:00 2001 From: Breadway Date: Sat, 13 Jun 2026 22:54:27 +0800 Subject: [PATCH] Fix bos-settings compile errors and use REGISTRY_TOKEN for publishing bos-settings was scaffolded but never compiled. Fixes: - main.rs: import gtk4::prelude (connect_activate/run) - window.rs: disambiguate WidgetExt::display(); drop unused GBox import - hyprland.rs: Label has no set_monospace -> use the monospace CSS class - theme.rs: drop unused prelude import Also switch package.yml to secrets.REGISTRY_TOKEN (scoped write:package), since the auto Actions token is not authorized for the owner registry. --- .../prod-readiness-auditor/MEMORY.md | 3 ++ .../project-bos-patterns.md | 30 +++++++++++++++++++ .forgejo/workflows/package.yml | 2 +- bos-settings/src/main.rs | 2 ++ bos-settings/src/theme.rs | 1 - bos-settings/src/ui/views/hyprland.rs | 2 +- bos-settings/src/ui/window.rs | 4 +-- 7 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 .claude/agent-memory/prod-readiness-auditor/MEMORY.md create mode 100644 .claude/agent-memory/prod-readiness-auditor/project-bos-patterns.md diff --git a/.claude/agent-memory/prod-readiness-auditor/MEMORY.md b/.claude/agent-memory/prod-readiness-auditor/MEMORY.md new file mode 100644 index 0000000..6eb2edc --- /dev/null +++ b/.claude/agent-memory/prod-readiness-auditor/MEMORY.md @@ -0,0 +1,3 @@ +# Memory Index + +- [BOS Project Patterns](project-bos-patterns.md) — recurring hotspots and architectural constraints specific to the BOS repo diff --git a/.claude/agent-memory/prod-readiness-auditor/project-bos-patterns.md b/.claude/agent-memory/prod-readiness-auditor/project-bos-patterns.md new file mode 100644 index 0000000..bf403ce --- /dev/null +++ b/.claude/agent-memory/prod-readiness-auditor/project-bos-patterns.md @@ -0,0 +1,30 @@ +--- +name: project-bos-patterns +description: Recurring patterns and hotspots to watch in the BOS repo across audits +metadata: + type: project +--- + +BOS is a rolling Arch Linux OS project combining an archiso installer profile, Calamares configuration, default dotfiles, and a GTK4 Rust settings app (bos-settings). + +**Why:** This is a scaffold-originated repo; the initial code was written in one pass and has several recurring anti-patterns worth watching on future audits. + +**How to apply:** Check these areas first on any future audit pass. + +## Recurring hotspots + +- **config_dir() + /home/user fallback**: Multiple views (breadbar, hyprland, packages) originally inlined `std::env::var("HOME").unwrap_or_else(|_| "/home/user".to_string())` instead of calling `config::config_dir()`. Watch for new views duplicating this. +- **branding.desc YAML**: The `sidebarTextHighlight` key had no space after the colon, causing a hard YAML parse error. Future edits to this file should be checked with `python3 -c "import yaml; yaml.safe_load(open('branding.desc'))"`. +- **Branding images missing**: `logo.png` and `languages.png` are referenced in branding.desc but do not exist in the repo. These must be created before any ISO build attempt. +- **state.rs is dead code**: The file exists at `bos-settings/src/state.rs` but is not declared as `mod state` in `main.rs`. It is silently ignored by cargo. Either wire it in or delete it. +- **pacman.conf TODO**: `[breadway]` repo URL in `iso/pacman.conf` has a TODO comment — must be a live repo before the ISO can be built. +- **eprintln! in production paths**: packages.rs had `eprintln!("bakery update failed: {e}")` inside a GTK callback. GTK apps don't have useful stderr at runtime. Convert to silent handling or surface errors through the UI. +- **can-you-begin-a-composed-beacon.md**: AI-generated random filename for the project plan doc. Should be renamed to PLAN.md before the repo is shared publicly. +- **skel == dotfiles duplication**: `iso/airootfs/etc/skel/.config/` and `dotfiles/` are byte-for-byte identical. This is by design for now, but risks divergence. The plan calls for post-install.sh to copy skel into user home — skel is the authoritative copy; dotfiles/ is redundant scaffolding. Flag in future audits if they diverge. + +## Key architectural constraints + +- Calamares shellprocess runs inside chroot (`dont-chroot: false`). `systemctl enable` works, `systemctl start` does not. +- `MAIN_USER` is derived via `getent passwd 1000` — safe only after Calamares `users` step which precedes `shellprocess` in settings.conf. +- The polkit rule grants wheel-group members passwordless `snapper rollback` via pkexec — intentional per design. +- The live session autologs as root (not a "liveuser") — standard archiso releng behavior, not a bug. diff --git a/.forgejo/workflows/package.yml b/.forgejo/workflows/package.yml index 3bd3c7f..aaf7eb7 100644 --- a/.forgejo/workflows/package.yml +++ b/.forgejo/workflows/package.yml @@ -14,7 +14,7 @@ jobs: # actions require. Everything runs as shell steps and clones manually. - name: Build and publish env: - PUBLISH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PUBLISH_TOKEN: ${{ secrets.REGISTRY_TOKEN }} run: | set -euo pipefail VERSION="${GITHUB_REF_NAME#v}" diff --git a/bos-settings/src/main.rs b/bos-settings/src/main.rs index fc13dc2..a5e73fd 100644 --- a/bos-settings/src/main.rs +++ b/bos-settings/src/main.rs @@ -2,6 +2,8 @@ mod config; mod theme; mod ui; +use gtk4::prelude::*; + fn main() { let app = gtk4::Application::builder() .application_id("com.breadway.bos-settings") diff --git a/bos-settings/src/theme.rs b/bos-settings/src/theme.rs index ae850d0..6be4f51 100644 --- a/bos-settings/src/theme.rs +++ b/bos-settings/src/theme.rs @@ -1,4 +1,3 @@ -use gtk4::prelude::*; use gtk4::CssProvider; const CSS: &str = r#" diff --git a/bos-settings/src/ui/views/hyprland.rs b/bos-settings/src/ui/views/hyprland.rs index 49ac07e..fba4537 100644 --- a/bos-settings/src/ui/views/hyprland.rs +++ b/bos-settings/src/ui/views/hyprland.rs @@ -50,7 +50,7 @@ pub fn build() -> GBox { for mon in &monitors { let lbl = Label::new(Some(mon)); lbl.set_xalign(0.0); - lbl.set_monospace(true); + lbl.add_css_class("monospace"); vbox.append(&lbl); } } diff --git a/bos-settings/src/ui/window.rs b/bos-settings/src/ui/window.rs index 0088675..c07a231 100644 --- a/bos-settings/src/ui/window.rs +++ b/bos-settings/src/ui/window.rs @@ -1,5 +1,5 @@ use gtk4::prelude::*; -use gtk4::{Application, ApplicationWindow, Box as GBox, Orientation, Paned, Stack}; +use gtk4::{Application, ApplicationWindow, Orientation, Paned, Stack}; use super::sidebar; use super::views; @@ -12,7 +12,7 @@ pub fn build_ui(app: &Application) { .default_height(640) .build(); - crate::theme::load(&window.display()); + crate::theme::load(&WidgetExt::display(&window)); let hpaned = Paned::new(Orientation::Horizontal); hpaned.set_position(190);