hub (unreleased): the System page shows the kernel clean-up and the security-profile refresh; a clean-up no longer hides a kernel step (R-1383)
gates / gates (push) Successful in 2m20s

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-14 18:06:12 +01:00
1 parent e5c643d73d
commit 68292e40f6
14 files changed
+452 -13

No files matched your search

+66
View File
@@ -38,6 +38,7 @@ type systemRow struct {
Held, RebootSince, KernelPanic, Oops cell
CrashRestarts24h, Guard cell
KernelDefault, KernelStep cell // R-836: the GRUB default kernel; the kernel lane's step
KernelCleanup, Profiles cell // R-1383: the clean-up of old kernels; the security-profile refresh
Bundle cell // R-840: the root-owned config bundle
Agent cell // R-530: the box's agent against the vouched one
// guest
@@ -115,6 +116,71 @@ func kernelCells(f sysfacts.System, kl osupdates.KernelLine, now time.Time) (dfl
return dflt, step
}
// cleanupCell is the System page's „Kernel clean-up” cell (R-1383, release 3; `11` §5.11.1): the newest clean-up of
// old kernels — how many it removed and kept and how much space it gained, the names in the title. Amber when it was
// refused or failed, or left paths of a removed kernel behind. A box tells the hub only when a clean-up removed
// something, was refused, or failed — so „—” is the normal reading for a box with nothing to remove.
func cleanupCell(kl osupdates.KernelLine, now time.Time) cell {
if kl.CleanupOutcome == "" {
return cell{Text: "—", Title: "no clean-up of old kernels reported (a box reports one only when it removed kernels, was refused, or failed)"}
}
when := ago(kl.CleanupAt, now)
switch kl.CleanupOutcome {
case "cleaned":
d := kl.Cleanup
if d == nil {
return cell{Text: "cleaned " + when, Title: kl.CleanupReason}
}
gained := "space gained unknown"
if d.BytesGained != nil {
gained = fmt.Sprintf("%.1f GiB gained", float64(*d.BytesGained)/(1<<30))
}
c := cell{Text: fmt.Sprintf("removed %d, kept %d · %s · %s", len(d.Removed), len(d.Kept), gained, when),
Title: "removed: " + strings.Join(d.Removed, ", ") + " — kept: " + strings.Join(d.Kept, ", ")}
if d.Leftovers > 0 {
c.Class = "warn"
c.Text += fmt.Sprintf(" · %d left-over path(s)", d.Leftovers)
}
return c
}
return cell{Text: kl.CleanupOutcome + " " + when, Class: "warn", Title: kl.CleanupReason}
}
// profileCell is the „Security profiles” cell (R-1383, release 3; `11` §5.12): the box's last refresh of its compiled
// AppArmor profiles — the kernel it ran on, how many compiled profiles changed, and any FAILED service it restarted
// (on the N100 that was the time service). Amber when the agent's last ask failed or got no answer.
func profileCell(f sysfacts.System, now time.Time) cell {
p := f.ProfileRefresh
if p == nil {
return cell{Text: "—", Title: "the box reports no security-profile refresh (an agent older than release 3, a BYO host, or no refresh yet)"}
}
var parts []string
if p.At != "" {
at, _ := time.Parse(time.RFC3339, p.At)
parts = append(parts, strings.TrimSpace(p.Kernel+" · "+fmt.Sprintf("%d rewritten", p.Rewritten)+" · "+ago(at, now)))
if len(p.Restarted) > 0 {
parts = append(parts, "restarted "+strings.Join(p.Restarted, ", "))
}
}
c := cell{Title: "last ask: " + p.LastAsk}
if p.LastAsk == "" {
c.Title = "from the box's own record (the agent has not asked since it started)"
}
switch p.LastAsk {
case "failed", "no_answer":
askAt, _ := time.Parse(time.RFC3339, p.LastAskAt)
parts = append(parts, "last ask "+strings.ToUpper(p.LastAsk)+" "+ago(askAt, now))
c.Class = "warn"
case "refused":
c.Title = "last ask: refused (an older root wrapper that does not know the mode, or a BYO host)"
}
if len(parts) == 0 {
parts = append(parts, "no refresh yet")
}
c.Text = strings.Join(parts, " · ")
return c
}
// agentCell is the "Agent" cell (R-530, hub v0.135.0): the box's agent against the vouched one, how far behind and
// since when. Amber while behind; red from the alarm's wait on (the operator alarm fires then). An unreadable
// version is "unknown", never a guess; nothing vouched → the version alone.