Stop the compositor write contract failing under load

It passed alone in two seconds and failed in a full suite run at six,
which is the worst way for a test to be wrong: the code was fine and the
report said otherwise.

Each of its waits polls until the compositor reflects a write, and four
seconds was enough on an idle machine and not enough on a busy one. They
are fifteen now. A longer bound cannot mask a dead write, because a
write that never lands never matches -- verified by stubbing the write
path out and watching it still report exactly which policy failed.

Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
This commit is contained in:
Gabriel Brown
2026-08-19 17:33:12 -04:00
parent 8f0fe23377
commit b10f8e2593
@@ -104,7 +104,13 @@ done
|| fail 'another instance of the settings harness is still running -- this contract would talk to it instead of its own, and its writes may be deliberately stubbed'
XDG_CONFIG_HOME="$config_home" qs -p "$harness" --daemonize >/dev/null
for _ in $(seq 1 40); do
# Bounded waits are deliberately generous. Each of these polls until the
# compositor reflects a write, and four seconds was enough on an idle machine
# and not enough on a busy one -- this contract passed alone and failed in a
# full suite run, which is the worst way for a test to be wrong. A longer bound
# cannot mask a dead write, because a write that never lands never matches; it
# only stops a slow one from being reported as a broken one.
for _ in $(seq 1 150); do
if qs_for_harness ipc show 2>/dev/null | rg -q '^target settings-system-test$'; then
break
fi
@@ -116,7 +122,7 @@ qs_for_harness ipc show 2>/dev/null | rg -q '^target settings-system-test$' || f
qs_for_harness ipc call settings-system-test apply "$target_auto_hdr" "$target_vrr" "$target_direct" >/dev/null
applied=false
for _ in $(seq 1 40); do
for _ in $(seq 1 150); do
if [[ "$(read_option render:cm_auto_hdr)" == "$target_auto_hdr_int" \
&& "$(read_option misc:vrr)" == "$target_vrr" \
&& "$(read_option render:direct_scanout)" == "$target_direct" ]]; then
@@ -143,7 +149,7 @@ qs_for_harness ipc call settings-system-test apply "$target_auto_hdr" 7 "$target
# reporting "a rejected value did not surface an error" when the error simply
# had not arrived yet -- which reads as a missing guard rather than a slow one.
rejected=""
for _ in $(seq 1 60); do
for _ in $(seq 1 150); do
rejected="$(qs_for_harness ipc call settings-system-test status | jq -r .lastError)"
[[ -n "$rejected" ]] && break
sleep 0.1
@@ -215,7 +221,7 @@ qs_for_harness ipc call settings-system-test apply \
"$original_vrr" "$original_direct" >/dev/null
restored=false
for _ in $(seq 1 40); do
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