From 787d2b121a397e4db1643a398507f013f3f92b36 Mon Sep 17 00:00:00 2001 From: Gabriel Brown Date: Tue, 18 Aug 2026 01:39:34 -0400 Subject: [PATCH] Use the durable Home reset boundary --- config/dot/quickshell/services/SystemSettings.qml | 9 +++------ tests/quickshell/settings-commit-reset-contract.sh | 7 +++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config/dot/quickshell/services/SystemSettings.qml b/config/dot/quickshell/services/SystemSettings.qml index 4e3e711..2933ab3 100644 --- a/config/dot/quickshell/services/SystemSettings.qml +++ b/config/dot/quickshell/services/SystemSettings.qml @@ -396,12 +396,9 @@ Singleton { // that only cleared the schema store would silently leave a customised // favourites list behind while claiming to restore Panama's defaults. // - // Done through HomePreferences' public writable aliases rather than a - // reset function of its own: clearing `favorites` and returning - // `initialized` to false is exactly the state a fresh install has, and - // it lets initialize() seed the list again on next use. - HomePreferences.favorites = []; - HomePreferences.initialized = false; + // HomePreferences owns the write-through boundary so the state file is + // rewritten before this reset can be considered complete. + HomePreferences.resetHomeDefaults(); resettleTimer.restart(); } diff --git a/tests/quickshell/settings-commit-reset-contract.sh b/tests/quickshell/settings-commit-reset-contract.sh index 1832772..75d6c56 100755 --- a/tests/quickshell/settings-commit-reset-contract.sh +++ b/tests/quickshell/settings-commit-reset-contract.sh @@ -19,6 +19,7 @@ set -euo pipefail repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" harness="$repo_dir/config/dot/quickshell/settings-system-harness.qml" +system_settings="$repo_dir/config/dot/quickshell/services/SystemSettings.qml" # Preferences are committed to $XDG_CONFIG_HOME, and the Home store lives under # $XDG_STATE_HOME. Both are isolated so this contract cannot touch the real @@ -31,6 +32,12 @@ fail() { exit 1 } +rg -Fq 'HomePreferences.resetHomeDefaults();' "$system_settings" \ + || fail 'restoreDefaults does not use the durable Home reset boundary' +if rg -q 'HomePreferences\.(favorites|initialized)\s*=' "$system_settings"; then + fail 'restoreDefaults mutates Home aliases instead of using resetHomeDefaults' +fi + qs_for_harness() { XDG_CONFIG_HOME="$config_home" XDG_STATE_HOME="$state_home" qs -p "$harness" "$@" }