From 7a60c8dea4373d5e53ae805efc625fe6e0e65c60 Mon Sep 17 00:00:00 2001 From: Kros Dai Date: Tue, 6 Oct 2026 22:00:59 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(channel):=20require=20a=20us?= =?UTF-8?q?able=20region=20profile=20for=20dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - :bug: an empty profile directory or a helper that cannot run passed the guard, linked dev, and then broke the refresh - :white_check_mark: the success case now uses a complete profile Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SdXqTwm63rRMwotZ1xqLC8 --- bin/omarchy-channel-set | 5 ++++- test/shell.d/channel-test.sh | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-channel-set b/bin/omarchy-channel-set index f347317b..6a5c018f 100755 --- a/bin/omarchy-channel-set +++ b/bin/omarchy-channel-set @@ -55,7 +55,10 @@ validate_dev_region() { [[ -f $region_file ]] && region=$(<"$region_file") [[ $region == "global" ]] && return 0 - if [[ ! -f $checkout/bin/omarchy-apply-pacman || ! -d $checkout/default/regions/$region ]]; then + # The refresh after linking needs a runnable helper and both fragments, not + # just a directory with the region's name. + local profile="$checkout/default/regions/$region/pacman" + if [[ ! -x $checkout/bin/omarchy-apply-pacman || ! -r $profile/pacman.conf.append || ! -r $profile/mirrorlist.append ]]; then fail "$checkout does not support the '$region' region, so switching would drop its package repositories. Check out a branch with default/regions/$region, or remove $region_file to use global defaults." fi } diff --git a/test/shell.d/channel-test.sh b/test/shell.d/channel-test.sh index 7872c6f7..72418727 100644 --- a/test/shell.d/channel-test.sh +++ b/test/shell.d/channel-test.sh @@ -201,8 +201,29 @@ if grep -Eq $'^(link|refresh)\t' "$log_file"; then fi pass "dev refuses a checkout without the region before touching pacman" +# A directory with the region's name, or a helper that cannot run, is not +# support: the refresh after linking would fail with dev already linked. mkdir -p "$checkout/default/regions/cn" touch "$checkout/bin/omarchy-apply-pacman" +chmod +x "$checkout/bin/omarchy-apply-pacman" +if OMARCHY_TEST_REGION_FILE="$test_tmp/region" run_channel dev >"$test_tmp/region.out" 2>"$test_tmp/region.err"; then + fail "dev refuses an empty region profile" +fi +if grep -Eq $'^(link|refresh)\t' "$log_file"; then + fail "dev refuses an empty region profile before linking or refreshing pacman" "$(cat "$log_file")" +fi +mkdir -p "$checkout/default/regions/cn/pacman" +touch "$checkout/default/regions/cn/pacman/pacman.conf.append" "$checkout/default/regions/cn/pacman/mirrorlist.append" +chmod -x "$checkout/bin/omarchy-apply-pacman" +if OMARCHY_TEST_REGION_FILE="$test_tmp/region" run_channel dev >"$test_tmp/region.out" 2>"$test_tmp/region.err"; then + fail "dev refuses a checkout whose pacman helper cannot run" +fi +if grep -Eq $'^(link|refresh)\t' "$log_file"; then + fail "dev refuses incomplete region support before linking or refreshing pacman" "$(cat "$log_file")" +fi +pass "dev refuses an empty region profile or a helper that cannot run" + +chmod +x "$checkout/bin/omarchy-apply-pacman" OMARCHY_TEST_REGION_FILE="$test_tmp/region" run_channel dev assert_log_line $'refresh\tedge' "dev proceeds with a checkout that supports the region"