Files
Panama/tests/quickshell/gnome-handoff-contract.sh
T
Gabriel Brown 0c364f38e6 Stop sending people to GNOME for pages this app already has
Panama absorbed Users, Sharing, Printers and Online Accounts one page at a time.
Each time, the row pointing at GNOME's equivalent stayed exactly where it was --
so an app whose stated purpose is to make GNOME Settings unnecessary shipped four
doors back to it, two of them inside a card headed "these areas remain owned by
Fedora and GNOME's mature system panels".

Nothing failed. Every row worked as written. They were simply no longer true, and
no test could notice, because none of them knew what Panama had come to own in
the meantime. gnome-handoff-contract reads the sidebar for the pages that exist
and the pages for the panels they hand off, and fails on any overlap -- derived
from both sides rather than a hand-kept list, so absorbing the next page cannot
leave a stale door behind. Adding an online account is allow-listed with its
reason: it genuinely requires GOA's own dialog.

health-ui-contract asserted those handoffs were present, which is how they
survived. The assertion is inverted rather than deleted, so reintroducing one
fails loudly.

The Home Assistant "Light entities" box is gone. It was a multi-line list of
comma-separated Zigbee entity IDs, and the light catalog does not come from it --
the helper discovers that live. It is a one-time migration seed for the Control
Center selection, so saving now passes the stored value back untouched: setting a
URL or a token cannot disturb it. Deleting the control naively would have written
an empty list over it.

Sharing showed two "Port" rows for RDP, same label and value, one read-only and
one editable, separated by a switch. The read-only leftover is gone. The SSH port
stays read-only because sshd's port is not ours to write.

About reported "488G free of 1.9T" where Storage said "523 GB free of 2.0 TB" --
the same drive, binary against decimal. About uses decimal now, matching how
drives are sold. Memory and swap stay in GiB, which is how RAM is sold.

Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
2026-08-19 22:36:58 -04:00

96 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# No settings page may hand off to a GNOME panel that Panama itself owns.
#
# Panama absorbed Users, Sharing, Printers, Online Accounts and others one page
# at a time. Each time, the rows pointing at GNOME's equivalent stayed where
# they were -- so a settings app whose stated purpose is to make GNOME Settings
# unnecessary shipped four separate doors back to it, two of them inside a card
# headed "these areas remain owned by Fedora".
#
# Nothing failed. Every row worked exactly as written. The rows were simply no
# longer true, and no test could notice because none of them knew what Panama
# had come to own in the meantime.
#
# This reads the sidebar for the pages that exist and the pages for the panels
# they hand off, and fails on any overlap. It is deliberately derived from both
# sides rather than from a hand-kept list, so absorbing the next page cannot
# leave a stale door behind.
#
# Read-only.
set -uo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
settings_dir="$repo_dir/config/dot/quickshell/modules/settings"
sidebar="$settings_dir/SettingsSidebar.qml"
fail() {
printf 'gnome handoff contract: %s\n' "$1" >&2
exit 1
}
[[ -r "$sidebar" ]] || fail "missing $sidebar"
# GNOME panel names that correspond to a Panama page. Only entries whose panel
# genuinely duplicates a Panama page belong here: "network" stays off it because
# Panama has no VPN or per-connection routing, and "online-accounts" is listed
# because Panama has an Online Accounts page -- but adding an account still has
# to go through GOA's own dialog, so that one exception is named explicitly.
declare -A OWNED=(
[printers]=printers
[online-accounts]=accounts
[sharing]=sharing
[users]=users
[system\ users]=users
)
# Handoffs that are correct despite naming an owned panel, with the reason.
# Anything here must be justified, not merely tolerated.
declare -A ALLOWED=(
["OnlineAccountsPage.qml:online-accounts"]="adding an account requires GOA's own dialog"
)
pages="$(grep -oE '\{ *page: "[a-z-]+"' "$sidebar" | sed 's/.*"\(.*\)"/\1/' | sort -u)"
[[ -n "$pages" ]] || fail 'no pages could be read from the sidebar, so this proves nothing'
has_page() {
grep -qx "$1" <<<"$pages"
}
violations=0
checked=0
while IFS= read -r hit; do
file="${hit%%:*}"
base="$(basename "$file")"
# openGnomePanel("a") or openGnomePanel("a", "b") -> "a" / "a b"
panel="$(sed -E 's/.*openGnomePanel\("([^"]+)"(, *"([^"]+)")?\).*/\1 \3/' <<<"$hit" \
| sed 's/ *$//')"
[[ -n "$panel" ]] || continue
checked=$((checked + 1))
owner="${OWNED[$panel]:-}"
[[ -n "$owner" ]] || continue
has_page "$owner" || continue
key="$base:${panel// /-}"
if [[ -n "${ALLOWED[$key]:-}" ]]; then
continue
fi
printf 'gnome handoff contract: %s hands "%s" to GNOME, but Panama owns the "%s" page\n' \
"$base" "$panel" "$owner" >&2
violations=$((violations + 1))
done < <(grep -rno --include='*.qml' -E 'openGnomePanel\("[^"]*"(, *"[^"]*")?\)' "$settings_dir")
(( checked > 0 )) || fail 'no handoffs were examined, so this proves nothing'
if (( violations > 0 )); then
printf 'Each of these sends someone to GNOME for a page this app already has.\n' >&2
exit 1
fi
printf 'gnome handoff contract: ok (%d handoffs checked against %d pages)\n' \
"$checked" "$(wc -l <<<"$pages")"