Stop two contracts from driving each other's shell
settings-hyprland-write-contract failed in full suite runs and passed on its own, reporting "a typed batch did not reach the compositor" with every value at its default. Both it and settings-commit-reset-contract drive the same harness file, and Quickshell identifies an instance by its config path -- not by the environment it was launched with. So when one run's instance has not fully exited, the other's wait for `ipc show` is satisfied by that instance's target, and the whole contract then talks to a shell it did not start. The two directions fail differently, and the second is the alarming one: The write contract lands on the isolated instance, whose compositor write seam is deliberately stubbed. Its writes go nowhere, which is exactly the symptom above. The commit/reset contract lands on the non-isolated instance and drives the DAILY DESKTOP's real compositor while believing it is isolated. Both now refuse to start while another instance of that harness is alive, and say which hazard they are avoiding rather than failing on an assertion much later. One trap worth naming, since it bit me writing this: `rg -c` prints nothing at all when there are no matches, so an unguarded command substitution yields "" and not "0" -- the first version of the guard fired on a perfectly clean machine. Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
This commit is contained in:
@@ -61,6 +61,26 @@ restore() {
|
||||
}
|
||||
trap restore EXIT
|
||||
|
||||
# This contract shares its harness file with settings-hyprland-write-contract,
|
||||
# and Quickshell identifies an instance by config path -- so if that run's
|
||||
# instance is still alive, the IPC wait below is satisfied by ITS target. That
|
||||
# direction is the dangerous one: this contract believes the compositor seam is
|
||||
# stubbed, so it would happily drive the DAILY DESKTOP's real compositor while
|
||||
# reporting isolation. Refuse to start rather than find out.
|
||||
harness_instances() {
|
||||
# rg -c prints nothing when there are no matches, so an unguarded
|
||||
# substitution yields "" rather than "0".
|
||||
local count
|
||||
count="$(qs list 2>/dev/null | rg -c "^ Config path: $harness\$" || true)"
|
||||
printf '%s' "${count:-0}"
|
||||
}
|
||||
for _ in $(seq 1 50); do
|
||||
[[ "$(harness_instances)" == "0" ]] && break
|
||||
sleep 0.1
|
||||
done
|
||||
[[ "$(harness_instances)" == "0" ]] \
|
||||
|| fail 'another instance of the settings harness is still running -- this contract would drive it instead of its own isolated one, and that instance may be writing to the real compositor'
|
||||
|
||||
XDG_CONFIG_HOME="$config_home" XDG_STATE_HOME="$state_home" \
|
||||
PANAMA_SETTINGS_TEST_ISOLATE_COMPOSITOR=1 qs -p "$harness" --daemonize >/dev/null
|
||||
for _ in $(seq 1 40); do
|
||||
|
||||
Reference in New Issue
Block a user