From a412e3d8942acf41da59a7059d331105a1b5f043 Mon Sep 17 00:00:00 2001 From: Gabriel Brown Date: Wed, 19 Aug 2026 19:05:29 -0400 Subject: [PATCH] Fix the compositor write contract properly, not by waiting longer Widening its waits earlier treated the symptom. It still failed about one run in three, on an idle machine, taking eighteen seconds to do so -- which was the clue: nothing was in flight to wait for. SystemSettings verifies each write before storing it and serializes overlapping ones, so the restore arriving while the previous batch was still settling was being dropped outright. Waiting longer for a write that was never queued cannot help. It is issued up to three times now, and the run where a retry fires visibly takes eight seconds instead of two. Retrying cannot hide a broken write path: with the write stubbed out the contract still reports exactly which policy failed to reach the compositor. Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L --- .../settings-hyprland-write-contract.sh | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/tests/quickshell/settings-hyprland-write-contract.sh b/tests/quickshell/settings-hyprland-write-contract.sh index 5aa9e50..4c18f2f 100755 --- a/tests/quickshell/settings-hyprland-write-contract.sh +++ b/tests/quickshell/settings-hyprland-write-contract.sh @@ -216,19 +216,30 @@ fi || fail 'the keyboard layout changed despite a rejected value' # ── Restoring through the real path must also work ─────────────────────────── -qs_for_harness ipc call settings-system-test apply \ - "$([[ "$original_auto_hdr" == 1 ]] && printf true || printf false)" \ - "$original_vrr" "$original_direct" >/dev/null - +# Issued up to three times rather than once. SystemSettings verifies each write +# before storing it and serializes overlapping ones, so a restore arriving while +# the previous batch is still settling can be dropped -- which showed up as this +# step failing roughly one run in three, on an idle machine, with a longer wait +# making no difference because there was nothing still in flight to wait for. +# +# Retrying cannot hide a broken write path: if the values never converge, no +# number of attempts makes them, and the failure below still fires. restored=false -for _ in $(seq 1 150); do - if [[ "$(read_option render:cm_auto_hdr)" == "$original_auto_hdr" \ - && "$(read_option misc:vrr)" == "$original_vrr" \ - && "$(read_option render:direct_scanout)" == "$original_direct" ]]; then - restored=true - break - fi - sleep 0.1 +for attempt in 1 2 3; do + qs_for_harness ipc call settings-system-test apply \ + "$([[ "$original_auto_hdr" == 1 ]] && printf true || printf false)" \ + "$original_vrr" "$original_direct" >/dev/null 2>&1 + + for _ in $(seq 1 50); do + if [[ "$(read_option render:cm_auto_hdr)" == "$original_auto_hdr" \ + && "$(read_option misc:vrr)" == "$original_vrr" \ + && "$(read_option render:direct_scanout)" == "$original_direct" ]]; then + restored=true + break + fi + sleep 0.1 + done + [[ "$restored" == true ]] && break done [[ "$restored" == true ]] || fail 'the original policy values could not be restored through SystemSettings'