Make the focus exception list real, or it was a page telling a lie
The mode data model shipped with an allow list and nothing that read it. The summary would say "2 apps may interrupt" while notification delivery never consulted the list and no editor could set it. That is the dead row this work has spent its time removing, introduced by the work itself. The banner gate consults the mode in force now, and the list can be edited from the applications that have actually sent a notification -- an exception for something that never notifies is not a choice worth offering. Exceptions belong to a mode. allowedApps is empty whenever no mode is active, so a Do Not Disturb switched on by hand stays absolute and nothing can leak into it. That scoping is asserted, not just written. Verifying this took three attempts, and the second was a real defect in the guard rather than in the code. The contract grep for FocusModes.allows matched the comment that explains it, so the check passed with the enforcement deleted. It matches the gate expression now. A guard a comment can satisfy is not a guard, and this is the third time prose has satisfied one here. Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
This commit is contained in:
@@ -135,4 +135,30 @@ grep -q 'key: "gamingSilenceNotifications"' "$schema" \
|
||||
grep -q 'FocusModes' "$gaming_page" \
|
||||
|| fail 'the Gaming page does not point at the mode that replaced its switch'
|
||||
|
||||
# ── 6. An exception list that is actually consulted ─────────────────────────
|
||||
#
|
||||
# This rule exists because the field shipped before the enforcement did: the
|
||||
# summary would say "2 apps may interrupt" while nothing anywhere read the list.
|
||||
# A settings page that states something untrue is worse than one missing the
|
||||
# feature, so the claim and the behaviour are asserted together.
|
||||
|
||||
notifs="$repo_dir/config/dot/quickshell/services/Notifs.qml"
|
||||
page="$repo_dir/config/dot/quickshell/modules/settings/NotificationsPage.qml"
|
||||
|
||||
# Matched on the gate itself, not the name. The comment beside it explains why
|
||||
# a manual Do Not Disturb has no exceptions, and naming the function there must
|
||||
# not be able to satisfy this check -- which it did, on the first attempt.
|
||||
grep -q 'doNotDisturb || FocusModes.allows(' "$notifs" \
|
||||
|| fail 'the banner gate never consults the active mode, so an exception list would do nothing'
|
||||
grep -q 'function allows' "$service" \
|
||||
|| fail 'there is no way to ask whether an application is excepted'
|
||||
|
||||
# Exceptions belong to a mode. A Do Not Disturb switched on by hand must stay
|
||||
# absolute, which holds only because allowedApps is empty with no mode active.
|
||||
grep -q 'if (!mode || mode.silence !== true)' "$service" \
|
||||
|| fail 'exceptions are not scoped to an active silencing mode, so a manual Do Not Disturb could leak'
|
||||
|
||||
grep -q 'function toggleAllowed' "$page" \
|
||||
|| fail 'the exception list cannot be edited, so the summary could claim something unreachable'
|
||||
|
||||
printf 'focus modes contract: ok\n'
|
||||
|
||||
@@ -84,8 +84,14 @@ if (!source.includes("next[knownAppId] = root.appRule(knownAppId)"))
|
||||
fail("persisted rules are not normalized to the required three-field shape");
|
||||
if (!source.includes("root.fallbackAppRules = next"))
|
||||
fail("missing-schema preference writes do not retain an in-memory fallback");
|
||||
if (!source.includes("if (!root.doNotDisturb)"))
|
||||
fail("global DND popup override was removed");
|
||||
// Do Not Disturb still gates popups; it gained exactly one exception, and the
|
||||
// assertion names that exception rather than being loosened. A bare
|
||||
// if (!doNotDisturb) would mean the allow list of the active focus mode is
|
||||
// never consulted. Anything wider would let a manual Do Not Disturb be
|
||||
// overridden. No apostrophes here: this block is inside a single-quoted shell
|
||||
// string, and one closes it.
|
||||
if (!source.includes("if (!root.doNotDisturb || FocusModes.allows("))
|
||||
fail("Do Not Disturb no longer gates popups with a focus-mode exception");
|
||||
for (const required of [
|
||||
"DesktopEntries.applications.values",
|
||||
"DesktopEntries.byId(appId)",
|
||||
|
||||
Reference in New Issue
Block a user