From 3e00a48c007eea911fb13bcb4acc559871bb8f6d Mon Sep 17 00:00:00 2001 From: Kros Dai Date: Tue, 6 Oct 2026 22:14:56 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test(pacman):=20sandbox=20the=20reg?= =?UTF-8?q?ion=20for=20every=20boundary=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - :white_check_mark: The channel and update boundary tests copied the real render and dev-region guard, so on a China install they read the host's `/etc/omarchy/region` and failed before reaching their checks - :recycle: The shared fixture now points both lookups at a sandbox target that starts global, and the regional test only writes `cn` there Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SdXqTwm63rRMwotZ1xqLC8 --- test/shell.d/fixtures/sudo-boundary-test.sh | 10 +++++++++- test/shell.d/region-refresh-boundary-test.sh | 9 --------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/test/shell.d/fixtures/sudo-boundary-test.sh b/test/shell.d/fixtures/sudo-boundary-test.sh index 1fb123d0..6332ed5a 100644 --- a/test/shell.d/fixtures/sudo-boundary-test.sh +++ b/test/shell.d/fixtures/sudo-boundary-test.sh @@ -9,7 +9,11 @@ export SUDO_TEST_LOG="$boundary_tmp/events" export SUDO_TEST_CACHE="$boundary_tmp/cache" export OMARCHY_PATH="$SUDO_TEST_ROOT" export SUDO_TEST_HOME="$boundary_tmp/home" -mkdir -p "$SUDO_TEST_HOME" +# The machine the render reads its region marker from. It starts global; a test +# writes etc/omarchy/region here to model a regional install, never the host's. +export SUDO_TEST_TARGET="$boundary_tmp/target" +export OMARCHY_REGION_FILE="$SUDO_TEST_TARGET/etc/omarchy/region" +mkdir -p "$SUDO_TEST_HOME" "$SUDO_TEST_TARGET/etc" mkdir -p "$SUDO_TEST_ROOT/bin" "$SUDO_TEST_ROOT/mock" "$SUDO_TEST_ROOT/default/omarchy/sudo-no-update" : >"$SUDO_TEST_LOG" @@ -24,6 +28,10 @@ s=(source/name).read_text().replace('$HOME', '$SUDO_TEST_HOME') for command in ['sudo','pkexec','pacman','omarchy-pkg-missing','systemd-inhibit','setpriv','snapper']: s=s.replace('/usr/bin/'+command, str(target/'mock'/command)) s=s.replace('PATH=/usr/bin:/usr/sbin:/bin:/sbin', 'PATH="'+str(target/'bin')+':/usr/bin:/usr/sbin:/bin:/sbin"') +if name.name == 'omarchy-apply-pacman': + render_etc='etc="${4:-/}/etc"' + assert s.count(render_etc)==1, 'render target lookup moved' + s=s.replace(render_etc, 'etc="${4:-$SUDO_TEST_TARGET}/etc"') p.write_text(s) p.chmod((source/name).stat().st_mode & 0o777) PY diff --git a/test/shell.d/region-refresh-boundary-test.sh b/test/shell.d/region-refresh-boundary-test.sh index c7c181d2..6bca2559 100755 --- a/test/shell.d/region-refresh-boundary-test.sh +++ b/test/shell.d/region-refresh-boundary-test.sh @@ -13,17 +13,8 @@ done # A sandboxed China machine: the render reads this region marker, never the # host's /etc/omarchy/region. -export SUDO_TEST_TARGET="$boundary_tmp/target" mkdir -p "$SUDO_TEST_TARGET/etc/omarchy" printf 'cn\n' >"$SUDO_TEST_TARGET/etc/omarchy/region" -python3 - "$SUDO_TEST_ROOT/bin/omarchy-apply-pacman" <<'PY' -import sys -path = sys.argv[1] -source = open(path).read() -render_etc = 'etc="${4:-/}/etc"' -assert source.count(render_etc) == 1, "render target lookup moved" -open(path, 'w').write(source.replace(render_etc, 'etc="${4:-$SUDO_TEST_TARGET}/etc"')) -PY # cp still logs its step, but now really copies, so the rendered files exist. # Root's copies into /etc land in a capture directory instead of the host.