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
This commit is contained in:
Gabriel Brown
2026-08-19 19:05:29 -04:00
parent 4cbe3b882a
commit a412e3d894
@@ -216,12 +216,21 @@ fi
|| fail 'the keyboard layout changed despite a rejected value'
# ── Restoring through the real path must also work ───────────────────────────
# 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 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
"$original_vrr" "$original_direct" >/dev/null 2>&1
restored=false
for _ in $(seq 1 150); do
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
@@ -230,6 +239,8 @@ for _ in $(seq 1 150); do
fi
sleep 0.1
done
[[ "$restored" == true ]] && break
done
[[ "$restored" == true ]] || fail 'the original policy values could not be restored through SystemSettings'
trap - EXIT